From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EC1B73857C53; Mon, 10 Aug 2020 11:51:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC1B73857C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597060265; bh=2Ajtp+os4MZHoY0dDT0bK3vJg39JKfwET1qq2OYxz0s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YhSEJX7qogpEwkJBx1TswAa7DSSi3m82z33DMuF+c4fNlyeeimVZk1729vtseptOZ rkqL9yufQ42mWyRfN+DmSkBuqLw8mTJ0dYTlZdu9TAUoMwpaOUd/81x4XkblcFYDKz w8t1zXHS5BzmfM+NzP74SFlsmZd8hkSz3vyYOSZM= From: "R.E.Wolff at BitWizard dot nl" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 9.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: R.E.Wolff at BitWizard dot nl X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2020 11:51:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96550 --- Comment #5 from Roger Wolff --- Guys, The compiler found a bug in my code, but it didn't tell me. Like the = if (a =3D 3) situation, the compiler is correct when it compiles the code acco= rding to the C rules.=20 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 t= hat 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.=20 That's what could've happened here: I had a bug in my code, but didn't expe= ct the binary to suddenly go from 75k to 14k because of a bug. Something like:=20 Line 18: dereferencing NULL pointer is undefined behaviour. Assuming execut= ion stops here.=20 would be a usable error message.=20 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.=20 This is not a bug per se, you can suggest workarounds for: "What if you wan= t to store stuff at address zero" all you want, but I had a bug and I've asked g= cc to issue warnings where I'm doing fishy stuff that might be a bug. And I di= dn't get that warning.=20 So this issue is not a bug in that the wrong code is generated, but an enhancement request: Please issue that warning.=20 All this is "not for me": I've now run into this issue, the bug in my proje= ct 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.=20 So I'm trying to make things easier for those others that might run into th= is in the future.=