re PR middle-end/18160 (ICE on taking register variable address)
authorAdam Nemet <anemet@lnxw.com>
Thu, 28 Oct 2004 19:30:49 +0000 (19:30 +0000)
committerAdam Nemet <nemet@gcc.gnu.org>
Thu, 28 Oct 2004 19:30:49 +0000 (19:30 +0000)
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

gcc/ChangeLog
gcc/c-typeck.c

index d19df0e..0aa6c69 100644 (file)
@@ -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.
index 9e4f0fb..7d599bc 100644 (file)
@@ -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 */