diff options
author | Martin Sebor <msebor@redhat.com> | 2016-02-24 17:23:35 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2016-02-24 10:23:35 -0700 |
commit | 3b96b93aec896a79bffad622ce6a161276cb198e (patch) | |
tree | df773a7c17ec70564d69527a0612f6a4dc771193 /gcc | |
parent | 57c2c374df803636ce218618091114ac13647467 (diff) | |
download | gcc-3b96b93aec896a79bffad622ce6a161276cb198e.zip gcc-3b96b93aec896a79bffad622ce6a161276cb198e.tar.gz gcc-3b96b93aec896a79bffad622ce6a161276cb198e.tar.bz2 |
PR c++/69912 - [6 regression] ICE in build_ctor_subob_ref initializing
PR c++/69912 - [6 regression] ICE in build_ctor_subob_ref initializing
a flexible array member
gcc/testsuite/ChangeLog:
2016-02-24 Martin Sebor <msebor@redhat.com>
PR c++/69912
* g++.dg/ext/flexary15.C: New test.
gcc/cp/ChangeLog:
2016-02-24 Martin Sebor <msebor@redhat.com>
PR c++/69912
* tree.c (build_ctor_subob_ref): Compare types' main variants
instead of the types as they are.
From-SVN: r233678
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/tree.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/flexary15.C | 14 |
4 files changed, 31 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6212d43..764d2a8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +016-02-24 Martin Sebor <msebor@redhat.com> + + PR c++/69912 + * tree.c (build_ctor_subob_ref): Compare types' main variants + instead of the types as they are. + 2016-02-24 Jason Merrill <jason@redhat.com> * decl.c (start_preparsed_function): Condition ctor clobber on diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 3203aca..0f7287a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2592,8 +2592,10 @@ build_ctor_subob_ref (tree index, tree type, tree obj) { /* When the destination object refers to a flexible array member verify that it matches the type of the source object except - for its domain. */ - gcc_assert (comptypes (type, objtype, COMPARE_REDECLARATION)); + for its domain and qualifiers. */ + gcc_assert (comptypes (TYPE_MAIN_VARIANT (type), + TYPE_MAIN_VARIANT (objtype), + COMPARE_REDECLARATION)); } else gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, objtype)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b215d09..311232f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,8 +1,13 @@ 2016-02-24 Martin Sebor <msebor@redhat.com> - * gcc/testsuite/gcc.dg/builtins-68.c: Avoid making unportable + PR c++/69912 + * g++.dg/ext/flexary15.C: New test. + +2016-02-24 Martin Sebor <msebor@redhat.com> + + * gcc.dg/builtins-68.c: Avoid making unportable assumptions about the relationship between SIZE_MAX and UINT_MAX. - * gcc/testsuite/g++.dg/ext/builtin_alloca.C: Same. + * g++.dg/ext/builtin_alloca.C: Same. 2016-02-24 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> Charles Baylis <charles.baylis@linaro.org> diff --git a/gcc/testsuite/g++.dg/ext/flexary15.C b/gcc/testsuite/g++.dg/ext/flexary15.C new file mode 100644 index 0000000..c03a60e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/flexary15.C @@ -0,0 +1,14 @@ +// PR c++/69912 - [6 regression] ICE in build_ctor_subob_ref initializing +// a flexible array member +// { dg-do compile } +// { dg-options "-Wno-pedantic -Wno-write-strings -fpermissive" } + +struct S { + int n; + char *a[]; +}; + +void foo (const char *a) +{ + const S s = { 1, { a, "b" } }; // { dg-warning "invalid conversion" } +} |