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 sanitizer/109594] [14 Regression] ICE verify_gimple failed with ASAN since r14-67-g2c800ed8d59cff
Date: Mon, 24 Apr 2023 09:28:40 +0000	[thread overview]
Message-ID: <bug-109594-4-Hw4HTJqTmD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109594-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
This goes wrong in update_address_taken before into-SSA which removes
TREE_ADDRESSABLE from 'v' without transforming it in any way.

<bb 2> :
D.3193 = VIEW_CONVERT_EXPR<int[4]>(v)[18446744073709551615];
return D.3193;

update_address_taken uses maybe_rewrite_mem_ref_base to rewrite rvalues
but that leaves all outer handled components in place - in fact it
even puts a VIEW_CONVERT_EXPR around it.

For a "valid" testcase

typedef int v4si __attribute__((vector_size(16)));

int foo (v4si v)
{
  return v[1];
}

the frontend produces

  return VIEW_CONVERT_EXPR<int[4]>(v)[1];

and we then gimplify it to

  D.2755 = BIT_FIELD_REF <v, 32, 32>;

via folding the stmt and maybe_canonicalize_mem_ref_addr, but we refrain from
doing that for out-of-bound accesses.

We do not have good IL verification for the differences between valid GIMPLE
and valid GIMPLE SSA - verify_gimple_* verifies GIMPLE and verify_ssa
doesn't apply any additional IL constraints.

I think we do not want ARRAY_REF of SSA_NAMEs nor do we want multi-level
handled_components on SSA_NAMEs.

Either we have to be way more aggressive in rewriting the refs
(use get_ref_base_and_extent?) to BIT_FIELD_REFs or in this case to
in-bound refs or zero or we have to restrict the rewrite to the cases
we already handle (which is very few special cases around MEM_REF[&decl]).

I'm trying to see what doing the latter regresses.

  parent reply	other threads:[~2023-04-24  9:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-22 12:10 [Bug sanitizer/109594] New: [14 Regression] ICE verify_gimple failed since r14-67-g2c800ed8d59cff with ASAN marxin at gcc dot gnu.org
2023-04-24  7:04 ` [Bug sanitizer/109594] [14 Regression] ICE verify_gimple failed with ASAN since r14-67-g2c800ed8d59cff rguenth at gcc dot gnu.org
2023-04-24  9:28 ` rguenth at gcc dot gnu.org [this message]
2023-04-27  8:38 ` cvs-commit at gcc dot gnu.org
2023-04-27  8:38 ` rguenth at gcc dot gnu.org
2023-04-27  8:38 ` cvs-commit at gcc dot gnu.org
2023-04-27 10:31 ` rguenth 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-109594-4-Hw4HTJqTmD@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).