Bug 20532 - optimisations bug
optimisations bug
Status: CLOSED RAWHIDE
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc (Show other bugs)
1.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-11-08 13:48 EST by Chmouel Boudjnah
Modified: 2007-04-18 12:29 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-11-13 04:40:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Chmouel Boudjnah 2000-11-08 13:48:48 EST
The following is a very simplified pb that appeared in ruby.
Any attempt to simplify the example makes the bug disappear.

Minimal optimization for the bug to appear:
  -O2 -fomit-frame-pointer

The bug is "x" being put in the stack for "f" as the second argument, not
the
first one ("f" is a tail-call)



--------------------------------------------------------------------------------
void raise(long) __attribute__ ((noreturn));

long f(double);

long g(long i, double x)
{
  if (x < 0) raise(1);
  return f(x);
}
--------------------------------------------------------------------------------

The test prints "0" when it should print "2"
--------------------------------------------------------------------------------
void raise (long e) { exit(0); }

long f(double i) {
  printf("%g\n", i);
  return 0;
}

long g(long i, double x);

main() {
  g(0, 2.0);
}
Comment 1 Jakub Jelinek 2000-11-13 04:39:45 EST
Will be fixed in gcc-2.96-64, fix was already commited into CVS head.

Note You need to log in before you can comment on or make changes to this bug.