Commit 8a9b55f3 by Georg-Johann Lay Committed by Georg-Johann Lay

re PR target/44643 ([avr] ICE in c-typeck.c)

	PR target/44643
	* config/avr/avr.c (avr_insert_attributes): Leave TREE_READONLY
	alone. Error if non-const data has attribute progmem.

From-SVN: r172415
parent 94bd1825
2011-04-14 Georg-Johann Lay <avr@gjlay.de>
PR target/44643
* config/avr/avr.c (avr_insert_attributes): Leave TREE_READONLY
alone. Error if non-const data has attribute progmem.
2011-04-13 Nathan Froyd <froydnj@codesourcery.com>
* tree.h (struct tree_constructor): Include tree_typed instead of
......
......@@ -5149,14 +5149,20 @@ avr_insert_attributes (tree node, tree *attributes)
&& (TREE_STATIC (node) || DECL_EXTERNAL (node))
&& avr_progmem_p (node, *attributes))
{
static const char dsec[] = ".progmem.data";
*attributes = tree_cons (get_identifier ("section"),
build_tree_list (NULL, build_string (strlen (dsec), dsec)),
*attributes);
/* ??? This seems sketchy. Why can't the user declare the
thing const in the first place? */
TREE_READONLY (node) = 1;
if (TREE_READONLY (node))
{
static const char dsec[] = ".progmem.data";
*attributes = tree_cons (get_identifier ("section"),
build_tree_list (NULL, build_string (strlen (dsec), dsec)),
*attributes);
}
else
{
error ("variable %q+D must be const in order to be put into"
" read-only section by means of %<__attribute__((progmem))%>",
node);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment