(duplicate_decls): If an old decl becomes volatile, fix the DECL_RTL.
authorRichard Stallman <rms@gnu.org>
Mon, 22 Jun 1992 01:35:52 +0000 (01:35 +0000)
committerRichard Stallman <rms@gnu.org>
Mon, 22 Jun 1992 01:35:52 +0000 (01:35 +0000)
From-SVN: r1230

gcc/c-decl.c

index 4e516234f4012507f3d8d4be4bd0a4f75fac5558..57744cd924b2bc52e42bf9b7692b882799c6c0be 100644 (file)
@@ -1221,10 +1221,10 @@ duplicate_decls (newdecl, olddecl)
        }
       else if (!types_match)
        {
-         /* If the types don't match, use whatever the program declares,
-            not the predeclared type.  Preserve volatility indication.  */
+         /* If the types don't match, preserve volatility indication.
+            Later on, we will discard everything else about the
+            default declaration.  */
          TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
-         return 0;
        }
     }
   else if (!types_match
@@ -1417,6 +1417,9 @@ duplicate_decls (newdecl, olddecl)
        DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
       /* Keep the old rtl since we can safely use it.  */
       DECL_RTL (newdecl) = DECL_RTL (olddecl);
+      if (TREE_CODE (newdecl) == VAR_DECL
+         && TREE_THIS_VOLATILE (newdecl))
+       make_var_volatile (newdecl);
     }
   /* If cannot merge, then use the new type and qualifiers,
      and don't preserve the old rtl.  */