From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 47E103858412; Mon, 27 Nov 2023 17:56:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47E103858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701107768; bh=hzw9slJ2lzcO3/GheaFHMY08Fe09//EeTTyXsHzFvhs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yCGj3G3wFzspsI8KBBGimiRQ+CY+mnzG1U/nxxiwb6mRaLshJPiUs3u4P5VSSYQv+ 2hJWTeDQbSpHQU+rXhn2FHOLvztxXnksQayxb8CH03Vkap06mGNpsMxMuZQm52xe2O d3G4znkpjbLsqZK9aUvylqVmIutW/M+W3JsgbReg= From: "lhyatt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/112701] wrong type inference for ternary operator with `0/0u` in preprocessing context Date: Mon, 27 Nov 2023 17:56:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lhyatt at gcc dot gnu.org X-Bugzilla-Status: NEW 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: bug_status cf_reconfirmed_on everconfirmed cc 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=3D112701 Lewis Hyatt changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-11-27 Ever confirmed|0 |1 CC| |lhyatt at gcc dot gnu.org --- Comment #4 from Lewis Hyatt --- Here is the fix. Not sure if it needs to wait for GCC 15 by now, but I can submit it with the testcase. diff --git a/libcpp/expr.cc b/libcpp/expr.cc index 825d2c2369d..4f4a9722ac7 100644 --- a/libcpp/expr.cc +++ b/libcpp/expr.cc @@ -2216,6 +2216,7 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num r= hs, enum cpp_ttype op, if (!pfile->state.skip_eval) cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0, "division by zero in #if"); + lhs.unsignedp =3D unsignedp; return lhs; }=