Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 20532

Summary: optimisations bug
Product: [Retired] Red Hat Raw Hide Reporter: Chmouel Boudjnah <cboudjnah>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-11-13 09:40:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chmouel Boudjnah 2000-11-08 18:48:48 UTC
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 09:39:45 UTC
Will be fixed in gcc-2.96-64, fix was already commited into CVS head.