Undefined behavior or compiler bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm using the -fsanitize=undefined flag and got a runtime error after a
compiler upgrade from 7.2 to 9.3. I was happy at first that the upgraded
compiler caught an error that I can fix before it hits me in production.

However after some investigation, I cannot figure out what's wrong in the
code. That's why I seek help on this mailing list, can someone explain
the bug to me? Or is it a bug in the compiler that I should report?

The simplified version of the test code on Compiler Explorer:
https://godbolt.org/z/7rAxJj

It shows that different compiler versions behave differently.

There is a comment on line 16 that explicitly defaults the Derived
constructor. If you switch the comment with line 17, both compiler verions
run fine without producing the runtime error although the defaulted
constructor should be exactly the same the user defined one:
https://godbolt.org/z/UShm-u

Can someone please explain what's wrong?

Thanks in advance,
Tibor Billes




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux