This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

3.1.1 RedHat 6.2 --- cerr NULL stops program execution???


Hi there,

I finished compiling g++ 3.1.1 under Redhat 6.2. It took a while but it went
without a hitch. Aside from having to recompile boost in order to work with
my full project I didn't have too many problems. Great!

I'm fixing a whole lot of code that used to compile ok in 2.95.3 and it
doesn't anymore, mostly due to std:: and namespaces conflicts. It's good
that g++ is now stopping us :-)

But I was doing regression testing on one library I had written and found
something weird. I can now reproduce it with only a few lines:

#include <iostream>

int
  main()
{
    const char* const c1 = "C1";
    const char* const c2 = "C2";
    const char* const d  = NULL;
    const char* const c3 = "C3";

    std::cerr << "c1 is " << c1 << std::endl;
    std::cerr << "c2 is " << c2 << std::endl;
    std::cerr << "d  is " << d << std::endl;
    std::cerr << "c3 is " << c3 << std::endl;
    return 0;
}

This is the output:

[anibal@anibal C++]$ g++ -Wall jj.cpp
[anibal@anibal C++]$ ./a.out
c1 is C1
c2 is C2
d  is [anibal@anibal C++]$

See? c3 never got printed out. The program seems to terminate when printing
out NULL.
This used to work fine in 2.95.3.

These are my versions:

d  is [anibal@anibal C++]$ g++ --version
g++ (GCC) 3.1.1
Copyright (C) 2002 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.

[anibal@anibal C++]$ uname -a
Linux anibal 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown
[anibal@anibal C++]$

[anibal@anibal C++]$ cat /etc/redhat-release
Red Hat Linux release 6.2 (Zoot)

Can anybody let me know what's going on here?

thanks,

-Anibal


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