From 8264e6c39c497349881ee2259451f8ba9f1b8cd9 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Wed, 19 Apr 2017 12:20:57 +0000 Subject: [PATCH] re PR target/80462 ([avr] Incorrect "warning: uninitialized variable 'xxx' put into program memory area" for identical strings) PR target/80462 * config/avr/avr.c (tree.h): Include it. (cgraph.h): Include it. (avr_encode_section_info): Don't warn for uninitialized progmem variable if it's just an alias. From-SVN: r246997 --- gcc/ChangeLog | 8 ++++++++ gcc/config/avr/avr.c | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85025d4a402..1995cd536b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-04-19 Georg-Johann Lay + + PR target/80462 + * config/avr/avr.c (tree.h): Include it. + (cgraph.h): Include it. + (avr_encode_section_info): Don't warn for uninitialized progmem + variable if it's just an alias. + 2017-04-19 Richard Biener PR ipa/65972 diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index dde712c49c7..648a1256f80 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -25,6 +25,8 @@ #include "backend.h" #include "target.h" #include "rtl.h" +#include "tree.h" +#include "cgraph.h" #include "c-family/c-common.h" #include "cfghooks.h" #include "df.h" @@ -10127,9 +10129,14 @@ avr_encode_section_info (tree decl, rtx rtl, int new_decl_p) && !DECL_EXTERNAL (decl) && avr_progmem_p (decl, DECL_ATTRIBUTES (decl))) { - warning (OPT_Wuninitialized, - "uninitialized variable %q+D put into " - "program memory area", decl); + // Don't warn for (implicit) aliases like in PR80462. + tree asmname = DECL_ASSEMBLER_NAME (decl); + varpool_node *node = varpool_node::get_for_asmname (asmname); + bool alias_p = node && node->alias; + + if (!alias_p) + warning (OPT_Wuninitialized, "uninitialized variable %q+D put into " + "program memory area", decl); } default_encode_section_info (decl, rtl, new_decl_p); -- 2.30.2