OSDN Git Service

PR target/44643
authorgjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jul 2011 12:28:02 +0000 (12:28 +0000)
committergjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jul 2011 12:28:02 +0000 (12:28 +0000)
* config/avr/avr.c (avr_insert_attributes): Use TYPE_READONLY
instead of TREE_READONLY.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175809 138bc75d-0d04-0410-961f-82ee72b054a4

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

index bd353f4..1b56a8f 100644 (file)
@@ -1,5 +1,11 @@
 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  Georg-Johann Lay  <avr@gjlay.de>
+
        * doc/extend.texi (AVR Built-in Functions): Update documentation
        of __builtin_avr_fmul*.
        * config/avr/avr.c (avr_init_builtins): Don't depend on
index fa690fb..89da4fb 100644 (file)
@@ -5030,7 +5030,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";