Bug 20532 - optimisations bug
Summary: optimisations bug
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 1.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
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:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-11-13 09:40:12 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2000:132 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
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.