[Bug c++/101480] [11/12 Regression] Miscompiled code involving operator new
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 19 14:36:54 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101480
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 863bc0d17f1..e085d9de49a 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1516,12 +1516,12 @@ gimple_call_fnspec (const gcall *stmt)
&& DECL_IS_OPERATOR_DELETE_P (fndecl)
&& DECL_IS_REPLACEABLE_OPERATOR (fndecl)
&& gimple_call_from_new_or_delete (stmt))
- return ".co ";
+ return ". o ";
/* Similarly operator new can be treated as malloc. */
if (fndecl
&& DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl)
&& gimple_call_from_new_or_delete (stmt))
- return "mC";
+ return "m ";
return "";
}
regresses
FAIL: g++.dg/warn/Warray-bounds-16.C -std=gnu++14 scan-tree-dump-not
optimized "goto"
FAIL: g++.dg/warn/Warray-bounds-16.C -std=gnu++14 (test for excess errors)
where we now diagnose
/home/rguenther/src/trunk/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:22:7:
warning: array subscript 0 is outside array bounds of 'void [0]'
[-Warray-bounds]
/home/rguenther/src/trunk/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:22:7:
warning: 'void* __builtin_memset(void*, int, long unsigned int)' offset [0, 3]
is out of the bounds [0, 0] [-Warray-bounds]
the testcase does
m = i;
p = (int*) new unsigned char [sizeof (int) * m];
for (int i = 0; i < m; i++)
new (p + i) int ();
and we likely have to assume that 'new' changes 'm'.
More information about the Gcc-bugs
mailing list