20.04 gcc with -O2 crashes due to previously benign error
David L
david4lists at gmail.com
Sun Jun 21 16:23:20 UTC 2020
The program below crashes when compiled with -O2 or greater optimization on
Ubuntu 20.04 (it worked fine on at least 1[468].04. I know that it's my own
fault for forgetting a return value and ignoring the compiler warning, but
IMHO, this shouldn't result in a difficult to debug segfault. Shame on me
for writing code with undefined behavior. Shame on gcc for a punishment not
suited to the crime. ;) I write this in the hope that somebody else doesn't
waste hours debugging a problem with a program that has run fine through
many versions of gcc with a previously benign missing but ignored return
value.
int init()
{
}
int main(int argc, char *argv[])
{
init();
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20200621/eb488fc5/attachment.html>
More information about the ubuntu-users
mailing list