From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B51A3858D32; Tue, 2 Apr 2024 17:21:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B51A3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712078489; bh=91AmjdPhMq7SRqFWb5Xl+1oeUs0rl4Ncwt5vhQPIFgE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=q+xy25UmuVR35i3XUx8EklyRMmB5p8xbnf2Zq1YpMYEvJIrQb64QC5+T2BrWNAgPc WaCeOuVrhkfT6JjR1CGE151+y3W7Kf/FZER6r8qxlVrNlMvJiQp89ZagQ1F4atUrvB R0MtTlec6q0gRvHZ1QsDd9XSY1lzWN/Al7ZmQ/9k= From: "jsm28 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/114526] ISO C does not prohibit extensions: fix misconception. Date: Tue, 02 Apr 2024 17:21:28 +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: 14.0 X-Bugzilla-Keywords: diagnostic, documentation X-Bugzilla-Severity: normal X-Bugzilla-Who: jsm28 at gcc dot gnu.org 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=3D114526 --- Comment #11 from Joseph S. Myers --- I think that simply failing to say whether a value of type X may be convert= ed to type Y is clearly enough for it at least to be unspecified whether or wh= en such conversions are possible in a cast at all (which is enough for rejecti= ng the translation unit). And since no requirements are imposed relating to su= ch conversions at either translation time or runtime, the definition of undefi= ned behavior is met. If you try to cast from a struct to a union (for example), you violate a constraint. If you try to do a conversion between a pointer and another sca= lar type that's not one of the "may be converted" cases listed as allowing such= a conversion, you have undefined behavior through the lack of definition (if = it's an implicit conversion rather than a cast, doing it as an implicit conversi= on violates a constraint unless it follows the requirements for assignment expressions.)=