public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37544]  New: Conversion double -> unsigned long long -> unsigned -> double gives wrong results
@ 2008-09-16 16:41 jdemeyer at cage dot ugent dot be
  2008-09-16 16:42 ` [Bug c/37544] " jdemeyer at cage dot ugent dot be
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: jdemeyer at cage dot ugent dot be @ 2008-09-16 16:41 UTC (permalink / raw)
  To: gcc-bugs

Consider the following line of the attached test case, where a is double with
value 4294967296.0.

double b = (unsigned int)((unsigned long long int)a % 4294967296ULL);

Then (unsigned long long int)a % 4294967296ULL should be equal to 0ULL, and
therefore b should be 0.0.  However, when compiled with -O1 -march=pentium4, b
gets the wrong value of 4294967296.0 (the same as a).  Note that the error only
occurs with -march=pentium4.

To compile the testcase:
gcc -std=c99 -O1 -march=pentium4 convert-bug.i -o convert-bug

gcc -v:
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --enable-checking=release
--prefix=/home/jdemeyer/local CC=gcc-4.1.2
Thread model: posix
gcc version 4.4.0 20080916 (experimental) (GCC)


-- 
           Summary: Conversion double -> unsigned long long -> unsigned ->
                    double gives wrong results
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jdemeyer at cage dot ugent dot be
 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=37544


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

end of thread, other threads:[~2009-04-29 15:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-16 16:41 [Bug c/37544] New: Conversion double -> unsigned long long -> unsigned -> double gives wrong results jdemeyer at cage dot ugent dot be
2008-09-16 16:42 ` [Bug c/37544] " jdemeyer at cage dot ugent dot be
2008-09-16 16:54 ` [Bug target/37544] " pinskia at gcc dot gnu dot org
2008-09-16 18:40 ` [Bug c/37544] " jdemeyer at cage dot ugent dot be
2008-09-16 18:46 ` pinskia at gcc dot gnu dot org
2008-09-16 19:18 ` [Bug target/37544] " rguenth at gcc dot gnu dot org
2008-09-17  8:16 ` [Bug rtl-optimization/37544] [4.2/4.3/4.4 Regression] " ubizjak at gmail dot com
2008-09-17  8:36 ` ubizjak at gmail dot com
2008-09-17 10:40 ` ubizjak at gmail dot com
2008-09-17 11:50 ` [Bug rtl-optimization/37544] [4.4 " ubizjak at gmail dot com
2008-09-17 12:02 ` ubizjak at gmail dot com
2008-09-17 16:14 ` ubizjak at gmail dot com
2008-09-18 10:20 ` uros at gcc dot gnu dot org
2008-09-18 14:32 ` [Bug rtl-optimization/37544] " ubizjak at gmail dot com
2008-09-19  8:03 ` uros at gcc dot gnu dot org
2008-09-19 10:07 ` uros at gcc dot gnu dot org
2008-09-19 11:13 ` [Bug rtl-optimization/37544] [4.4 Regression] " ubizjak at gmail dot com
2009-04-29 15:18 ` 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).