From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA9D43858418; Tue, 6 Feb 2024 12:00:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA9D43858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707220847; bh=A7bXIffV1qp4sc8Fr1WeTBXI1Hr8rVLx6p6sl5/qJHM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EWPvJgbSspyNuvE7K2M4P4Z/LV+t5ojfz7HcdPqbqXynhpr06dJAHPQjK54g5usaZ udoljzy1Rq/lx9OcjSvUpDLx0kRY0+B4iEGpOVY2TBYXyCsifn/rwk8SwNSRigmv+Y EISmS0XW6nRcRJWgeWEDZLRlYxx6gICEdfnJHO9Y= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113759] [14 regression] ICE when building fdk-aac-2.0.3 since r14-8680 Date: Tue, 06 Feb 2024 12:00:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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=3D113759 --- Comment #7 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:760a1a5b5e427707357ca1fa858c4561258972df commit r14-8823-g760a1a5b5e427707357ca1fa858c4561258972df Author: Jakub Jelinek Date: Tue Feb 6 12:57:53 2024 +0100 tree-ssa-math-opts: Fix up convert_{mult,plusminus}_to_widen [PR113759] On the following testcase we emit invalid stmt: error: type mismatch in =C3=A2widen_mult_plus_expr=C3=A2 6 | foo (int c, int b) | ^~~ unsigned long int unsigned int unsigned long _31 =3D WIDEN_MULT_PLUS_EXPR ; The recent PR113560 r14-8680 changes tweaked convert_mult_to_widen, but didn't change convert_plusminus_to_widen for the TREE_TYPE (rhsN) !=3D typeN cases, but looking at this, it was already before that change quite weird. Earlier in those functions it determines actual_precision and from_unsignedN and wants to use that precision and signedness for the operands and it used build_and_insert_cast for that (which emits a cast stmt, even f= or INTEGER_CSTs) and later on for INTEGER_CST arguments fold_converted them to typeN (which is unclear to me why, because it seems to have assumed that TREE_TYPE (rhsN) is typeN, for the actual_precision or from_unsign= edN cases it would be wrong except that build_and_insert_cast forced a SSA_= NAME and so it doesn't trigger anymore). Now, since r14-8680 it is possible that rhsN also has some other type f= rom typeN and we again want to cast. The following patch changes this, so that for the differences in actual_precision and/or from_unsignedN we actually update typeN and then use it as the type to convert the arguments to if it isn't useless, for INTEGER_CSTs by just fold_converting, otherwise using build_and_insert_cast. And uses useless_type_conversion_p test so that we don't convert unless necessary. Plus by doing that effectively also doing the important par= t of the r14-8680 convert_mult_to_widen changes in convert_plusminus_to_wide= n. 2024-02-06 Jakub Jelinek PR tree-optimization/113759 * tree-ssa-math-opts.cc (convert_mult_to_widen): If actual_precision or from_unsignedN differs from properties of typeN, update typeN to build_nonstandard_integer_type. If TREE_TYPE (rhsN) is not uselessly convertible to typeN, convert it using fold_convert or build_and_insert_cast depending on if rhsN is INTEGER_CST or no= t. (convert_plusminus_to_widen): Likewise. * gcc.c-torture/compile/pr113759.c: New test.=