[Bug c/41947] New: GCC Hexadecimal Floating point constant handling
ameya dot malondkar at tcs dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 5 06:44:00 GMT 2009
GCC accepts constructs such as : float p = 0x.p5;
.As per C99 Standards the grammar for hexadecimal floating points is as follows
:
hexadecimal-floating-constant:
hexadecimal-prefix hexadecimal-fractional-constant
binary-exponent-part floating-suffix(opt)
hexadecimal-prefix hexadecimal-digit-sequence
binary-exponent-part floating-suffix(opt)
hexadecimal-prefix: one of
0x 0X
hexadecimal-fractional-constant:
hexadecimal-digit-sequence(opt) . hexadecimal-digit-sequence
hexadecimal-digit-sequence .
binary-exponent-part:
p sign(opt) digit-sequence
P sign(opt) digit-sequence
hexadecimal-digit-sequence:
hexadecimal-digit
hexadecimal-digit-sequence hexadecimal-digit
floating-suffix: one of
f l F L
As per the grammar to my understanding, the above construct is invalid.
Command : $ gcc -v -save-temps hexfloat.c
Output :
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
/usr/libexec/gcc/i386-redhat-linux/4.1.2/cc1 -E -quiet -v hexfloat.c
-mtune=generic -fpch-preprocess -o hexfloat.i
ignoring nonexistent directory
"/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i386-redhat-linux/4.1.2/include
/usr/include
End of search list.
/usr/libexec/gcc/i386-redhat-linux/4.1.2/cc1 -fpreprocessed hexfloat.i -quiet
-dumpbase hexfloat.c -mtune=generic -auxbase hexfloat -version -o hexfloat.s
GNU C version 4.1.2 20070626 (Red Hat 4.1.2-14) (i386-redhat-linux)
compiled by GNU C version 4.1.2 20070626 (Red Hat 4.1.2-14).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 6f8a93af44427a05901e7b3a98a7b357
as -V -Qy -o hexfloat.o hexfloat.s
GNU assembler version 2.17.50.0.6-5.el5 (i386-redhat-linux) using BFD version
2.17.50.0.6-5.el5 20061020
/usr/libexec/gcc/i386-redhat-linux/4.1.2/collect2 --eh-frame-hdr -m elf_i386
--hash-style=gnu -dynamic-linker /lib/ld-linux.so.2
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
/usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
-L/usr/lib/gcc/i386-redhat-linux/4.1.2 -L/usr/lib/gcc/i386-redhat-linux/4.1.2
-L/usr/lib/gcc/i386-redhat-linux/4.1.2/../../.. hexfloat.o -lgcc --as-needed
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
Preprocessed file : hexfloat.i
# 1 "hexfloat.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "hexfloat.c"
int main(void)
{
float p = 0x.p5;
return 0;
}
--
Summary: GCC Hexadecimal Floating point constant handling
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ameya dot malondkar at tcs dot com
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41947
More information about the Gcc-bugs
mailing list