public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39902]  New: x * 1.0DF gets wrong value
@ 2009-04-25 22:32 tydeman at tybor dot com
  2009-06-26 18:28 ` [Bug c/39902] " janis at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: tydeman at tybor dot com @ 2009-04-25 22:32 UTC (permalink / raw)
  To: gcc-bugs

Multiplication by a decimal floating-point (DFP) value of one appears to be
"optimized" away, thereby producing the wrong value.  In DFP, the value one has
many representations.  Only one of them (1.DF) results in no change to values
for multiplication; the others change the quantum exponent.

/* DFP TR 24732 == WG14 / N1312 */
#define __STDC_WANT_DEC_FP__ /* Tell implementation that we want Decimal FP */

#include <stdio.h>      /* printf() */
#include <string.h>     /* memcmp() */

int main(void){
  _Decimal32 f1 = 1.0DF;
  _Decimal32 f2 = 2.0DF;
  _Decimal32 f3;

  f3 = f2 * f1;         /* should change quantum exponent */
  if( 0 == memcmp( &f3, &f2, sizeof(f3) ) ){
    (void)printf("Fail 1\n");
  }

  f3 = f2 * 1.0DF;      /* should change quantum exponent */
  if( 0 == memcmp( &f3, &f2, sizeof(f3) ) ){
    (void)printf("Fail 2\n");
  }
  return 0;
}

gets: Fail 2


-- 
           Summary: x * 1.0DF gets wrong value
           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 build triplet: 4.3.2


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
@ 2009-06-26 18:28 ` janis at gcc dot gnu dot org
  2009-06-29 17:13 ` janis at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-06-26 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janis at gcc dot gnu dot org  2009-06-26 18:27 -------
Subject: Bug 39902

Author: janis
Date: Fri Jun 26 18:27:30 2009
New Revision: 148982

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148982
Log:
        PR c/39902
        * tree.c (real_zerop, real_onep, real_twop, real_minus_onep):
        Special-case decimal float constants.

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

Added:
    trunk/gcc/testsuite/gcc.dg/dfp/pr39902.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree.c


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
  2009-06-26 18:28 ` [Bug c/39902] " janis at gcc dot gnu dot org
@ 2009-06-29 17:13 ` janis at gcc dot gnu dot org
  2009-07-30 17:05 ` janis at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-06-29 17:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janis at gcc dot gnu dot org  2009-06-29 17:13 -------
Subject: Bug 39902

Author: janis
Date: Mon Jun 29 17:13:33 2009
New Revision: 149058

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149058
Log:
        PR c/39902
        * tree.c (real_zerop, real_onep, real_twop, real_minus_onep):
        Special-case decimal float constants.

        PR c/39902
        * gcc.dg/dfp/pr39902.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/dfp/pr39902.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/tree.c


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
  2009-06-26 18:28 ` [Bug c/39902] " janis at gcc dot gnu dot org
  2009-06-29 17:13 ` janis at gcc dot gnu dot org
@ 2009-07-30 17:05 ` janis at gcc dot gnu dot org
  2009-07-30 17:08 ` janis at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-07-30 17:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janis at gcc dot gnu dot org  2009-07-30 17:05 -------
Subject: Bug 39902

Author: janis
Date: Thu Jul 30 17:04:56 2009
New Revision: 150265

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150265
Log:
        PR c/39902
        * gcc.dg/dfp/pr39902.c: Fix typos in constant suffixes.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/dfp/pr39902.c


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
                   ` (2 preceding siblings ...)
  2009-07-30 17:05 ` janis at gcc dot gnu dot org
@ 2009-07-30 17:08 ` janis at gcc dot gnu dot org
  2009-08-03 21:39 ` janis at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-07-30 17:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from janis at gcc dot gnu dot org  2009-07-30 17:08 -------
Subject: Bug 39902

