diff options
author | Joseph Myers <joseph@codesourcery.com> | 2005-07-05 18:34:29 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2005-07-05 18:34:29 +0100 |
commit | 692a7aa3a5aea69f4f771b8a56f6aac9866fe383 (patch) | |
tree | 0336b82d2cbcc343230684b1de3dc6ab352f23af /gcc | |
parent | 2d95cce3c9ddcd26b93fe95f539c3380e2213ad5 (diff) | |
download | gcc-692a7aa3a5aea69f4f771b8a56f6aac9866fe383.zip gcc-692a7aa3a5aea69f4f771b8a56f6aac9866fe383.tar.gz gcc-692a7aa3a5aea69f4f771b8a56f6aac9866fe383.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-decl.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr22308-1.c | 13 |
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d680ff8..2d38897 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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> * Makefile.in: Adjust dependencies. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 3c241fe..23ff373 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5420,6 +5420,9 @@ finish_struct (tree t, tree fieldlist, tree attributes) TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t); TYPE_ALIGN (x) = TYPE_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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 546754f..7588b666 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> * gcc.dg/compare1.c: Add -fno-short-enums. Don't skip on any diff --git a/gcc/testsuite/gcc.dg/pr22308-1.c b/gcc/testsuite/gcc.dg/pr22308-1.c new file mode 100644 index 0000000..bcbb294 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr22308-1.c @@ -0,0 +1,13 @@ +/* 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'" } */ +} |