Bug 50418 - gcc 2.96 - bogus warning for tmpnam()
Summary: gcc 2.96 - bogus warning for tmpnam()
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: ia64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-31 01:50 UTC by Martin Sebor
Modified: 2007-04-18 16:35 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-07-31 01:50:16 UTC
Embargoed:


Attachments (Terms of Use)

Description Martin Sebor 2001-07-31 01:50:11 UTC
Apparently, the C++ compiler driver (but not the C one) decides that I shouldn't be using the ANSI C function tmpnam() and instead 
recommends the non-ANSI C mkstemp(). This even with the -pedantic and -strict options, where conformance to ANSI C rather than POSIX is 
clearly desired :)

Thanks
Martin


$ cat t.cpp ; gcc -v t.cpp
#include <stdio.h>

int main ()
{
    tmpnam (0);
}

Reading specs from /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -D__EXCEPTIONS -v -iprefix 
/package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/ -D__GNUC__=2 -D__GNUC_MINOR__=96 
-D__GNUC_PATCHLEVEL__=0 -D__ia64 -D__ia64__ -D__linux -D__linux__ -D_LONGLONG -Dlinux -Dunix -D__LP64__ -D__ELF__ 
-D__ia64 -D__ia64__ -D__linux -D__linux__ -D_LONGLONG -D__linux__ -D__unix__ -D__LP64__ -D__ELF__ -D__linux -D__unix 
-Asystem(linux) -Acpu(ia64) -Amachine(ia64) -D__NO_INLINE__ -D__LONG_MAX__=9223372036854775807L t.cpp /tmp/ccfGHa1e.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (IA-64)
#include "..." search starts here:
#include <...> search starts here:
 /package/1/ia64/compilers/gcc-2.96-85/include/g++-3
 /package/1/ia64/compilers/gcc-2.96-85/lib/gcc-lib/ia64-redhat-linux/2.96/include
 /package/1/ia64/compilers/gcc-2.96-85/ia64-redhat-linux/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/include/g++-3
 /usr/package/1/compilers/gcc-2.96-85-ia64/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/lib/gcc-lib/ia64-redhat-linux/2.96/include
 /usr/package/1/compilers/gcc-2.96-85-ia64/ia64-redhat-linux/include
 /usr/include
End of search list.
 /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/cc1plus /tmp/ccfGHa1e.ii -mb-step -quiet -dumpbase t.cpp 
-version -o /tmp/ccoa7Rfo.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (ia64-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 
7.1 2.96-85).
 as -x -o /tmp/ccl0C52B.o /tmp/ccoa7Rfo.s
 /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/collect2 -dynamic-linker /lib/ld-linux-ia64.so.2 /usr/lib/crt1.o 
/usr/lib/crti.o /package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/crtbegin.o 
-L/package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96 -L/package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib 
-L/usr/package/1/compilers/gcc-2.96-85-ia64/lib/gcc-lib/ia64-redhat-linux/2.96 
-L/package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/../../.. 
-L/usr/package/1/compilers/gcc-2.96-85-ia64/lib/gcc-lib/ia64-redhat-linux/2.96/../../.. /tmp/ccl0C52B.o -lgcc -lc -lgcc 
/package/1/ia64/compilers/gcc-2.96-85/bin/../lib/gcc-lib/ia64-redhat-linux/2.96/crtend.o /usr/lib/crtn.o
/tmp/ccl0C52B.o: In function `main':
/tmp/ccl0C52B.o(.text+0x22): the use of `tmpnam' is dangerous, better use `mkstemp'

Comment 1 Bill Nottingham 2001-07-31 05:54:19 UTC
the warning is not from the compiler, it's from glibc.


Note You need to log in before you can comment on or make changes to this bug.