diff options
author | Adam Nemet <anemet@lnxw.com> | 2004-10-28 19:30:49 +0000 |
---|---|---|
committer | Adam Nemet <nemet@gcc.gnu.org> | 2004-10-28 19:30:49 +0000 |
commit | 0039fa5565d141f17b2517100a32694c18504802 (patch) | |
tree | 03d631e3469748cc661ebe96d5fa06e820f94e93 /gcc | |
parent | 5c588b22b57641e0c766b2fbf77ed4b9836e9805 (diff) | |
download | gcc-0039fa5565d141f17b2517100a32694c18504802.zip gcc-0039fa5565d141f17b2517100a32694c18504802.tar.gz gcc-0039fa5565d141f17b2517100a32694c18504802.tar.bz2 |
re PR middle-end/18160 (ICE on taking register variable address)
PR middle-end/18160
* c-typeck.c (c_mark_addressable): Issue error if address of a
register variable is taken. Use "%qD" to print DECL_NAME.
From-SVN: r89772
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-typeck.c | 23 |
2 files changed, 15 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d19df0e..0aa6c69 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-10-28 Adam Nemet <anemet@lnxw.com> + + PR middle-end/18160 + * c-typeck.c (c_mark_addressable): Issue error if address of a + register variable is taken. Use "%qD" to print DECL_NAME. + 2004-10-28 Diego Novillo <dnovillo@redhat.com> * opts.c (decode_options): Don't run PRE at -Os. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 9e4f0fb..7d599bc 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2818,8 +2818,8 @@ c_mark_addressable (tree exp) case COMPONENT_REF: if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1))) { - error ("cannot take address of bit-field %qs", - IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (x, 1)))); + error + ("cannot take address of bit-field %qD", TREE_OPERAND (x, 1)); return false; } @@ -2846,24 +2846,19 @@ c_mark_addressable (tree exp) { if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) { - error ("global register variable %qs used in nested function", - IDENTIFIER_POINTER (DECL_NAME (x))); + error + ("global register variable %qD used in nested function", x); return false; } - pedwarn ("register variable %qs used in nested function", - IDENTIFIER_POINTER (DECL_NAME (x))); + pedwarn ("register variable %qD used in nested function", x); } else if (C_DECL_REGISTER (x)) { if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) - { - error ("address of global register variable %qs requested", - IDENTIFIER_POINTER (DECL_NAME (x))); - return false; - } - - pedwarn ("address of register variable %qs requested", - IDENTIFIER_POINTER (DECL_NAME (x))); + error ("address of global register variable %qD requested", x); + else + error ("address of register variable %qD requested", x); + return false; } /* drops in */ |