This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81028] GCC miscompiles placement new
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Jun 2017 12:05:41 +0000
- Subject: [Bug tree-optimization/81028] GCC miscompiles placement new
- Auto-submitted: auto-generated
- References: <bug-81028-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81028
--- Comment #5 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 9 Jun 2017, trippels at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81028
>
> Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |trippels at gcc dot gnu.org
>
> --- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
> clang and icc also call abort.
not that I didn't expect this ;) C testcase follows, writing to a union
member activates it:
extern void abort();
typedef int A;
typedef float B;
void __attribute__((noinline,noclone))
foo(A *p, B *q, long unk)
{
for (long i = 0; i < unk; ++i) {
*p = 1;
q[i] = 42;
}
}
int main(void)
{
union { A x; B f; } u;
foo(&u.x, &u.f, 1);
if (u.f != 42) abort();
return 0;
}