diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 135445e..496b767 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-09-29 Jakub Jelinek <jakub@redhat.com> + + PR c/82340 + * c-decl.c (build_compound_literal): Use c_apply_type_quals_to_decl + instead of trying to set just TREE_READONLY manually. + 2017-09-16 Tom de Vries <tom@codesourcery.com> PR c/81875 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7121498..080a2e9 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5247,9 +5247,7 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const) DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; TREE_TYPE (decl) = type; - TREE_READONLY (decl) = (TYPE_READONLY (type) - || (TREE_CODE (type) == ARRAY_TYPE - && TYPE_READONLY (TREE_TYPE (type)))); + c_apply_type_quals_to_decl (TYPE_QUALS (strip_array_types (type)), decl); store_init_value (loc, decl, init, NULL_TREE); if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type)) |