[Bug target/79671] [7 Regression] mapnik miscompilation on armv7hl since r235622
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Feb 28 10:33:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
--- Comment #27 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 28 Feb 2017, jakub at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
>
> --- Comment #26 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> What about PODs or say int? Let's say I have a class with union in it and in
> that union say float and char array, then use placement new an int with some
> value into the char array in the union. What will then happen if I default
> copy the class (default assignment operator or copy constructor)? The
> following doesn't fail, but I think true_dependence still returns 0 for
> (mem/c:SI (plus:DI (reg/f:DI 7 sp)
> (const_int 4 [0x4])) [4 MEM[(int *)&b + 4B]+0 S4 A32])
> and
> (mem:DI (reg/v/f:DI 0 ax [orig:87 p ] [87]) [1 MEM[(const struct B &)p_4]+0 S8
> A32])
> where the former is from the placement new store of int and the load is from
> the structure assignment.
>
> inline void* operator new(__SIZE_TYPE__, void *p) { return p; }
> struct B
> {
> float x;
> union U
> {
> float a;
> char b[sizeof (int)];
> } u;
> float y;
> };
>
> __attribute__((noinline, noclone)) void
> bar (B &x, B &y)
> {
> if (x.x != 0 || x.y != 3 || y.x != 0 || y.y != 3)
> __builtin_abort ();
> int f;
> __builtin_memcpy (&f, x.u.b, sizeof (int));
> if (f != 81)
> __builtin_abort ();
> __builtin_memcpy (&f, y.u.b, sizeof (int));
> if (f != 81)
> __builtin_abort ();
> }
>
> __attribute__((noinline, noclone))
> B *
> baz (B &x)
> {
> return &x;
> }
>
> __attribute__((noinline, noclone)) void
> foo (int x)
> {
> B b { 0.0f, {}, 3.0f }, c;
> B *p = baz (b);
> new (b.u.b) int (x);
> c = *p;
I don't think *p is of any type allowed to access the object of type int.
More information about the Gcc-bugs
mailing list