public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35585]  New: Miscompiled inline assembly
@ 2008-03-14 16:25 nicos at maunakeatech dot com
  2008-03-14 16:27 ` [Bug c++/35585] " nicos at maunakeatech dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: nicos at maunakeatech dot com @ 2008-03-14 16:25 UTC (permalink / raw)
  To: gcc-bugs

The project I work on uses an inline assembly part to compute floor and ceil
functions of floating point numbers and its seems that in some cases, with
gcc-4.2 and optimizations turned on, the computed values are not correct. I
attached the smallest testcase that I could come up with to reproduce the error
and the preprocessed input. Changing the testcase a little suffices to make the
miscompilation disappear.
Since I am not an expert on inline assembly in gcc, I am not sure that the
iCeil/iFloor functions are completely correct and perhaps this is not a bug...

I was unable to reproduce the error with gcc-4.1 and gcc-4.3. The error is
still present with gcc-4.2.3. The error only appears with -O2/-O3.

Compilation command:
g++-4.2 -v -save-temps testcase.cpp -o testcase -O3
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.1 (Ubuntu 4.2.1-5ubuntu4)
 /usr/lib/gcc/i486-linux-gnu/4.2.1/cc1plus -E -quiet -v -D_GNU_SOURCE
testcase.cpp -mtune=generic -O3 -fpch-preprocess -o testcase.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.2
 /usr/include/c++/4.2/i486-linux-gnu
 /usr/include/c++/4.2/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.2.1/include
 /usr/include
End of search list.
 /usr/lib/gcc/i486-linux-gnu/4.2.1/cc1plus -fpreprocessed testcase.ii -quiet
-dumpbase testcase.cpp -mtune=generic -auxbase testcase -O3 -version
-fstack-protector -fstack-protector -o testcase.s
GNU C++ version 4.2.1 (Ubuntu 4.2.1-5ubuntu4) (i486-linux-gnu)
        compiled by GNU C version 4.2.1 (Ubuntu 4.2.1-5ubuntu4).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 44e55ae5d2724830dee11801424b84d8
 as --traditional-format -V -Qy -o testcase.o testcase.s
GNU assembler version 2.18 (i486-linux-gnu) using BFD version (GNU Binutils for
Ubuntu) 2.18
 /usr/lib/gcc/i486-linux-gnu/4.2.1/collect2 --eh-frame-hdr -m elf_i386
--hash-style=both -dynamic-linker /lib/ld-linux.so.2 -o testcase
/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crt1.o
/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crti.o
/usr/lib/gcc/i486-linux-gnu/4.2.1/crtbegin.o
-L/usr/lib/gcc/i486-linux-gnu/4.2.1 -L/usr/lib/gcc/i486-linux-gnu/4.2.1
-L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../.. testcase.o
-lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/i486-linux-gnu/4.2.1/crtend.o
/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crtn.o


-- 
           Summary: Miscompiled inline assembly
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nicos at maunakeatech dot com
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35585


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-03-31 15:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14 16:25 [Bug c++/35585] New: Miscompiled inline assembly nicos at maunakeatech dot com
2008-03-14 16:27 ` [Bug c++/35585] " nicos at maunakeatech dot com
2008-03-14 16:29 ` nicos at maunakeatech dot com
2008-03-14 17:31 ` rguenth at gcc dot gnu dot org
2008-03-15  1:08 ` nicos at maunakeatech dot com
2008-03-15 11:29 ` [Bug tree-optimization/35585] [4.2 Regression] " rguenth at gcc dot gnu dot org
2008-03-15 11:34 ` rguenth at gcc dot gnu dot org
2008-03-15 11:52 ` rguenth at gcc dot gnu dot org
2008-05-19 20:34 ` jsm28 at gcc dot gnu dot org
2009-03-31 15:26 ` jsm28 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).