public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39035]  New: if( 0.0DF ) is considered true
@ 2009-01-30  1:29 tydeman at tybor dot com
  2009-01-30  7:17 ` [Bug c/39035] " rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tydeman at tybor dot com @ 2009-01-30  1:29 UTC (permalink / raw)
  To: gcc-bugs

Using gcc 4.3.2-7 on Intel Pentium 4 running Fedora Core 10 and -std=gnu99 of

/* DFP TR 24732 == WG14 / N1176, N1312 */
#define __STDC_WANT_DEC_FP__ /* Tell implementation that we want Decimal FP */
#include <stdio.h>      /* printf() */

int main(void){
  if( 0.0DF ){
    printf("0.0DF should be zero\n");
  }
  return 0;
}

gets:

0.0DF should be zero


-- 
           Summary: if( 0.0DF ) is considered true
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tydeman at tybor dot com
  GCC host triplet: 4.3.2
GCC target triplet: 4.3.2


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


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

* [Bug c/39035] if( 0.0DF ) is considered true
  2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
@ 2009-01-30  7:17 ` rguenth at gcc dot gnu dot org
  2009-01-30 17:34 ` tydeman at tybor dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-30  7:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-01-30 07:17 -------
isn't this a dup of the previous bug?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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


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

* [Bug c/39035] if( 0.0DF ) is considered true
  2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
  2009-01-30  7:17 ` [Bug c/39035] " rguenth at gcc dot gnu dot org
@ 2009-01-30 17:34 ` tydeman at tybor dot com
  2009-01-30 20:47 ` janis at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tydeman at tybor dot com @ 2009-01-30 17:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tydeman at tybor dot com  2009-01-30 17:34 -------
This is NOT a dup of 39034.  In this one, the value of the expression is zero.
In 39034, the value of d10 is not zero (but should be).


-- 


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


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

* [Bug c/39035] if( 0.0DF ) is considered true
  2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
  2009-01-30  7:17 ` [Bug c/39035] " rguenth at gcc dot gnu dot org
  2009-01-30 17:34 ` tydeman at tybor dot com
@ 2009-01-30 20:47 ` janis at gcc dot gnu dot org
  2009-01-30 20:48 ` janis at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-01-30 20:47 UTC (permalink / raw)
  To: gcc-bugs



-- 

janis at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com, bje at gcc dot gnu dot
                   |                            |org
         AssignedTo|unassigned at gcc dot gnu   |janis at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-30 20:46:53
               date|                            |


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


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

* [Bug c/39035] if( 0.0DF ) is considered true
  2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
                   ` (2 preceding siblings ...)
  2009-01-30 20:47 ` janis at gcc dot gnu dot org
@ 2009-01-30 20:48 ` janis at gcc dot gnu dot org
  2009-02-06 21:02 ` janis at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-01-30 20:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janis at gcc dot gnu dot org  2009-01-30 20:48 -------
Created an attachment (id=17215)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17215&action=view)
expanded testcase

I expanded the testcase to test both constant folding and runtime calculations
for all three decimal float types.

The problem occurs with 4.3.3 and mainline.

Test results for trunk and 4.3 for powerpc64-linux and x86-linux (bid and dpd):

elm3b187% uname -m
ppc64
elm3b187% /opt/gcc-nightly/trunk/bin/gcc -DDBG -O2 -std=gnu99 39035.c &&
./a.out 
line 49: 0.0DF should be zero
line 56: 0.0DD should be zero
line 63: 0.0DL should be zero
Aborted
elm3b187% /opt/gcc-nightly/4.3/bin/gcc -DDBG -O2 -std=gnu99 39035.c && ./a.out
line 49: 0.0DF should be zero
line 56: 0.0DD should be zero
line 63: 0.0DL should be zero
Aborted

laptop% uname -m
i686
laptop% /home/janis/tools/gcc-trunk-bid/bin/gcc -DDBG -O2 -std=gnu99 39035.c &&
./a.out
line 49: 0.0DF should be zero
line 56: 0.0DD should be zero
line 63: 0.0DL should be zero
Aborted (core dumped)
laptop% /home/janis/tools/gcc-trunk-dpd/bin/gcc -DDBG -O2 -std=gnu99 39035.c &&
./a.out
line 49: 0.0DF should be zero
line 56: 0.0DD should be zero
line 63: 0.0DL should be zero
Aborted (core dumped)
laptop% /home/janis/tools/gcc-4.3.3-bid/bin/gcc -DDBG -O2 -std=gnu99 39035.c &&
./a.out
line 49: 0.0DF should be zero
line 56: 0.0DD should be zero
line 63: 0.0DL should be zero
Aborted (core dumped)
laptop% /home/janis/tools/gcc-4.3.3-dpd/bin/gcc -DDBG -O2 -std=gnu99 39035.c &&
./a.out
line 49: 0.0DF should be zero
line 56: 0.0DD should be zero
line 63: 0.0DL should be zero
Aborted (core dumped)


-- 


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


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

* [Bug c/39035] if( 0.0DF ) is considered true
  2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
                   ` (3 preceding siblings ...)
  2009-01-30 20:48 ` janis at gcc dot gnu dot org
@ 2009-02-06 21:02 ` janis at gcc dot gnu dot org
  2009-02-09 18:51 ` janis at gcc dot gnu dot org
  2009-02-09 18:59 ` janis at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-02-06 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from janis at gcc dot gnu dot org  2009-02-06 21:01 -------
Subject: Bug 39035

Author: janis
Date: Fri Feb  6 21:01:46 2009
New Revision: 143992

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143992
Log:
        PR c/39035
        * real.c (do_compare): Special-case compare of zero against
        decimal float value.

        * gcc.dg/dfp/pr39035.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/dfp/pr39035.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/real.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39035] if( 0.0DF ) is considered true
  2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
                   ` (4 preceding siblings ...)
  2009-02-06 21:02 ` janis at gcc dot gnu dot org
@ 2009-02-09 18:51 ` janis at gcc dot gnu dot org
  2009-02-09 18:59 ` janis at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-02-09 18:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janis at gcc dot gnu dot org  2009-02-09 18:51 -------
Subject: Bug 39035

Author: janis
Date: Mon Feb  9 18:51:31 2009
New Revision: 144039

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144039
Log:
        PR c/39035
        * real.c (do_compare): Special-case compare of zero against
        decimal float value.

        * gcc.dg/dfp/pr39035.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/dfp/pr39035.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/real.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39035] if( 0.0DF ) is considered true
  2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
                   ` (5 preceding siblings ...)
  2009-02-09 18:51 ` janis at gcc dot gnu dot org
@ 2009-02-09 18:59 ` janis at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-02-09 18:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janis at gcc dot gnu dot org  2009-02-09 18:59 -------
Fixed in mainline and 4.3 branch.


-- 

janis at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   GCC host triplet|4.3.2                       |
 GCC target triplet|4.3.2                       |
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.4


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


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

end of thread, other threads:[~2009-02-09 18:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-30  1:29 [Bug c/39035] New: if( 0.0DF ) is considered true tydeman at tybor dot com
2009-01-30  7:17 ` [Bug c/39035] " rguenth at gcc dot gnu dot org
2009-01-30 17:34 ` tydeman at tybor dot com
2009-01-30 20:47 ` janis at gcc dot gnu dot org
2009-01-30 20:48 ` janis at gcc dot gnu dot org
2009-02-06 21:02 ` janis at gcc dot gnu dot org
2009-02-09 18:51 ` janis at gcc dot gnu dot org
2009-02-09 18:59 ` janis 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).