[Bug c++/12629] New: name leaks

yujie dot wu at hec dot utah dot edu gcc-bugzilla@gcc.gnu.org
Wed Oct 15 22:45:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: name leaks
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yujie dot wu at hec dot utah dot edu
                CC: gcc-bugs at gcc dot gnu dot org

The function name `exit' should stay in std namespace when <csdtlib> is
included. But not.

Try the following program to reproduce the error:

#include <cstdlib>
#include <cstdio>
 
 
void exit( int a = 0 )
{
   std::puts( "dddddddd" );
   std::exit( a );
}
 
 
int main()
{
   exit( 1 );
}

Correct program should print "ddddddddd" once. Erroneous program prints many
times because the statement "std::exit" actually calls the `exit' defined in the
global scope.

The problem exists in both 3.3.x and 3.4 snapshots.


Another name leak is `random' (only found on cygwin). This name seems to have
been used by gcc somewhere (<cstdlib>) and leaks into the global scope.



More information about the Gcc-bugs mailing list