public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Undefined behavior or compiler bug?
@ 2020-06-15 17:32 Tibor Billes
  2020-06-15 20:24 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Tibor Billes @ 2020-06-15 17:32 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-16  5:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 17:32 Undefined behavior or compiler bug? Tibor Billes
2020-06-15 20:24 ` Jonathan Wakely
2020-06-16  5:16   ` Tibor Billes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).