Undefined behavior or compiler bug?

Jonathan Wakely jwakely.gcc@gmail.com
Mon Jun 15 20:24:11 GMT 2020


On Mon, 15 Jun 2020 at 18:34, Tibor Billes <tbilles@gmx.com> wrote:
>
> 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?

Looks like a bug, please do report it to bugzilla, thanks.


More information about the Gcc-help mailing list