From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4BAB0386F449; Wed, 19 Aug 2020 14:05:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BAB0386F449 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597845902; bh=ua+bR3DqItr3t7yDmSBwBTPdZ9r1CMAX+ViVYXSZpJc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=glVRTtJZWmftlW/xAyKwHyVMK3mVroMmcp6oYBa89ZMPaaP0q3LXDjUEexRHn/gET ysrNvQv1WYKGiI74Pc+n7QTHEYZaG+EiWTTw6TclA1vG7mdgJQ9u3aRMJ+zdSf38oi xoYwuUids6TwWAjQBqiG+cUNhyghE/XalLm+PYXA= From: "dcrocker at eschertech dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61372] Add warning to detect noexcept functions that might throw Date: Wed, 19 Aug 2020 14:05:01 +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: 4.9.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dcrocker at eschertech dot com 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: Wed, 19 Aug 2020 14:05:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61372 --- Comment #5 from David Crocker --- You seem to be assuming that C++ exceptions can propagate through functions compiled with a C compiler. On most platforms, they normally cannot, becaus= e a C compiler does not produce the information needed for the C++ unwind mecha= nism to unwind the call stack. If you want bsearch and qsort to propagate C++ exceptions, on most platforms the implementations of those functions would = have to be compiled either using a C++ compiler, or with a C compiler using a special option that tells the compiler to include the tables and/or code ne= eded to propagate C++ exceptions. Otherwise the exception will end up at std::unexpected. Maybe bsearch and qsort in newlib are compiled this way, I haven't checked. I don't care whether extern "C" functions are to be assumed noexcept by def= ault or another compiler option is needed to specify that. But without this facility, the proposed warning will be useless in practice, at least for pe= ople like me writing embedded software.=