This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/81028] GCC miscompiles placement new


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;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]