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]

Re: [gcc-4.3.1][c++] weird segfault with -O3 in constructor of a global object


Am Donnerstag 26 Juni 2008 13:27:46 schrieb Tom Browder:
> On Thu, Jun 26, 2008 at 6:10 AM, Maik Beckmann
> <beckmann.maik@googlemail.com> wrote:
> ...
>
> > $ /opt/bin/g++ -static -O3 test.cpp -o test
> > $ ./test
>
> Maik, try one more thing:
>
> Don't use "test" as the program name.
>
> Try recompiling as, say, "ttest".
>
> -Tom

{{{
$ export LD_LIBRARY_PATH=/opt/lib:/opt/lib64/
$ ls
CMakeLists.txt  Foo.h  Makefile  build  fill.cpp  test.cpp  tmp
$ /opt/bin/g++ -static -O3 test.cpp -o ttest_static
$ /opt/bin/g++ -O3 test.cpp -o ttest
$ ./ttest
Speicherzugriffsfehler
$ ./ttest_static 
Speicherzugriffsfehler
$ cat test.cpp
struct Vector {
  Vector() : x(0), y(0), z(0) { }  
  float x,y,z;
};

struct Foo { 
  int dummy; // commenting this out makes it run perfectly
  Vector array_of_vectors[4];
};

Foo foo;

int main() { }

$
}}} 

-- Maik


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