public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/109393] Very trivial address calculation does not fold
Date: Tue, 11 Apr 2023 12:16:50 +0000	[thread overview]
Message-ID: <bug-109393-4-OKqKMp9OwD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109393-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |c
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-04-11
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's probably a mismatch of GENERIC/GIMPLE folding.  In this case it's
pointer_int_sum prematurely distributing the multiplication:

/* Return a tree for the sum or difference (RESULTCODE says which)
   of pointer PTROP and integer INTOP.  */

tree  
pointer_int_sum (location_t loc, enum tree_code resultcode,
                 tree ptrop, tree intop, bool complain)
{     
...
  /* If what we are about to multiply by the size of the elements
     contains a constant term, apply distributive law
     and multiply that constant term separately.
     This helps produce common subexpressions.  */

but this kind of stuff shouldn't be done by the frontends these days.

Gating this fixes the issue.  I think this piece of code should be axed
(after careful evaluation of its effect)

  parent reply	other threads:[~2023-04-11 12:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 17:57 [Bug tree-optimization/109393] New: " manolis.tsamis at vrull dot eu
2023-04-03 18:07 ` [Bug tree-optimization/109393] " pinskia at gcc dot gnu.org
2023-04-04 12:12 ` manolis.tsamis at vrull dot eu
2023-04-11 12:16 ` rguenth at gcc dot gnu.org [this message]
2023-05-10 12:55 ` [Bug c/109393] " manolis.tsamis at vrull dot eu
2023-05-11 12:47 ` rguenth at gcc dot gnu.org
2023-05-11 12:59 ` manolis.tsamis at vrull dot eu
2023-09-04 11:38 ` manolis.tsamis at vrull dot eu
2023-09-04 13:06 ` philipp.tomsich at vrull dot eu
2023-09-08 13:14 ` manolis.tsamis at vrull dot eu

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-109393-4-OKqKMp9OwD@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).