This is the mail archive of the gcc@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]

Re: EXC_BAD_ACCESS writing to cout with PFE precompiled headers


This has been fixed in current Apple GCC sources.
You can check them out from Darwin cvs repostiory (cvs tag 1302).
Otherwise next next compiler release will have the fix.

Thanks,
-Devang
On Friday, December 6, 2002, at 05:06 PM, Klein, Patrick wrote:

I'm running the Apple's release of GCC:

g++ -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
Thread model: posix
Apple Computer, Inc. GCC version 1161, based on gcc version 3.1 20020420
(prerelease)

and am having trouble with precompiled headers. I am stumped. It previously
worked on 1/2 of my Mac's running Jaguar, but today it's down to 0/2. The
precompiled headers seem to work fine unless I try to precompile
<iostream.h> and write to cout. The precompiled header is (pch.cpp):

#include <iostream.h>

The test program is (test.cpp):

#include <iostream.h>

int main(void)
{
cout << "hello" << endl;
return 0;
}

I build the precompiled header with:

c++ --dump-pch foo -c pch.cpp

and build the test program with:

c++ --load-pch foo test.cpp -o test

when I run the executable, it dies with:

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x0000a1d4 in std::ostream::sentry::sentry(std::ostream&) ()
(gdb) where
#0 0x0000a1d4 in std::ostream::sentry::sentry(std::ostream&) ()
#1 0x0000a424 in std::basic_ostream<char, std::char_traits<char> >&
std::operator<< <std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*) ()
#2 0x00001d98 in main () at test.cpp:5
#3 0x00001b14 in _start (argc=1, argv=0xbffff83c, envp=0xbffff844) at
/SourceCache/Csu/Csu-45/crt.c:267
#4 0x00001994 in start ()

Any clues?

Many thanks.

------------------------------------------
Patrick A. Klein
Sandia National Laboratories
MS9161
P.O. Box 0969
Livermore, CA 94551

p: (925) 294-4618 or (800) 4SANDIA x4-4618
f: (925) 294-3231
e: paklein@sandia.gov
------------------------------------------







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