public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/28940] [4.0/4.1/4.2 Regression] address selection does not work correctly
Date: Wed, 11 Oct 2006 12:23:00 -0000	[thread overview]
Message-ID: <20061011122334.30010.qmail@sourceware.org> (raw)
In-Reply-To: <bug-28940-10833@http.gcc.gnu.org/bugzilla/>



------- Comment #7 from rguenth at gcc dot gnu dot org  2006-10-11 12:23 -------
We're not folding

  return (int) *((char *) (long unsigned int) i + &a + 1B) + (int) *((char *)
(long unsigned int) i + &b + 1B);

one reason is that the C frontend decomposes &a[i], one is the array-to-pointer
decay code of the frontend.  Compare that to the C++ frontend where we manage
to fold to

return <retval> = (int) a[(<unnamed type>) (long unsigned int) i + 1] + (int)
b[(<unnamed type>) (long unsigned int) i + 1];

and so do the optimization.

In particular, fold-const.c:try_move_mult_to_index does not recognize
 <addr_expr 0x2b0bb95fd0c0
    type <pointer_type 0x2b0bb9615420
        type <integer_type 0x2b0bb96022c0 char public string-flag QI
            size <integer_cst 0x2b0bb95f27e0 constant invariant 8>
            unit size <integer_cst 0x2b0bb95f2810 constant invariant 1>
            align 8 symtab 0 alias set -1 precision 8 min <integer_cst
0x2b0bb95f28a0 -128> max <integer_cst 0x2b0bb95f2960 127>
            pointer_to_this <pointer_type 0x2b0bb9615420>>
        public unsigned DI
        size <integer_cst 0x2b0bb95f2d80 constant invariant 64>
        unit size <integer_cst 0x2b0bb95f2db0 constant invariant 8>
        align 64 symtab 0 alias set -1>
    constant invariant
    arg 0 <var_decl 0x2b0bb97bcbb0 a
        type <array_type 0x2b0bb97bcb00 type <integer_type 0x2b0bb96022c0 char>
            BLK
            size <integer_cst 0x2b0bb97ce3f0 constant invariant 80>
            unit size <integer_cst 0x2b0bb97ce390 constant invariant 10>
            align 8 symtab 0 alias set -1 domain <integer_type 0x2b0bb97bca50>>
        addressable used public static common BLK defer-output file t.i line 1
size <integer_cst 0x2b0bb97ce3f0 80> unit size <integer_cst 0x2b0bb97ce390 10>
        align 8>>
as &a[0].


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |c


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28940


  parent reply	other threads:[~2006-10-11 12:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-02 21:14 [Bug tree-optimization/28940] New: Overzealous CSE with static array access lmakhlis at bmc dot com
2006-09-02 21:29 ` [Bug rtl-optimization/28940] [4.1/4.2 Regression] address selection does not work correctly pinskia at gcc dot gnu dot org
2006-09-07  1:16 ` mmitchel at gcc dot gnu dot org
2006-09-07  8:11 ` bonzini at gnu dot org
2006-09-07  8:15 ` bonzini at gnu dot org
2006-09-09  5:48 ` [Bug rtl-optimization/28940] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
2006-09-09 13:02 ` bonzini at gnu dot org
2006-09-09 13:03 ` bonzini at gnu dot org
2006-10-11 12:23 ` rguenth at gcc dot gnu dot org [this message]
2006-10-11 12:30 ` [Bug c/28940] " rguenth at gcc dot gnu dot org
2006-10-11 12:47 ` bonzini at gnu dot org
2006-10-11 12:53 ` rguenth at gcc dot gnu dot org
2006-10-11 13:05 ` paolo dot bonzini at lu dot unisi dot ch
2007-01-15 20:21 ` [Bug rtl-optimization/28940] " pinskia at gcc dot gnu dot org
2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
2007-07-05 10:37 ` bonzini at gnu dot org
2007-07-05 10:43 ` ebotcazou at gcc dot gnu dot org
2007-07-05 10:46 ` paolo dot bonzini at lu dot unisi dot ch
2007-11-03  7:53 ` ebotcazou at gcc dot gnu dot org
2007-11-03  7:54 ` ebotcazou at gcc dot gnu dot 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=20061011122334.30010.qmail@sourceware.org \
    --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).