https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71514

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |middle-end

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the atomics code really produces

main ()
{
  void <T16f> () foo.0_1;
  unsigned char _2;
  int _3;
  unsigned char _4;
  char _5;

  <bb 2>:
  foo.0_1 = foo;
  _2 = VIEW_CONVERT_EXPR<unsigned char>(foo.0_1);
  _3 = (int) _2;
  _4 = __atomic_exchange_1 (&a, _3, 0);
  _5 = (char) _4;
  b = _5;
  return 0;

}

which loads a function (to a temporary of function type which is even an SSA
name...)

The lowering is bogus in creating

    foo.0_1 = foo;
    _2 = VIEW_CONVERT_EXPR<unsigned char>(foo.0_1);
    _3 = (int) _2;
    _4 = __atomic_exchange_1 (&a, _3, 0);

iff then it should have created

    _2 = MEM_REF[&foo];

and load a unsigned char from foo.  IMHO a gimplifier or FE issue.

Reply via email to