re PR target/71103 (avr-gcc crashes with unrecognizable insn error)
authorPitchumani Sivanupandi <pitchumani.s@atmel.com>
Sat, 21 May 2016 10:47:27 +0000 (10:47 +0000)
committerDenis Chertykov <denisc@gcc.gnu.org>
Sat, 21 May 2016 10:47:27 +0000 (13:47 +0300)
PR target/71103
* config/avr/avr.md (define_expand "mov<mode>"): If the source
operand is subreg (symbol_ref) then move the symbol ref to register.

PR target/71103
* gcc.target/avr/pr71103.c: New test.

From-SVN: r236558

gcc/ChangeLog
gcc/config/avr/avr.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/avr/pr71103.c [new file with mode: 0644]

index a4cdb4e..8652f5c 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-21  Pitchumani Sivanupandi  <pitchumani.s@atmel.com>
+
+       PR target/71103
+       * config/avr/avr.md (define_expand "mov<mode>"): If the source
+       operand is subreg (symbol_ref) then move the symbol ref to register.
+
 2016-05-21  Jan Hubicka  <hubicka@ucw.cz>
 
        * tree.c (array_at_struct_end_p): Look through MEM_REF.
index c988446..927bc69 100644 (file)
     rtx dest = operands[0];
     rtx src  = avr_eval_addr_attrib (operands[1]);
 
+    if (SUBREG_P(src) && (GET_CODE(XEXP(src,0)) == SYMBOL_REF) &&
+        can_create_pseudo_p())
+      {
+        rtx symbol_ref = XEXP(src, 0);
+        XEXP (src, 0) = copy_to_mode_reg (GET_MODE(symbol_ref), symbol_ref);
+      }
+
     if (avr_mem_flash_p (dest))
       DONE;
 
index 3fc92f1..a409b88 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-20  Pitchumani Sivanupandi  <pitchumani.s@atmel.com>
+
+       PR target/71103
+       * gcc.target/avr/pr71103.c: New test.
+
 2016-05-21  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        PR middle-end/71179
diff --git a/gcc/testsuite/gcc.target/avr/pr71103.c b/gcc/testsuite/gcc.target/avr/pr71103.c
new file mode 100644 (file)
index 0000000..43244d1
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+struct ResponseStruct{                                                                                            
+    unsigned char responseLength;
+    char *response;
+};
+
+static char response[5];
+struct ResponseStruct something(){
+    struct ResponseStruct returnValue;
+    returnValue.responseLength = 5;
+    returnValue.response = response;
+    return returnValue;
+}
+