From db297e20845c258a8c02eeab220027d9717a3cd3 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Mon, 4 Jul 2011 12:28:02 +0000 Subject: [PATCH] re PR target/44643 ([avr] ICE in c-typeck.c) PR target/44643 * config/avr/avr.c (avr_insert_attributes): Use TYPE_READONLY instead of TREE_READONLY. From-SVN: r175809 --- gcc/ChangeLog | 6 ++++++ gcc/config/avr/avr.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd353f4d2b1..1b56a8f79f8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-07-04 Georg-Johann Lay + + PR target/44643 + * config/avr/avr.c (avr_insert_attributes): Use TYPE_READONLY + instead of TREE_READONLY. + 2011-07-04 Georg-Johann Lay * doc/extend.texi (AVR Built-in Functions): Update documentation diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index fa690fb683d..89da4fbe649 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -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"; -- 2.30.2