diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2011-04-14 08:38:20 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2011-04-14 08:38:20 +0000 |
commit | 8a9b55f326aa8e8df001bc6574b5ac2499698619 (patch) | |
tree | 7afe13e05b7c615bf22639576d22fc202e4c786c | |
parent | 94bd18251335d1f63e0b89e2572183a2b8775ffc (diff) | |
download | gcc-8a9b55f326aa8e8df001bc6574b5ac2499698619.zip gcc-8a9b55f326aa8e8df001bc6574b5ac2499698619.tar.gz gcc-8a9b55f326aa8e8df001bc6574b5ac2499698619.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 22 |
2 files changed, 20 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8313a3..6ca6b28 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 56b216b..ca06431 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -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); + } } } |