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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> (In reply to Hongtao Liu from comment #6)
> > Looks correct in the gimple
> 
> The bug only happens at -O0. At higher levels it is ok.

For my reduced testcase we see this after complex lowering:
```
  _9 = REALPART_EXPR <FRAME.0.val>;
  _10 = IMAGPART_EXPR <FRAME.0.val>;
  _5 = COMPLEX_EXPR <_9, _10>;
  FRAME.0.FRAME_BASE.PARENT = _4;
  REALPART_EXPR <FRAME.0.val> = _9;
  IMAGPART_EXPR <FRAME.0.val> = _10;
  _1 = REALPART_EXPR <FRAME.0.val>;
```

It was originally:
```
  _5 = val;
  FRAME.0.FRAME_BASE.PARENT = _4;
  FRAME.0.val = _5;
  _1 = REALPART_EXPR <FRAME.0.val>;
```

Looks like val is being replaced with FRAME.0.val which is incorrect. Yes I
think there is a DECL_EXPR_DECL on val DECL. though it is NOT correct at this
point. I think the problem is more related to use of force_gimple_operand_gsi
here. Which is not needed for a simple DECL. extract_component can create the
gimple assignment itself.

This code dates long time ago which is why it is most likely using
force_gimple_operand_gsi  here.

Reply via email to