Author: janis
Date: Thu Jul 30 17:08:09 2009
New Revision: 150266

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150266
Log:
        PR c/39902
        * gcc.dg/dfp/pr39902.c: Fix typos in constant suffixes.

Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/dfp/pr39902.c


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
                   ` (3 preceding siblings ...)
  2009-07-30 17:08 ` janis at gcc dot gnu dot org
@ 2009-08-03 21:39 ` janis at gcc dot gnu dot org
  2009-08-03 21:44 ` janis at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-08-03 21:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janis at gcc dot gnu dot org  2009-08-03 21:39 -------
Subject: Bug 39902

Author: janis
Date: Mon Aug  3 21:38:53 2009
New Revision: 150383

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150383
Log:
        PR c/39902
        * simplify-rtx.c (simplify_binary_operation_1): Disable
        simplifications for decimal float operations.

        PR c/39902
        * gcc.target/powerpc/pr39902-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
                   ` (4 preceding siblings ...)
  2009-08-03 21:39 ` janis at gcc dot gnu dot org
@ 2009-08-03 21:44 ` janis at gcc dot gnu dot org
  2009-08-03 21:48 ` janis at gcc dot gnu dot org
  2009-08-03 21:49 ` janis at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-08-03 21:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janis at gcc dot gnu dot org  2009-08-03 21:43 -------
Subject: Bug 39902

Author: janis
Date: Mon Aug  3 21:43:32 2009
New Revision: 150384

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150384
Log:
        PR c/39902
        * simplify-rtx.c (simplify_binary_operation_1): Disable
        simplifications for decimal float operations.
        * gcc.target/powerpc/pr39902-2.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/simplify-rtx.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
                   ` (5 preceding siblings ...)
  2009-08-03 21:44 ` janis at gcc dot gnu dot org
@ 2009-08-03 21:48 ` janis at gcc dot gnu dot org
  2009-08-03 21:49 ` janis at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-08-03 21:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from janis at gcc dot gnu dot org  2009-08-03 21:47 -------
Subject: Bug 39902

Author: janis
Date: Mon Aug  3 21:47:39 2009
New Revision: 150385

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150385
Log:
        PR c/39902
        * tree.c (real_zerop, real_onep, real_twop, real_minus_onep):
        Special-case decimal float constants.
        * gcc.dg/dfp/pr39902.c: New test.

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


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
  2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
                   ` (6 preceding siblings ...)
  2009-08-03 21:48 ` janis at gcc dot gnu dot org
@ 2009-08-03 21:49 ` janis at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-08-03 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from janis at gcc dot gnu dot org  2009-08-03 21:49 -------
Subject: Bug 39902

Author: janis
Date: Mon Aug  3 21:49:12 2009
New Revision: 150386

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150386
Log:
        PR c/39902
        * simplify-rtx.c (simplify_binary_operation_1): Disable
        simplifications for decimal float operations.
        * gcc.target/powerpc/pr39902-2.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/simplify-rtx.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39902] x * 1.0DF gets wrong value
       [not found] <bug-39902-4@http.gcc.gnu.org/bugzilla/>
@ 2014-05-06 19:05 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-06 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |mpolacek at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Seems to be fixed.


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

end of thread, other threads:[~2014-05-06 19:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-25 22:32 [Bug c/39902] New: x * 1.0DF gets wrong value tydeman at tybor dot com
2009-06-26 18:28 ` [Bug c/39902] " janis at gcc dot gnu dot org
2009-06-29 17:13 ` janis at gcc dot gnu dot org
2009-07-30 17:05 ` janis at gcc dot gnu dot org
2009-07-30 17:08 ` janis at gcc dot gnu dot org
2009-08-03 21:39 ` janis at gcc dot gnu dot org
2009-08-03 21:44 ` janis at gcc dot gnu dot org
2009-08-03 21:48 ` janis at gcc dot gnu dot org
2009-08-03 21:49 ` janis at gcc dot gnu dot org
     [not found] <bug-39902-4@http.gcc.gnu.org/bugzilla/>
2014-05-06 19:05 ` mpolacek at gcc dot gnu.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).