From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 499083858C5E; Wed, 14 Jun 2023 20:06:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 499083858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686773185; bh=okAXYhCExwfG/cStZHqIO6hf/AJRQtmnZjVR7pDLvFU=; h=From:To:Subject:Date:From; b=T3oWRoZKNkoTj1AcpMMvIO6xpnbzFqom+EVqR2Ne8E4IMZsg5lCxUdvHhebdxCXQ6 HQlUg1nw+BsninaILryinBanWLD96bCfioGeIFYF+JJ8VcSYoThB3vkY1uVuKaBXlp VYrH1fppYSJgk+cwWsnaUeNG/MwLg9J0NUpwnCy0= From: "roland.illig at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/110259] New: Wrong warning 'conversion to unsigned int' with enum and comma Date: Wed, 14 Jun 2023 20:06:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: roland.illig at gmx dot de 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D110259 Bug ID: 110259 Summary: Wrong warning 'conversion to unsigned int' with enum and comma Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: roland.illig at gmx dot de Target Milestone: --- ~~~c enum e { e1, e2, }; int side_effect(void); enum e demo(_Bool, enum e); enum e demo(_Bool cond, enum e c1) { enum e var =3D cond ? c1 : ( side_effect(), e2 ); return var; } ~~~ gcc-12.2.0 gcc -O2 -Wconversion -c indent.c indent.c: In function =E2=80=98demo=E2=80=99: indent.c:16:22: warning: conversion to =E2=80=98unsigned int=E2=80=99 from = =E2=80=98int=E2=80=99 may change the sign of the result [-Wsign-conversion] 16 | : | ^ Same result for -ansi, -std=3Dc99, -std=3Dc2x, as well as for GCC 10.4.0. Removing the 'side_effect(),' makes the warning disappear. The comma operator has the type of its right operand, therefore I don't see where the 'unsigned' might come from.=