This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/18559] New: apple's gcc-3.3 -fast causes bus error
- From: "fang at csl dot cornell dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Nov 2004 05:33:20 -0000
- Subject: [Bug other/18559] New: apple's gcc-3.3 -fast causes bus error
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Cranking up optimization level from -O3 to -fast causes bus error.
Note: this is only applicable to Apple's gcc-3.3 on Darwin.
(Their developer site directed me to report bugs here.)
----------------------------------------------------------------
gcc version:
g++ -v --save-temps -g -fast -W -Wall -Werror -Wno-unused hello.cc
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3-fast/specs
Thread model: posix
gcc version 3.3-fast 20030304 (Apple Computer, Inc. build 1614)
/usr/libexec/gcc/darwin/ppc/3.3-fast/cc1plus -E -D__GNUG__=3 -quiet -v
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1614
-D__DYNAMIC__ hello.cc -W -Wall -Werror -Wno-unused -fast
-D__private_extern__=extern -o hello.ii
ignoring nonexistent directory "/usr/ppc-darwin/include"
ignoring nonexistent directory "/Local/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/gcc/darwin/3.3-fast/c++
/usr/include/gcc/darwin/3.3-fast/c++/ppc-darwin
/usr/include/gcc/darwin/3.3-fast/c++/backward
/usr/local/include
/usr/include/gcc/darwin/3.3-fast
/usr/include
End of search list.
Framework search starts here:
/System/Library/Frameworks
/Library/Frameworks
End of framework search list.
/usr/libexec/gcc/darwin/ppc/3.3-fast/cc1plus -fpreprocessed hello.ii -O3
-quiet -dumpbase hello.cc -auxbase hello -g -W -Wall -Werror -Wno-unused
-version -fast -D__private_extern__=extern -o hello.s
GNU C++ version 3.3-fast 20030304 (Apple Computer, Inc. build 1614)
(ppc-darwin)
compiled by GNU C version 3.3-fast 20030304 (Apple Computer, Inc.
build 1614).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=131072
/usr/libexec/gcc/darwin/ppc/as -arch ppc970 -o hello.o hello.s
ld -arch ppc -dynamic -o a.out -lcrt1.o -lcrt2.o
-L/usr/lib/gcc/darwin/3.3-fast -L/usr/lib/gcc/darwin
-L/usr/libexec/gcc/darwin/ppc/3.3-fast/../../.. hello.o -lstdc++ -lgcc
-lSystem |
c++filt3
-------------------------------------------
I have also reproduced the crash with:
gcc version 3.3-fast 20030304 (Apple Computer, Inc. build 1620)
/usr/libexec/gcc/darwin/ppc/3.3-fast/cc1plus -E -D__GNUG__=3 -quiet -v
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1620
-D__DYNAMIC__ hello.cc -mcpu=G4 -W -Wall -Werror -Wno-unused -fast
-D__private_extern__=extern -o hello.ii
ignoring nonexistent directory "/usr/ppc-darwin/include"
ignoring nonexistent directory "/Local/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/gcc/darwin/3.3-fast/c++
/usr/include/gcc/darwin/3.3-fast/c++/ppc-darwin
/usr/include/gcc/darwin/3.3-fast/c++/backward
/usr/local/include
/usr/include/gcc/darwin/3.3-fast
/usr/include
End of search list.
Framework search starts here:
/System/Library/Frameworks
/Library/Frameworks
End of framework search list.
/usr/libexec/gcc/darwin/ppc/3.3-fast/cc1plus -fpreprocessed hello.ii -O3
-quiet -dumpbase hello.cc -mcpu=G4 -auxbase hello -g -W -Wall -Werror
-Wno-unused -version -fast -D__private_extern__=extern -o hello.s
GNU C++ version 3.3-fast 20030304 (Apple Computer, Inc. build 1620)
(ppc-darwin)
compiled by GNU C version 3.3-fast 20030304 (Apple Computer, Inc.
build 1620).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=131072
/usr/libexec/gcc/darwin/ppc/as -arch ppc -o hello.o hello.s
ld -arch ppc -dynamic -o a.out -lcrt1.o -lcrt2.o
-L/usr/lib/gcc/darwin/3.3-fast -L/usr/lib/gcc/darwin
-L/usr/libexec/gcc/darwin/ppc/3.3-fast/../../.. foo.o -lstdc++ -lgcc
-lSystem |
c++filt
----------------------------------------------------------------------
and also on a machine with gcc-3.3 build 1495
(for which I currently don't have access)
adding -mcpu=G4 to the CFLAGS (for G4 instead of G5 platform)
for all versions mentioned also produces same bus error.
(configuration not replicated for brevity)
In all cases, when -fast is replaced with less aggressive -O3,
program runs cleanly.
----------------------------------------------------------------------
------------- hello.ii -----------------------------------------------
---------- (is 704 k large! can't paste whole file here...)----------
----------------------------------------------------------------------
however, the source file (I know I'm not supposed to post source...)
is two lines in main():
hello.cc (the entire source file):
#include <fstream>
using namespace std;
int
main(int argc, char* argv[]) {
ofstream bogus("bogus");
return 0;
}
-------------------------------------------------------
remarks: compiles with no warnings or errors
-------------------------------------------------------
run command:
a.out
-------------------------------------------------------
program output:
Bus error
-------------------------------------------------------
gdb stack:
Program received signal EXC_BAD_ACCESS, Could not access memory.
#0 0x0000af1c in std::locale::operator=(std::locale const&) ()
#1 0x0000c0a4 in std::ios_base::_M_init() ()
#2 0x0000cb10 in std::basic_ios<char, std::char_traits<char>
>::init(std::basic_streambuf<char, std::char_traits<char> >*) ()
#3 0x00002d34 in main (argc=-1073744276, argv=0xbffff340) at
/usr/include/gcc/darwin/3.3-fast/c++/ostream:86
--------------------------------------------------------------
hope this is enough to work with...
--
Summary: apple's gcc-3.3 -fast causes bus error
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fang at csl dot cornell dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: darwin
GCC host triplet: powerpc
GCC target triplet: apple
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18559