From: greve AT rs1 DOT thch DOT uni-bonn DOT de (Thomas Greve) Subject: How safe is -O2? To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Fri, 15 May 92 17:49:41 NFT Status: O Hello DJ, hello all, while playing around with g++, classes etc (i'm yet learning C++) i ran into two sorts of trouble: - The regex module is missing in libgcc. i didn't find the sources either, so i took them from libg++-2.0. I'll let you know, if they work 'as is' or if there have to be patches applied. (But this is not serious) - When trying to recompile libgcc, cc1plus stumbled over fix.cc in $(gcc)/libsrc/gcc/gpp when started with -O2. It just interrupted it's work half way, return code 1. No error msg, nothing. fix.cc can be compiled with -O, though. What happened? (There was enough paging space, HD space for the tmp-files etc. Nothing of the trivial kind...) - gcc ignores the `temp' variable, if there is a drive letter in it. (eg: g:/tmp is ignored, /tmp is not.) If there is a /tmp-directory in the current drive, gcc uses it, if there is no valid temp variable set. So you can JOIN your /tmp-disk there, if you want to. (What about the tcc-compiled gcc? I'm interested, too!) gcc tells you about this, if you set the -v option. - When i installed libg++ on this (rs6k)-machine, gcc failed the C++ test in libg++/test-install. Or at least it seemed to (the output differed from their expected.out). To have a reference to compare with i ran this test program with djgpp. (i trusted this port to be a reference... hear this, DJ? :-) But it failed. This time it was obvious. Here is the output: -------------------------------------------------------------------------------- Constructing Foo(1) "static_foo2" Initializing Foo(2) "static_foo2" with Foo(1) Destructing Foo(1) "static_foo2" (remaining foos: 1) Constructing Foo(2) "static_foo1" Initializing Foo(3) "static_foo1" with Foo(2) Destructing Foo(2) "static_foo1" (remaining foos: 2) Constructing Foo(3) "automatic_foo" Constructing Foo(4) "default-foo" Initializing Foo(5) "default-foo" with Foo(4) Destructing Foo(4) "default-foo" (remaining foos: 4) Constructing Foo(5) "other_foo1" Constructing Foo(6) "other_foo2" Copying Foo(5) "other_foo1" to Foo(6) Destructing Foo(6) "other_foo1" (remaining foos: 5) Destructing Foo(5) "other_foo1" (remaining foos: 4) Destructing Foo(5) "default-foo" (remaining foos: 3) Destructing Foo(3) "automatic_foo" (remaining foos: 2) -------------------------------------------------------------------------------- There are two destructors not called at the end of the program. Apart from this, the output is the same as the one produced by the gcc/rs6k. (Ok, the order of static objects being built is different, but this is not serious, is it? It seems, there are some intermediate objects being created by gcc 2.0, that are not 'expected' to produce output.) What do we learn from this? Is there a general bug in gcc (especially in cc1plus) DJ cannot be blamed for or is the expected.out not what should be expected (according to ANSI C++ 2.0)? And what about the two missing destructors? There is an `atexit'-sort of procedure not called at the end of the program, isn't it? - Thomas greve AT rs1 DOT thch DOT uni-bonn DOT de unt145 AT dbnrhrz1