https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87128

            Bug ID: 87128
           Summary: Wrong Value Generated for m32 without optimization
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neha.gnu.gcc at gmail dot com
  Target Milestone: ---

Created attachment 44615
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44615&action=edit
Testcase to generate the issue

When the attached file is compiled for -m32 without any optimization,
it generates wrong result.
$gcc test.c -m32
$ ./a.out
result = -8388608.000000    -> Wrong result

$gcc test.c -m32 -O1
$ ./a.out
result = 0.000000           -> Correct result

Additional Info

Checked with many native GCC from GCC-4.1.0 to current upstream sources.

The result in only wrong when the values of exponents add to zero.
And the value of a is equal or greater than 1.0e23
Example1 a = 1.0e23 b = 1.0e15 c = 1.0e8
Example2 a = 1.0e28 b = 1.0e15 c = 1.0e13

The issue is not observed in the following scenarios
1. Any optimization is enabled.
2. m64 
3. Precision value set to mpc64

Are the values greater than 1.0e23 not handled by 32 properly?
Is anything obvious being missed in the testcase?

Reply via email to