public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20688] New: [x86-64] gcc miscompiles composition of sqrt() with inlined function
@ 2005-03-29 21:29 cvogler2001 at yahoo dot com
2005-03-29 21:30 ` [Bug c/20688] " cvogler2001 at yahoo dot com
2005-03-29 21:36 ` [Bug tree-optimization/20688] [3.4 Regression] " pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: cvogler2001 at yahoo dot com @ 2005-03-29 21:29 UTC (permalink / raw)
To: gcc-bugs
GCC info: gcc -v
Reading specs from
/home/cvogler/addons/gcc-test/lib/gcc/x86_64-unknown-linux-gnu/3.4.3/specs
Configured with: ../gcc-3.4.3/configure --prefix=/home/cvogler/addons/gcc-test
--disable-multilib
Thread model: posix
gcc version 3.4.3
The following test snippet shows a very reduced case of Cholesky factorization
code, which uses inline functions for array indexing. It is miscompiled with
these compiler flags on the x86_64 target:
gcc -Wall -O -finline-functions -o test test.c -lm
--- test.c ---
#include <math.h>
double getval()
{
return -1.0;
}
int main(void)
{
double y = sqrt(getval());
}
---
The result is in infinite loop, instead of the expected "nan." This generated
assembler snippet, in particular, looks incorrect:
---
.L3:
sqrtsd %xmm0, %xmm0
ucomisd %xmm0, %xmm0
jp .L6
je .L4
.L6:
movlpd .LC3(%rip), %xmm0
jmp .L3
.L4:
rep ; ret
---
In this snippet .L6 should contain a call to the sqrt function, but instead it
jumps back to .L3, causing an infinite loop. Suppressing inlining of functions
makes gcc generate correct code. Also, I could not reproduce the problem on a
32-bit x86 target.
--
Summary: [x86-64] gcc miscompiles composition of sqrt() with
inlined function
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cvogler2001 at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20688
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/20688] [x86-64] gcc miscompiles composition of sqrt() with inlined function
2005-03-29 21:29 [Bug c/20688] New: [x86-64] gcc miscompiles composition of sqrt() with inlined function cvogler2001 at yahoo dot com
@ 2005-03-29 21:30 ` cvogler2001 at yahoo dot com
2005-03-29 21:36 ` [Bug tree-optimization/20688] [3.4 Regression] " pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: cvogler2001 at yahoo dot com @ 2005-03-29 21:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvogler2001 at yahoo dot com 2005-03-29 21:29 -------
Created an attachment (id=8491)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8491&action=view)
Preprocessed test snippet for reproducing the bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20688
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/20688] [3.4 Regression] gcc miscompiles composition of sqrt() with inlined function
2005-03-29 21:29 [Bug c/20688] New: [x86-64] gcc miscompiles composition of sqrt() with inlined function cvogler2001 at yahoo dot com
2005-03-29 21:30 ` [Bug c/20688] " cvogler2001 at yahoo dot com
@ 2005-03-29 21:36 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-29 21:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-29 21:36 -------
Fixed already in 3.4.4.
This might be a dup of another bug somewhere too.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c |tree-optimization
Keywords| |wrong-code
Resolution| |FIXED
Summary|[x86-64] gcc miscompiles |[3.4 Regression] gcc
|composition of sqrt() with |miscompiles composition of
|inlined function |sqrt() with inlined function
Target Milestone|--- |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20688
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-03-29 21:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-29 21:29 [Bug c/20688] New: [x86-64] gcc miscompiles composition of sqrt() with inlined function cvogler2001 at yahoo dot com
2005-03-29 21:30 ` [Bug c/20688] " cvogler2001 at yahoo dot com
2005-03-29 21:36 ` [Bug tree-optimization/20688] [3.4 Regression] " pinskia at gcc dot gnu dot org
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).