public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "R.E.Wolff at BitWizard dot nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/96550] gcc is smart in figuring out a non-returning function.
Date: Mon, 10 Aug 2020 11:51:05 +0000	[thread overview]
Message-ID: <bug-96550-4-aSb8SVeBVI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96550-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96550

--- Comment #5 from Roger Wolff <R.E.Wolff at BitWizard dot nl> ---
Guys, The compiler found a bug in my code, but it didn't tell me. Like the if
(a = 3) situation, the compiler is correct when it compiles the code according
to the C rules. 

I like to compile my code with -Wall for this reason: 99% of the cases, the
compiler will find and warn about stupid stuff that's not a problem. But in
that 1% of the cases, the compiler will warn about something that's a bug that
would've taken lots of time to find.  SO when you get that one warning, you
have the compiler telling you: You have a bug on line X of your program. 

That's what could've happened here: I had a bug in my code, but didn't expect
the binary to suddenly go from 75k to 14k because of a bug.

Something like: 
Line 18: dereferencing NULL pointer is undefined behaviour. Assuming execution
stops here. 

would be a usable error message. 

This is actually one of those 1% of the cases where the warning COULD have been
given and finding the bug would've been seconds whereas without the warning
lots of time was wasted looking for the bug in the wrong places. 

This is not a bug per se, you can suggest workarounds for: "What if you want to
store stuff at address zero" all you want, but I had a bug and I've asked gcc
to issue warnings where I'm doing fishy stuff that might be a bug. And I didn't
get that warning. 

So this issue is not a bug in that the wrong code is generated, but an
enhancement request: Please issue that warning. 

All this is "not for me": I've now run into this issue, the bug in my project
has been fixed and for me it's on to the rest of the code. And I've been
subjected to this "way of gcc telling me there is a bug", so in the future, if
I make this mistake again, I'll not spend as much time on it as I did this
weekend. 

So I'm trying to make things easier for those others that might run into this
in the future.

  parent reply	other threads:[~2020-08-10 11:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10 11:16 [Bug c/96550] New: " R.E.Wolff at BitWizard dot nl
2020-08-10 11:32 ` [Bug c/96550] " glisse at gcc dot gnu.org
2020-08-10 11:33 ` jakub at gcc dot gnu.org
2020-08-10 11:38 ` redi at gcc dot gnu.org
2020-08-10 11:40 ` redi at gcc dot gnu.org
2020-08-10 11:51 ` R.E.Wolff at BitWizard dot nl [this message]
2020-08-10 11:55 ` R.E.Wolff at BitWizard dot nl
2020-08-10 11:59 ` jakub at gcc dot gnu.org
2020-08-10 12:29 ` R.E.Wolff at BitWizard dot nl
2020-08-10 12:30 ` redi at gcc dot gnu.org
2020-08-10 12:42 ` R.E.Wolff at BitWizard dot nl
2020-08-10 12:45 ` R.E.Wolff at BitWizard dot nl
2020-08-10 12:55 ` R.E.Wolff at BitWizard dot nl
2020-08-10 13:03 ` schwab@linux-m68k.org
2020-08-10 13:04 ` redi at gcc dot gnu.org
2020-08-10 13:13 ` R.E.Wolff at BitWizard dot nl
2020-08-10 16:06 ` redi at gcc dot gnu.org
2020-08-11  7:19 ` R.E.Wolff at BitWizard dot nl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96550-4-aSb8SVeBVI@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).