This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization bug
- To: Dima Volodin <dvv at dvv dot ru>
- Subject: Re: optimization bug
- From: Valentin Bonnard <bonnardv at pratique dot fr>
- Date: Sun, 25 Oct 1998 21:17:38 +0100
- CC: egcs-bugs at cygnus dot com
- Organization: Ecole Normale Superieure, Paris, France
- References: <362F5FC4.51E555E5@dvv.ru>
Dima Volodin wrote:
> The same thing w/o -O works OK. This one was tested on Solaris x86 and
> Solaris Sparc. The results are absolutely the same.
Well, you program invokes undefined behaviour and thus ins't garantied
to compile anyway. Here is a program which doesn't invoke undefined
behaviour and is way shorter:
struct Base
{
virtual void foo () = 0;
};
int main ()
{
struct Der : Base
{
void foo ()
{
}
} l;
}
produces
/var/tmp/cchOM1Q1%O(.gnu.linkonce.d._vt.Q26main.0_3Der+0xc): undefined
reference to `foo__Q26main.0_3Der.2'
collect2: ld returned 1 exit status
when compiled with -O. Version is:
Reading specs from
/usr/local/util/packages/egcs-050798/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.45/specs
gcc version egcs-2.91.45 19980704 (gcc2 ss-980609 experimental)
--
Valentin Bonnard mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/