[Bug c/84717] New: C compiler accepts fortran style suffix "d" with float number but result is strange
stiefschmied at alice dot de
gcc-bugzilla@gcc.gnu.org
Mon Mar 5 15:05:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84717
Bug ID: 84717
Summary: C compiler accepts fortran style suffix "d" with float
number but result is strange
Product: gcc
Version: 6.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: stiefschmied at alice dot de
Target Milestone: ---
Target: x86_64-apple-darwin (and others?)
Created attachment 43564
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43564&action=edit
example c code which compiles with gcc 6.4.0 but should give an error.
When porting code from Fortran, a floating point number was accidentially
written like this:
static double aem = 7.29735d-3;
gcc version 6.4.0 accepts the code, but assigns an unexpected result:
static double aem = 7.29735-3;
Other compilers (tested with: clang 9.0.0 or gcc version 4.4.7) report an error
during compilation:
error: invalid suffix "d" on floating constant
I think this is a compiler bug? The example code is attached.
More information about the Gcc-bugs
mailing list