]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-decl.c (duplicate_decls): Do not call make_var_volatile() in case of invalid volati...
authorAlexandre Oliva <aoliva@redhat.com>
Tue, 18 Jul 2000 17:53:35 +0000 (17:53 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Tue, 18 Jul 2000 17:53:35 +0000 (17:53 +0000)
* c-decl.c (duplicate_decls): Do not call make_var_volatile() in
case of invalid volatile re-declaration.

From-SVN: r35119

gcc/ChangeLog
gcc/c-decl.c

index b183280c9929e6cbaf570b58bc647a65e9c8deed..a8cd839fd917dad39344e96fecfc168907e3f3cd 100644 (file)
@@ -1,3 +1,8 @@
+2000-07-18  Alexandre Oliva  <aoliva@redhat.com>
+
+       * c-decl.c (duplicate_decls): Do not call make_var_volatile() in
+       case of invalid volatile re-declaration.
+
 2000-07-18  Jakub Jelinek  <jakub@redhat.com>
 
        * calls.c (store_arg): Return non-zero if sibcall_failure is
index b759fd5e3ae47c772c7390db264b7178a63f9283..c2bbb95c5fedcba3deff1e903ec8f61c896f630e 100644 (file)
@@ -1843,7 +1843,14 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
       if (TREE_THIS_VOLATILE (newdecl))
        {
          TREE_THIS_VOLATILE (write_olddecl) = 1;
-         if (TREE_CODE (newdecl) == VAR_DECL)
+         if (TREE_CODE (newdecl) == VAR_DECL
+             /* If an automatic variable is re-declared in the same
+                function scope, but the old declaration was not
+                volatile, make_var_volatile() would crash because the
+                variable would have been assigned to a pseudo, not a
+                MEM.  Since this duplicate declaration is invalid
+                anyway, we just skip the call.  */
+             && errmsg == 0)
            make_var_volatile (newdecl);
        }