From 7b4e076985f2c41f93fb8d8f89183ef1244f98ae Mon Sep 17 00:00:00 2001 From: Senthil Kumar Selvaraj Date: Wed, 6 Jul 2016 11:40:17 +0000 Subject: [PATCH] re PR target/50739 ([avr] nameless error with -fmerge-all-constants) 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 | 6 ++++++ gcc/config/avr/avr.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/avr/pr50739.c | 7 +++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/avr/pr50739.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c853885a2b3..78d2257f29f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-06 Senthil Kumar Selvaraj + + 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 * tree-vectorizer.h (vect_memory_access_type): Add diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 18ed766e0e8..7371f294df2 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -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); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ea48e668f05..0e11d8b76e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-06 Senthil Kumar Selvaraj + + PR target/50739 + * gcc.target/avr/pr50739.c: New test. + 2016-07-05 Jan Hubicka * 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 index 00000000000..a6850b73c3e --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr50739.c @@ -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"; -- 2.30.2