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

--- Comment #1 from Andrew Macleod <amacleod at redhat dot com> ---
This is all very strange.  So its a runtime error on those targets?

The code we produce is slightly different, it happens to expose certain
limitations with picking up ranges via dominators when there are multiple paths
from the dominator, all of which happen to carry range information.  But it
shouldn't be a correctness thing

And we end up not inlining and doing different things in ifcombine for some
reason... but I cannot find any place where a transformation is incorrect.

If I follow the IL thru from the .optimized listing:    

_1 = foo_mult (10, -2);

and tracing thru with   i = 10,  j = -2

int foo_mult (int i, int j)
{
  int k;
  int _1;
  unsigned int _31;
  unsigned int _35;

  <bb 2> [local count: 1073741821]:
  if (i_5(D) >= -20)
    goto <bb 3>; [100.00%]          2->3          

  <bb 3> [local count: 1073741821]:
  if (i_5(D) < -9)
    goto <bb 4>; [50.00%]
  else
    goto <bb 9>; [50.00%]             3->9

<bb 9> [local count: 330972458]:
  if (i_5(D) <= 10)
    goto <bb 10>; [50.00%]            9->10
  else
    goto <bb 12>; [50.00%]

  <bb 10> [local count: 76561739]:
  if (j_6(D) > 1)
    goto <bb 11>; [84.14%]
  else
    goto <bb 14>; [15.86%]           10->14

  <bb 14> [local count: 160296875]:
  _31 = (unsigned int) j_6(D);          _31 = unsigned (-2)
  _35 = _31 + 10;                        _35 = -2 + 10 == 8
  if (_35 <= 8)
    goto <bb 8>; [79.40%]           14->8

  <bb 8> [local count: 414017807]:
  k_7 = i_5(D) * j_6(D);             k_7 = 10 * -2
  goto <bb 19>; [100.00%]           8->19

 <bb 19> [local count: 1073741824]:
  # _1 = PHI <k_7(8), k_14(17)>
  return _1;


_1 should be returning k_7 which should be -20

It seems fine at the .optimized listing?

Reply via email to