http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56379
Bug #: 56379
Summary: libquadmath: Wrong result for strtoflt128.c if
compiled with -O0
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libquadmath
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
As reported by Tilo Schwarz at
http://gcc.gnu.org/ml/fortran/2013-02/msg00091.html
When libquadmath's strtod/strtoflt128.c is compiled with -O1 or -O2, it gives
the correct result. However, for -O0 it doesn't. Hence, gfortran.dg/quad_2.f90
fails.
Mathematically,
sqrt(2.0) ==
1.414213562373095048801688724209698078569671875376948073176679737990…
The string str3 is (== fp2 and == fp4 with -O1/-O2):
str3 is "1.41421356237309504880168872420969798"
If libquadmath/strtod/strtoflt128.c is compiled with -O0, reading the string to
fp4 and printing its value yields:
fp4: "1.41421356237309504885589883283397321"
fp2-fp4: -0.00000000000000000005421010862427522
Might (or might not) be related to PR48111 (strtoflt128 on MinGW).