Commit ddffee68 by Paolo Carlini Committed by Paolo Carlini

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
parent 40ff695f
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
......
......@@ -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)
......
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
......
// 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();
}
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