stmt.c (expand_decl): Be more selective about calling mark_reg_pointer.
authorJeff Law <law@redhat.com>
Tue, 1 Jun 2004 07:42:35 +0000 (01:42 -0600)
committerJeff Law <law@gcc.gnu.org>
Tue, 1 Jun 2004 07:42:35 +0000 (01:42 -0600)
        * stmt.c (expand_decl): Be more selective about calling
        mark_reg_pointer.

From-SVN: r82533

gcc/ChangeLog
gcc/stmt.c

index 9e3fd3b527145634c712bc1a08769811635c25b6..8656d299987128b18809cf23bc2f72dd5e04363c 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-19  Jeff Law <law@redhat.com>
+
+        * stmt.c (expand_decl): Be more selective about calling
+        mark_reg_pointer.
+
 2004-06-01  Nicola Pero  <nicola@brainstorm.co.uk>
 
        PR objc/7993
index 7c4c67b3bd7aea56fa8873158a34f382ff9b2478..4df59f8eb452c621f92d038abeef968c063deb00 100644 (file)
@@ -3422,12 +3422,21 @@ expand_decl (tree decl)
 
       SET_DECL_RTL (decl, gen_reg_rtx (reg_mode));
 
+      /* Note if the object is a user variable.  */
       if (!DECL_ARTIFICIAL (decl))
-       mark_user_reg (DECL_RTL (decl));
-
-      if (POINTER_TYPE_P (type))
-       mark_reg_pointer (DECL_RTL (decl),
-                         TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl))));
+       {
+         mark_user_reg (DECL_RTL (decl));
+
+         /* Trust user variables which have a pointer type to really
+            be pointers.  Do not trust compiler generated temporaries
+            as our type system is totally busted as it relates to
+            pointer arithmetic which translates into lots of compiler
+            generated objects with pointer types, but which are not really
+            pointers.  */
+         if (POINTER_TYPE_P (type))
+           mark_reg_pointer (DECL_RTL (decl),
+                             TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl))));
+       }
 
       maybe_set_unchanging (DECL_RTL (decl), decl);