meyering@CS.UTEXAS.EDU (Jim Meyering) (05/24/89)
/*
* gcc-1.35/sun4-os4 "-O/const" bug: cc1 exhausts virtual memory.
*
* Simplifying the code in foo(), removing the `const' attribute
* from the declaration of epslon(), or compiling without -O
* allow compilation to terminate normally.
*
* > % gcc -v -O -c bug.c -o bug.o
* > gcc version 1.35
* > /p/lib/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__OPTIMIZE__ bug.c /tmp/cca16852.cpp
* > GNU CPP version 1.35
* > /p/lib/gcc-cc1 /tmp/cca16852.cpp -quiet -dumpbase bug.c -O -version -o /tmp/cca16852.s
* > GNU C version 1.35 (sparc) compiled by GNU C version 1.35.
* > bug.c: In function foo:
* > bug.c:31: Virtual memory exhausted.
* > 59.9u 30.9s 2:10 69% 0+20936k 8+14io 47pf+0w
* > %
*/
const double epslon(double x) { return(1.0); }
void
foo()
{
double x;
while (1) {
if ( x > epslon(1.0) || x < epslon(1.0)) {
x = 1.0;
}
}
}
---
Jim Meyering meyering@cs.utexas.edu