diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-06-30 06:24:28 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-06-30 06:24:28 -0400 |
commit | 084b6d7b052f5589658b07de9f60ca2f79f1fc42 (patch) | |
tree | 9c42ef79c7154cf0eb17c6bef3e6c687125030fd /gcc/c-common.c | |
parent | 14e7bf7c23ef7c73505606524baaab8fae79186b (diff) | |
download | gcc-084b6d7b052f5589658b07de9f60ca2f79f1fc42.zip gcc-084b6d7b052f5589658b07de9f60ca2f79f1fc42.tar.gz gcc-084b6d7b052f5589658b07de9f60ca2f79f1fc42.tar.bz2 |
(c_build_type_variant): Remove last change; instead, copy TYPE if not
in old obstack.
From-SVN: r7618
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index f55dbb5..920c73d 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1972,16 +1972,26 @@ c_build_type_variant (type, constp, volatilep) { if (TREE_CODE (type) == ARRAY_TYPE) { - push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); + tree real_main_variant = TYPE_MAIN_VARIANT (type); + + push_obstacks (TYPE_OBSTACK (real_main_variant), + TYPE_OBSTACK (real_main_variant)); type = build_array_type (c_build_type_variant (TREE_TYPE (type), constp, volatilep), TYPE_DOMAIN (type)); - pop_obstacks (); - /* If the old TYPE had variants, we lose them here. However, - since the new TYPE can be in the permanent obstack and the - old one may not be, preserving this chain would cause permanent - objects to point to non-permanent ones. */ + /* TYPE must be on same obstack as REAL_MAIN_VARIANT. If not, + make a copy. (TYPE might have come from the hash table and + REAL_MAIN_VARIANT might be in some function's obstack.) */ + + if (TYPE_OBSTACK (type) != TYPE_OBSTACK (real_main_variant)) + { + type = copy_node (type); + TYPE_POINTER_TO (type) = TYPE_REFERENCE_TO (type) = 0; + } + + TYPE_MAIN_VARIANT (type) = real_main_variant; + pop_obstacks (); } return build_type_variant (type, constp, volatilep); } |