public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-113759-4-7am3PuLhZI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113759-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113759

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:760a1a5b5e427707357ca1fa858c4561258972df

commit r14-8823-g760a1a5b5e427707357ca1fa858c4561258972df
Author: Jakub Jelinek <jakub@redhat.com>
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 âwiden_mult_plus_exprâ
        6 | foo (int c, int b)
          | ^~~
    unsigned long
    int
    unsigned int
    unsigned long
    _31 = WIDEN_MULT_PLUS_EXPR <b_5(D), 2, _30>;

    The recent PR113560 r14-8680 changes tweaked convert_mult_to_widen,
    but didn't change convert_plusminus_to_widen for the
    TREE_TYPE (rhsN) != 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 for
    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_unsignedN
    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 from
    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 part of
    the r14-8680 convert_mult_to_widen changes in convert_plusminus_to_widen.

    2024-02-06  Jakub Jelinek  <jakub@redhat.com>

            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 not.
            (convert_plusminus_to_widen): Likewise.

            * gcc.c-torture/compile/pr113759.c: New test.

  parent reply	other threads:[~2024-02-06 12:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 23:13 [Bug middle-end/113759] New: [14 regression] ICE when building fdk-aac-2.0.3 sjames at gcc dot gnu.org
2024-02-04 23:33 ` [Bug middle-end/113759] " pinskia at gcc dot gnu.org
2024-02-04 23:33 ` pinskia at gcc dot gnu.org
2024-02-04 23:43 ` [Bug middle-end/113759] [14 regression] ICE when building fdk-aac-2.0.3 since r14-8680 jakub at gcc dot gnu.org
2024-02-05  0:31 ` sjames at gcc dot gnu.org
2024-02-05  0:45 ` pinskia at gcc dot gnu.org
2024-02-05  0:46 ` sjames at gcc dot gnu.org
2024-02-05  9:46 ` [Bug tree-optimization/113759] " jakub at gcc dot gnu.org
2024-02-06 12:00 ` cvs-commit at gcc dot gnu.org [this message]
2024-02-06 12:02 ` jakub at gcc dot gnu.org
2024-02-06 12:33 ` roger at nextmovesoftware dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113759-4-7am3PuLhZI@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).