aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-06-22 01:35:52 +0000
committerRichard Stallman <rms@gnu.org>1992-06-22 01:35:52 +0000
commit4d06f14570ebec47f666a03bd7f67b832d1e7f0f (patch)
tree9c1bd40f3c709563130fbc53e795c6c17f8a514f /gcc
parent4724d87a5aa533a481a4f1c79804ebfa28e48c87 (diff)
downloadgcc-4d06f14570ebec47f666a03bd7f67b832d1e7f0f.zip
gcc-4d06f14570ebec47f666a03bd7f67b832d1e7f0f.tar.gz
gcc-4d06f14570ebec47f666a03bd7f67b832d1e7f0f.tar.bz2
(duplicate_decls): If an old decl becomes volatile, fix the DECL_RTL.
From-SVN: r1230
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 4e51623..57744cd 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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. */