OSDN Git Service

Backport from mainline
authorgjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jul 2011 12:33:00 +0000 (12:33 +0000)
committergjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jul 2011 12:33:00 +0000 (12:33 +0000)
2011-07-04  Georg-Johann Lay

PR target/44643
* config/avr/avr.c (avr_insert_attributes): Use TYPE_READONLY
instead of TREE_READONLY.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@175810 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/avr/avr.c

index 9e80a67..c20abcd 100644 (file)
@@ -1,3 +1,12 @@
+2011-07-04  Georg-Johann Lay  <avr@gjlay.de>
+
+       Backport from mainline
+       2011-07-04  Georg-Johann Lay  <avr@gjlay.de>
+       
+       PR target/44643
+       * config/avr/avr.c (avr_insert_attributes): Use TYPE_READONLY
+       instead of TREE_READONLY.
+
 2011-07-04  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/49615
index f491435..837e8f9 100644 (file)
@@ -5049,7 +5049,19 @@ avr_insert_attributes (tree node, tree *attributes)
       && (TREE_STATIC (node) || DECL_EXTERNAL (node))
       && avr_progmem_p (node, *attributes))
     {
-      if (TREE_READONLY (node)) 
+      tree node0 = node;
+
+      /* For C++, we have to peel arrays in order to get correct
+         determination of readonlyness.  */
+      
+      do
+        node0 = TREE_TYPE (node0);
+      while (TREE_CODE (node0) == ARRAY_TYPE);
+
+      if (error_mark_node == node0)
+        return;
+      
+      if (TYPE_READONLY (node0))
         {
           static const char dsec[] = ".progmem.data";