Commit 692a7aa3 by Joseph Myers Committed by Joseph Myers

re PR c/22308 (Failure to diagnose violation of constraint 6.516p2)

	PR c/22308
	* c-decl.c (finish_struct): Also copy C_TYPE_FIELDS_READONLY,
	C_TYPE_FIELDS_VOLATILE and C_TYPE_VARIABLE_SIZE to type variants.

testsuite:
	* gcc.dg/pr22308-1.c: New test.

From-SVN: r101629
parent 2d95cce3
2005-07-05 Joseph S. Myers <joseph@codesourcery.com>
PR c/22308
* c-decl.c (finish_struct): Also copy C_TYPE_FIELDS_READONLY,
C_TYPE_FIELDS_VOLATILE and C_TYPE_VARIABLE_SIZE to type variants.
2005-07-05 Paolo Bonzini <bonzini@gnu.org> 2005-07-05 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in: Adjust dependencies. * Makefile.in: Adjust dependencies.
......
...@@ -5420,6 +5420,9 @@ finish_struct (tree t, tree fieldlist, tree attributes) ...@@ -5420,6 +5420,9 @@ finish_struct (tree t, tree fieldlist, tree attributes)
TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t); TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t);
TYPE_ALIGN (x) = TYPE_ALIGN (t); TYPE_ALIGN (x) = TYPE_ALIGN (t);
TYPE_USER_ALIGN (x) = TYPE_USER_ALIGN (t); TYPE_USER_ALIGN (x) = TYPE_USER_ALIGN (t);
C_TYPE_FIELDS_READONLY (x) = C_TYPE_FIELDS_READONLY (t);
C_TYPE_FIELDS_VOLATILE (x) = C_TYPE_FIELDS_VOLATILE (t);
C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t);
} }
/* If this was supposed to be a transparent union, but we can't /* If this was supposed to be a transparent union, but we can't
......
2005-07-05 Joseph S. Myers <joseph@codesourcery.com>
PR c/22308
* gcc.dg/pr22308-1.c: New test.
2005-07-05 Kazu Hirata <kazu@codesourcery.com> 2005-07-05 Kazu Hirata <kazu@codesourcery.com>
* gcc.dg/compare1.c: Add -fno-short-enums. Don't skip on any * gcc.dg/compare1.c: Add -fno-short-enums. Don't skip on any
......
/* Bug 22308: C_TYPE_FIELDS_READONLY not updated on type variants. */
/* { dg-do compile } */
/* { dg-options "" } */
struct foo s;
volatile struct foo t;
struct foo { const int z; };
void
bar (void)
{
t = s; /* { dg-error "error: assignment of read-only variable 't'" } */
}
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