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/107835] [13 Regression] ICE in build2, at tree.cc:5020 since r13-254-gdd3c7873a61019e9
Date: Wed, 30 Nov 2022 10:46:20 +0000	[thread overview]
Message-ID: <bug-107835-4-vutogCvVhS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107835-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from CVS 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:7716ee1e90412f785cba20acffd59fc7461302cb

commit r13-4405-g7716ee1e90412f785cba20acffd59fc7461302cb
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Nov 30 11:44:27 2022 +0100

    tree-chrec: Fix up ICE on pointer multiplication [PR107835]

    r13-254-gdd3c7873a61019e9 added an optimization for {a, +, a} (x-1),
    but as can be seen on the following testcase, the way it is written
    where chrec_fold_multiply is called with type doesn't work for pointers:
                 res = build_int_cst (TREE_TYPE (x), 1);
                 res = chrec_fold_plus (TREE_TYPE (x), x, res);
                 res = chrec_convert_rhs (type, res, NULL);
                 res = chrec_fold_multiply (type, chrecr, res);
    while what we were doing before and what is still used if the condition
    doesn't match is fine:
                 res = chrec_convert_rhs (TREE_TYPE (chrecr), x, NULL);
                 res = chrec_fold_multiply (TREE_TYPE (chrecr), chrecr, res);
                 res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
    because it performs chrec_fold_multiply on TREE_TYPE (chrecr) and converts
    only afterwards.

    I think the easiest fix is to ignore the new path for pointer types.

    2022-11-30  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/107835
            * tree-chrec.cc (chrec_apply): Don't handle "{a, +, a} (x-1)"
            as "a*x" if type is a pointer type.

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

  parent reply	other threads:[~2022-11-30 10:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 13:54 [Bug tree-optimization/107835] New: " marxin at gcc dot gnu.org
2022-11-23 13:54 ` [Bug tree-optimization/107835] " marxin at gcc dot gnu.org
2022-11-23 20:57 ` rguenth at gcc dot gnu.org
2022-11-29 14:26 ` jakub at gcc dot gnu.org
2022-11-29 14:37 ` jakub at gcc dot gnu.org
2022-11-30 10:46 ` cvs-commit at gcc dot gnu.org [this message]
2022-11-30 10:46 ` jakub at gcc dot gnu.org

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-107835-4-vutogCvVhS@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).