Commit 2a389958 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 2891beff
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
......
......@@ -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))
......
2017-09-29 Jakub Jelinek <jakub@redhat.com>
PR c/82340
* gcc.dg/tree-ssa/pr82340.c: New test.
* g++.dg/eh/uncaught3.C: Add -Wno-deprecated for c++17.
2017-09-28 Paolo Carlini <paolo.carlini@oracle.com>
......
/* PR c/82340 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-ssa" } */
/* { dg-final { scan-tree-dump "D.\[0-9]*\\\[0\\\] ={v} 77;" "ssa" } } */
int
foo (void)
{
int i;
volatile char *p = (volatile char[1]) { 77 };
for (i = 1; i < 10; i++)
*p = 4;
return *p;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment