pro64-support
[Top] [All Lists]

min bug

To: pro64-support@xxxxxxxxxxx
Subject: min bug
From: John Hsu <jonhsu@xxxxxxxxxxxxx>
Date: Wed, 28 Feb 2001 15:00:55 -0800
Sender: owner-pro64-support@xxxxxxxxxxx
I'm having problems with a test case that's been simplified from code
that uses the min() template function in the algorithm header:

> sgiCC -O2 min.cpp
> a.out
456048     <-- should be 4

We suspect that the front end is generating incorrect code, which causes
the optimizer to delete stores that it thinks are unnecessary because
they only affect local variables.

#include <iostream>

const int& min(const int& __a, const int& __b) {
  return __b < __a ? __b : __a;
}

int j=4, k=7;
void main()
{
        int i = min(j,k);
        cout << i << endl;
}
<Prev in Thread] Current Thread [Next in Thread>
  • min bug, John Hsu <=