aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-09-29 09:35:37 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-09-29 09:35:37 +0200
commit2a38995899548c685e8bd794f79c5aad80fc6ef0 (patch)
treeb1e36017321030a3f615e14cf3f81963936cc82f /gcc/c
parent2891beff1aa8e627ba27b35d28d6a8e6198a0625 (diff)
downloadgcc-2a38995899548c685e8bd794f79c5aad80fc6ef0.zip
gcc-2a38995899548c685e8bd794f79c5aad80fc6ef0.tar.gz
gcc-2a38995899548c685e8bd794f79c5aad80fc6ef0.tar.bz2
re PR c/82340 (volatile ignored in compound literal)
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. * gcc.dg/tree-ssa/pr82340.c: New test. From-SVN: r253280
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-decl.c4
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))