Bug 20532 - optimisations bug
Summary: optimisations bug
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-11-08 18:48 UTC by Chmouel Boudjnah
Modified: 2007-04-18 16:29 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2000-11-13 09:40:12 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2000:132 0 normal SHIPPED_LIVE Bug fixing update of GCC 2.96 2000-12-19 05:00:00 UTC

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.


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