This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/1228] New: _GNU_SOURCE does not bring in C99 numeric limits


AFAIK, the following issue, although possibly known, has not been reported before. 

The following program:

$ cat t.c
#include <limits.h>

long long foo = LLONG_MAX;

compiles fine with:

$ gcc -std=c99 -c t.c

but fails to compile with:

$ gcc -D_GNU_SOURCE -c -v t.c
Reading specs from
/amd/packages/mdx/redhat/compilers/gcc-3.4.3-9.EL4/bin/../lib/gcc/i386-redhat-linux/3.4.3/specs
Configured with: ../configure
--prefix=/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4/
--mandir=/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4//man
--infodir=/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4//info --enable-shared
--enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++,objc,java,f77 --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
 /amd/packages/mdx/redhat/compilers/gcc-3.4.3-9.EL4/bin/../libexec/gcc/i386-redhat-linux/3.4.3/cc1
-quiet -v -iprefix
/amd/packages/mdx/redhat/compilers/gcc-3.4.3-9.EL4/bin/../lib/gcc/i386-redhat-linux/3.4.3/
-D_GNU_SOURCE t.c -quiet -dumpbase t.c -auxbase t -version -o /tmp/cc2LZ5JU.s
ignoring nonexistent directory
"/amd/packages/mdx/redhat/compilers/gcc-3.4.3-9.EL4/bin/../lib/gcc/i386-redhat-linux/3.4.3/../../../../i386-redhat-linux/include"
ignoring nonexistent directory "/usr/local/include"
ignoring duplicate directory
"/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4//lib/gcc/i386-redhat-linux/3.4.3/include"
ignoring nonexistent directory
"/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4//lib/gcc/i386-redhat-linux/3.4.3/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /amd/packages/mdx/redhat/compilers/gcc-3.4.3-9.EL4/bin/../lib/gcc/i386-redhat-linux/3.4.3/include
 /nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4//include
 /usr/include
End of search list.
GNU C version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) (i386-redhat-linux)
        compiled by GNU C version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
t.c:3: error: `LLONG_MAX' undeclared here (not in a function)


The system (RH Advanced Server 4.0) is characterized by:

$ uname -a
Linux toque 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386
GNU/Linux

$ /lib/libc.so.6 
GNU C Library stable release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4).
Compiled on a Linux 2.4.20 system on 2004-12-20.
.....

$ gcc -v
Reading specs from
/amd/packages/mdx/redhat/compilers/gcc-3.4.3-9.EL4/bin/../lib/gcc/i386-redhat-linux/3.4.3/specs
Configured with: ../configure
--prefix=/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4/
--mandir=/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4//man
--infodir=/nfs/packages/mdx/rhas/compilers/gcc-3.4.3-9.EL4//info --enable-shared
--enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++,objc,java,f77 --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)

The same issue can be observed on other Linux systems we have: slackware (10.1),
suse (SLES 9), etc.

Aren't the libc C99 numeric limits supposed to be brought in by _GNU_SOURCE as
per the comment in features.h?

/* These are defined by the user (or the compiler)
   to specify the desired environment:

...............
   _ISOC99_SOURCE       Extensions to ISO C89 from ISO C99.
...............
   _GNU_SOURCE          All of the above, plus GNU extensions.
...............


Thanks,
Liviu

-- 
           Summary: _GNU_SOURCE does not bring in C99 numeric limits
           Product: glibc
           Version: 2.3.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: nicoara at roguewave dot com
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://sources.redhat.com/bugzilla/show_bug.cgi?id=1228

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]