+2017-08-22 Georg-Johann Lay <avr@gjlay.de>
+
+ Backport from 2017-04-19 trunk r246997.
+
+ PR target/80462
+ * config/avr/avr.c (tree.h): Include it.
+ (hash-table.h): Include it.
+ (hash-set.h): Include it.
+ (symtab.h): Include it.
+ (inchash.h): Include it.
+ (function.h): Include it.
+ (hash-map.h): Include it.
+ (plugin-api.h): Include it.
+ (ipa-ref.h): Include it.
+ (cgraph.h): Include it.
+ (avr_encode_section_info): Don't warn for uninitialized progmem
+ variable if it's just an alias.
+
+ Backport from 2017-07-12 trunk r250151.
+
+ PR target/81407
+ * config/avr/avr.c (avr_encode_section_info)
+ [progmem && !TREE_READONLY]: Error if progmem object needs
+ constructing.
+
2017-08-22 Georg-Johann Lay <avr@gjlay.de>
Backport from 2017-08-22 trunk r251256.
#include "config.h"
#include "system.h"
#include "coretypes.h"
+#include "hash-table.h"
#include "tm.h"
#include "hard-reg-set.h"
#include "rtl.h"
+#include "hash-set.h"
+#include "symtab.h"
+#include "inchash.h"
+#include "tree.h"
+#include "function.h"
+#include "hash-map.h"
+#include "plugin-api.h"
+#include "ipa-ref.h"
+#include "cgraph.h"
#include "regs.h"
#include "insn-config.h"
#include "conditions.h"
if (new_decl_p
&& decl && DECL_P (decl)
- && NULL_TREE == DECL_INITIAL (decl)
&& !DECL_EXTERNAL (decl)
&& avr_progmem_p (decl, DECL_ATTRIBUTES (decl)))
{
- warning (OPT_Wuninitialized,
- "uninitialized variable %q+D put into "
- "program memory area", decl);
+ if (!TREE_READONLY (decl))
+ {
+ // This might happen with C++ if stuff needs constructing.
+ error ("variable %q+D with dynamic initialization put "
+ "into program memory area", decl);
+ }
+ else if (NULL_TREE == DECL_INITIAL (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);