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

Re: optimization bug


My intention was not to find a shortest possible demonstration of any
bug, I just happened to come across this particular bug quite
accidentally. And, BTW, what's so undefined about my program's behavior?

Dima

On Sun, 25 Oct 1998 21:17:38 +0100, you wrote:

>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/
>



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