re PR target/50739 ([avr] nameless error with -fmerge-all-constants)
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
Wed, 6 Jul 2016 11:40:17 +0000 (11:40 +0000)
committerSenthil Kumar Selvaraj <saaadhu@gcc.gnu.org>
Wed, 6 Jul 2016 11:40:17 +0000 (11:40 +0000)
Fix PR target/50739

This patch fixes a problem with fmerge-all-constants and the progmem
attribute.

gcc/

PR target/50739
* config/avr/avr.c (avr_asm_select_section): Strip off
SECTION_DECLARED from flags when calling get_section.

testsuite/

PR target/50739
* gcc.target/avr/pr50739.c: New test

From-SVN: r238041

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

index c853885a2b36ff58f388f7b64b88c241618ca316..78d2257f29fa59bee28ced03111b1c38e7b6d814 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-06  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
+
+       PR target/50739 
+       * config/avr/avr.c (avr_asm_select_section): Strip off
+       SECTION_DECLARED from flags when calling get_section.
+
 2016-07-06  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vectorizer.h (vect_memory_access_type): Add
index 18ed766e0e8a653045c0976539e54564afae5b1e..7371f294df24b0d023f75376712c43ef065175e6 100644 (file)
@@ -9641,7 +9641,9 @@ avr_asm_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
             {
               const char *sname = ACONCAT ((new_prefix,
                                             name + strlen (old_prefix), NULL));
-              return get_section (sname, sect->common.flags, sect->named.decl);
+              return get_section (sname,
+                                  sect->common.flags & ~SECTION_DECLARED,
+                                  sect->named.decl);
             }
         }
 
index ea48e668f051199f256bb08c4db673b143bedea5..0e11d8b76e0c54e951de1460f7d0c1fe2c8d54db 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-06  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
+
+       PR target/50739 
+       * gcc.target/avr/pr50739.c: New test.
+
 2016-07-05  Jan Hubicka  <jh@suse.cz>
 
        * gcc.dg/tree-ssa/scev-14.c: update template.
diff --git a/gcc/testsuite/gcc.target/avr/pr50739.c b/gcc/testsuite/gcc.target/avr/pr50739.c
new file mode 100644 (file)
index 0000000..a6850b7
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-fmerge-all-constants" } */
+
+char *ca = "123";
+
+const char a[] __attribute__((__progmem__))= "a";
+const char b[] __attribute__((__progmem__))= "b";