Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 14989
Product:  
Component:  
Status: RESOLVED
Resolution: DUPLICATE of bug 323
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: xiaoyi_wu@yahoo.com
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 14989 depends on: Show dependency tree
Show dependency graph
Bug 14989 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2004-04-17 05:22
here is gcc -v:
Reading specs from /exp/opt/gcc3/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/exp/opt/gcc3
Thread model: posix
gcc version 3.3.3

here is the source code big.cc:
#include <cstdio>
int main() {
#ifdef SINGLE
  long long a = 8000000000000000000ll, b = a + 1;
#else
  long long p = 2000000ll, a = p * p * p, b = a + 1;
#endif
  double x = a, y = b;
#ifdef PRINT
  printf("%lld %lld\n", a, b);
#endif
  printf("%s %s\n", a == b ? "yes" : "no", x == y ? "yes" : "no");
}

note:
a and b are 8 byte long long differ by 1 with magnitude of 63 bits.  x and y are
8 byte double with only 53 bits resolution.  When x and y are assigned the value
of a and b, they should have same value, and the last line should print no yes.
 If I compile with (gcc -Wall -O big.cc), the program prints (unexpected) no no.
 If I compile with (gcc -Wall big.cc) or (gcc -Wall -O -DSINGLE big.cc) or (gcc
-Wall -O -DPRINT big.cc), I get the expected "no yes".  I am puzzled by the fact
that -DSINGLE or -DPRINT made a difference.

------- Comment #1 From xiaoyi_wu@yahoo.com 2004-04-17 05:27 -------
on solaris, it works as expected, everything prints no yes.
here is gcc -v:
Reading specs from
/net/mars/exp/opt/gcc/lib/gcc-lib/sparc-sun-solaris2.8/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/net/mars/exp/opt/gcc
Thread model: posix
gcc version 3.3.3

------- Comment #2 From Andrew Pinski 2004-04-17 05:29 -------
This is a dup of bug 323, read that bug and see why it is considered a non-bug.

*** This bug has been marked as a duplicate of 323 ***

*** This bug has been marked as a duplicate of 323 ***

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug