public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/66768] address space gets lost on literal pointer
Date: Tue, 07 Jul 2015 11:20:00 -0000 [thread overview]
Message-ID: <bug-66768-4-PU4q3JFaXo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66768-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66768
--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 7 Jul 2015, amker at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66768
>
> --- Comment #8 from amker at gcc dot gnu.org ---
> So address space info is kept and checked in base object's type of MEM_REF. As
> in function expand_expr_real_1:
>
> case TARGET_MEM_REF:
> {
> addr_space_t as
> = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))));
> enum insn_code icode;
> unsigned int align;
>
> The AVR ICE happens when base of MEM_REF[base:0, index:(sizetype)ivtmp] has
> __memx address space attribute. Since pointer to memory object in __memx
> address space (PSImode) has 24 bits type length, while the type of index is
> sizetype(Pmode == HImode in this case), which has 16 bits type length. The
> expression "(sizetype)ivtmp" is expanded into (subreg:HI (reg:PSI 40) 0).
>
> So I still think IVO should distribute ivtmp as base part of MEM_REF since it
> stands for a memory object. Otherwise, we have below IVOed code:
>
> <bb 3>:
> # total_10 = PHI <total_5(4), 0(2)>
> # ivtmp.7_8 = PHI <ivtmp.7_7(4), 4660(2)>
> _12 = (sizetype) ivtmp.7_8;
> _4 = MEM[base: 0B, index: _12, offset: 0B];
> total_5 = _4 + total_10;
> ivtmp.7_7 = ivtmp.7_8 + 2;
> if (ivtmp.7_7 != 4700)
> goto <bb 4>;
> else
> goto <bb 5>;
>
> <bb 4>:
> goto <bb 3>;
>
>
> This is wrong since truncation of ivtmp.7_8 to sizetype could result in wrong
> address.
Indeed truncating it to sizetype just to make it fit into INDEX
looks wrong (extension is ok, truncation is not).
next prev parent reply other threads:[~2015-07-07 11:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-05 17:29 [Bug c/66768] New: __seg_fs and __seg_gs: issue when adding address space support arigo at tunes dot org
2015-07-05 17:37 ` [Bug c/66768] " arigo at tunes dot org
2015-07-05 18:00 ` arigo at tunes dot org
2015-07-06 7:08 ` [Bug tree-optimization/66768] " rguenth at gcc dot gnu.org
2015-07-06 7:39 ` amker at gcc dot gnu.org
2015-07-07 3:24 ` amker at gcc dot gnu.org
2015-07-07 8:29 ` [Bug tree-optimization/66768] address space gets lost on literal pointer rguenth at gcc dot gnu.org
2015-07-07 8:43 ` amker at gcc dot gnu.org
2015-07-07 11:17 ` amker at gcc dot gnu.org
2015-07-07 11:20 ` rguenther at suse dot de [this message]
2015-07-20 18:44 ` gjl 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-66768-4-PU4q3JFaXo@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).