public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15135] New: program hangs in call to sqrt when compiled with -O
@ 2004-04-25 17:16 dfg at decode dot is
2004-04-25 19:57 ` [Bug optimization/15135] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dfg at decode dot is @ 2004-04-25 17:16 UTC (permalink / raw)
To: gcc-bugs
The program below compiles and runs when compiled without any compiler options,
but hangs in the call to sqrt when compiled with -O. All simple changes I made
to it make it run through.
The system I'm working on is a dual processor IBM blade with 2Gb of memory,
running RedHat enterprise. Please contact me if you need further specs. I
compiled using version 3.2.3 20030502 of gcc, 3.4.0 myself with no special
configuration options:
> gcc-3.4.0 -v
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ./configure --program-suffix=-3.4.0
Thread model: posix
gcc version 3.4.0
Again "g++-3.4.0 -O test.cc; ./a.out" hangs indefinately, while "g++-3.4.0
test.cc; ./a.out" exits.
I changed inclusion of math.h to explicit def of NAN and direct call to
__builtin_sqrt so that temp files would be smaller.
Daniel
test.cc:
# define NAN \
(__extension__ \
((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
{ __l: 0x7fc00000UL }).__d)
inline double fmax(double a, double b) {
if (a < b) return b;
else return a;
}
double f() {
return __builtin_sqrt(NAN/fmax(1., 1./.0));
}
int main() {
double u = f();
return 0;
}
test.ii:
# 1 "test.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cc"
inline double fmax(double a, double b) {
if (a < b) return b;
else return a;
}
double f() {
return __builtin_sqrt((__extension__ ((union { unsigned __l
__attribute__((__mode__(__SI__))); float __d; }) { __l: 0x7fc00000UL
}).__d)/fmax(1., 1./.0));
}
int main() {
double u = f();
return 0;
}
test.s:
.file "test.cc"
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC3:
.long 0
.long 0
.text
.align 2
.globl _Z1fv
.type _Z1fv, @function
_Z1fv:
.LFB3:
pushl %ebp
.LCFI0:
movl %esp, %ebp
.LCFI1:
subl $4, %esp
.LCFI2:
movl $2143289344, %eax
movl %eax, -4(%ebp)
flds -4(%ebp)
fld1
fld %st(0)
fdivl .LC3
fucom %st(1)
fnstsw %ax
sahf
ja .L16
fstp %st(0)
jmp .L15
.L16:
fstp %st(1)
jmp .L15
.L18:
fstp %st(1)
.L15:
fdivr %st(1), %st
fsqrt
fucom %st(0)
fnstsw %ax
sahf
jp .L17
je .L6
fstp %st(0)
jmp .L14
.L17:
fstp %st(0)
.L14:
fld1
fld %st(0)
fdivl .LC3
fucom %st(1)
fnstsw %ax
sahf
ja .L18
fstp %st(0)
jmp .L15
.L6:
fstp %st(1)
leave
ret
.LFE3:
.size _Z1fv, .-_Z1fv
.align 2
.globl main
.type main, @function
main:
.LFB4:
pushl %ebp
.LCFI3:
movl %esp, %ebp
.LCFI4:
subl $8, %esp
.LCFI5:
andl $-16, %esp
subl $16, %esp
call _Z1fv
fstp %st(0)
movl $0, %eax
leave
ret
.LFE4:
.size main, .-main
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.4.0"
--
Summary: program hangs in call to sqrt when compiled with -O
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dfg at decode dot is
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15135
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-12-08 19:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-25 17:16 [Bug optimization/15135] New: program hangs in call to sqrt when compiled with -O dfg at decode dot is
2004-04-25 19:57 ` [Bug optimization/15135] " pinskia at gcc dot gnu dot org
2004-07-25 7:20 ` [Bug rtl-optimization/15135] " pinskia at gcc dot gnu dot org
2004-12-08 19:39 ` gccbug at gammarayburst dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).