diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-11-24 23:45:45 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-11-24 23:45:45 +0000 |
commit | ddffee6824dc069e4a18f572c06ccf5313e41377 (patch) | |
tree | 71423d373addab18e0cac37a688d8accf1aa4145 /gcc | |
parent | 40ff695f5cb23ff4313d5a22c5e97f971e4bd65b (diff) | |
download | gcc-ddffee6824dc069e4a18f572c06ccf5313e41377.zip gcc-ddffee6824dc069e4a18f572c06ccf5313e41377.tar.gz gcc-ddffee6824dc069e4a18f572c06ccf5313e41377.tar.bz2 |
re PR c++/55446 (array new with size zero vanishes from object code)
/cp
2012-11-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55446
* init.c (build_vec_init): Do not early return error_mark_mode
when integer_all_onesp (maxindex).
/testsuite
2012-11-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55446
* g++.dg/init/new41.C: New.
From-SVN: r193785
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/new41.C | 22 |
4 files changed, 34 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 95fb0bf..edb45f4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-11-24 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/55446 + * init.c (build_vec_init): Do not early return error_mark_mode + when integer_all_onesp (maxindex). + 2012-11-23 Jakub Jelinek <jakub@redhat.com> PR c++/54046 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index fea50b5..76a31c1b 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3283,8 +3283,7 @@ build_vec_init (tree base, tree maxindex, tree init, if (TREE_CODE (atype) == ARRAY_TYPE && TYPE_DOMAIN (atype)) maxindex = array_type_nelts (atype); - if (maxindex == NULL_TREE || maxindex == error_mark_node - || integer_all_onesp (maxindex)) + if (maxindex == NULL_TREE || maxindex == error_mark_node) return error_mark_node; if (explicit_value_init_p) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f962907..eb23b00 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-11-24 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/55446 + * g++.dg/init/new41.C: New. + 2012-11-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/55314 diff --git a/gcc/testsuite/g++.dg/init/new41.C b/gcc/testsuite/g++.dg/init/new41.C new file mode 100644 index 0000000..0559b1d --- /dev/null +++ b/gcc/testsuite/g++.dg/init/new41.C @@ -0,0 +1,22 @@ +// PR c++/55446 +// { dg-do run } + +struct S +{ + S() { } +}; + +int n = 1; + +void* operator new[](__SIZE_TYPE__) +{ + n = -1; + return &n; +} + +int main() +{ + new S[0]; + if (n != -1) + __builtin_abort(); +} |