From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 05C57385702F; Mon, 10 Aug 2020 11:38:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05C57385702F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597059530; bh=qgloa6CCbE0aMrWSkfRmPs4ZSjPJJWdMI2kSlQFI35s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aRWb5/BGXZb1y1UUFOjaAJ5SOhW5BINNIUo1Znl4i6uYPHa9P8LNhFyCmBeyamGbG xNBKgbzEhoESdWpM0kTu1kto5FNpsRti2fgeo8P4lyhZyKU7QddwnQ2R31KyKz6jWj xn5Ys4mDCgq4qVCHmzkA4zAKmpz8MqEBtm3MSoNo= From: "redi at gcc dot 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:38:49 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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:38:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96550 --- Comment #3 from Jonathan Wakely --- (In reply to Roger Wolff from comment #0) > So... without saying anything the compiler decided that my function will > never return. It might be right about that (That's not true: This is on an > embedded system and I can map RAM to address zero!) but then IMHO, a warn= ing > would be warranted. A function goes from not being declared volatile by me > to being volatile (not returning).=20 >=20 > It's perfectly legal C code in there, but might not be what the user > wanted.... Just like if (a =3D 3) ... I think a warning might be issued.= =20 GCC *does* warn: null.c: In function =E2=80=98myfunc=E2=80=99: null.c:19:11: warning: null pointer dereference [-Wnull-dereference] 19 | mt.t[0] =3D 1; | ~~~~~~~~^~~=