public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/41947]  New: GCC Hexadecimal Floating point constant handling
@ 2009-11-05  6:44 ameya dot malondkar at tcs dot com
  2009-11-05  6:48 ` [Bug c/41947] " ameya dot malondkar at tcs dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ameya dot malondkar at tcs dot com @ 2009-11-05  6:44 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug c/41947] GCC Hexadecimal Floating point constant handling
  2009-11-05  6:44 [Bug c/41947] New: GCC Hexadecimal Floating point constant handling ameya dot malondkar at tcs dot com
@ 2009-11-05  6:48 ` ameya dot malondkar at tcs dot com
  2009-11-05 15:15 ` [Bug preprocessor/41947] " jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ameya dot malondkar at tcs dot com @ 2009-11-05  6:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ameya dot malondkar at tcs dot com  2009-11-05 06:48 -------
Created an attachment (id=18971)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18971&action=view)
Preprocessed file for the reported bug.

This is the preprocessed file of the source file with the bug.
"GCC Hexadecimal Floating point constant handling"


-- 


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


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

* [Bug preprocessor/41947] GCC Hexadecimal Floating point constant handling
  2009-11-05  6:44 [Bug c/41947] New: GCC Hexadecimal Floating point constant handling ameya dot malondkar at tcs dot com
  2009-11-05  6:48 ` [Bug c/41947] " ameya dot malondkar at tcs dot com
@ 2009-11-05 15:15 ` jsm28 at gcc dot gnu dot org
  2010-01-01 18:08 ` jsm28 at gcc dot gnu dot org
  2010-01-01 18:10 ` jsm28 at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-11-05 15:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |16989
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
          Component|c                           |preprocessor
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-05 15:15:00
               date|                            |


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


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

* [Bug preprocessor/41947] GCC Hexadecimal Floating point constant handling
  2009-11-05  6:44 [Bug c/41947] New: GCC Hexadecimal Floating point constant handling ameya dot malondkar at tcs dot com
  2009-11-05  6:48 ` [Bug c/41947] " ameya dot malondkar at tcs dot com
  2009-11-05 15:15 ` [Bug preprocessor/41947] " jsm28 at gcc dot gnu dot org
@ 2010-01-01 18:08 ` jsm28 at gcc dot gnu dot org
  2010-01-01 18:10 ` jsm28 at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-01-01 18:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jsm28 at gcc dot gnu dot org  2010-01-01 18:08 -------
Subject: Bug 41947

Author: jsm28
Date: Fri Jan  1 18:08:17 2010
New Revision: 155558

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155558
Log:
libcpp:
        PR preprocessor/41947
        * expr.c (cpp_classify_number): Give error for hexadecimal
        floating-point constant with no digits before or after point.

gcc/testsuite:
        * gcc.dg/c99-hexfloat-3.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/c99-hexfloat-3.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/expr.c


-- 


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


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

* [Bug preprocessor/41947] GCC Hexadecimal Floating point constant handling
  2009-11-05  6:44 [Bug c/41947] New: GCC Hexadecimal Floating point constant handling ameya dot malondkar at tcs dot com
                   ` (2 preceding siblings ...)
  2010-01-01 18:08 ` jsm28 at gcc dot gnu dot org
@ 2010-01-01 18:10 ` jsm28 at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-01-01 18:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jsm28 at gcc dot gnu dot org  2010-01-01 18:10 -------
Fixed for 4.5.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.5.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2010-01-01 18:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-05  6:44 [Bug c/41947] New: GCC Hexadecimal Floating point constant handling ameya dot malondkar at tcs dot com
2009-11-05  6:48 ` [Bug c/41947] " ameya dot malondkar at tcs dot com
2009-11-05 15:15 ` [Bug preprocessor/41947] " jsm28 at gcc dot gnu dot org
2010-01-01 18:08 ` jsm28 at gcc dot gnu dot org
2010-01-01 18:10 ` jsm28 at gcc dot gnu dot 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).