From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 41C713858C39; Wed, 28 Jun 2023 08:02:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41C713858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687939351; bh=RieJg+IXaZ9U9p0w70+vJVDBtOwcYKtE2dlm0qhfN8s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jQX5MOWpMHLhS5z+V+NTgLnt8+z8FPfoVICfsIc2aXGIuAYrK4SgdyOnpyQZq4Ale j8cpb2DZZ9Q3TuF6SW1ewdymDptPv/Xx1PU9Uj8el/A+bLi+J5xPKVqmHrI6QTFI32 rSZLdejHiJDGuu/faQMi2tXKfZBGqHLp7P2KC+eo= From: "jan.zizka at nokia dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110437] SIGILL when return missing in a C++ function with a condition Date: Wed, 28 Jun 2023 08:02:30 +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: 13.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jan.zizka at nokia dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110437 --- Comment #12 from Jan =C5=BDi=C5=BEka --- (In reply to Xi Ruoyao from comment #11) > is perfectly legal if the caller doesn't pass anything other than 1 or 42= to > f. So we cannot just reject it at the compile time, we can only issue a > warning. True that, still this doesn't make it sound software implementation :-) Another example pointed out by one colleague of mine: int f(int a) { if (a =3D=3D 1) exit(0); else return 0xbeef; } > And generally there is no way to determine if an "unsupported" value is > passed to f at compile time because doing so will need to solve the halti= ng > problem. That is true :-) but from software implementation if you reuse such a funct= ion or it is a library I'd personally disallow this as this is bad coding. But = this will be opinionated so better not to dive to such a rabbit hole. Thanks for comments.=