public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/91146] [9/10 Regression] -Werror=array-bounds if compile with -fsanitize=address
Date: Tue, 17 Mar 2020 16:43:32 +0000	[thread overview]
Message-ID: <bug-91146-4-u2s8jAGLy1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-91146-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems even with that patch
3677              if (stmt_may_clobber_ref_p_1 (def_stmt, ref, tbaa_p))
in tree-ssa-sccvn.c thinks the
  .ASAN_MARK (UNPOISON, &D.48886, 4);
call may clobber
MEM[(struct small_vector_template_common *)&v].D.48455.BeginX
With the following completely untested patch we optimize like withouf
-fsanitize=address and don't warn.
--- gcc/internal-fn.def.jj      2020-01-18 13:47:09.517357706 +0100
+++ gcc/internal-fn.def 2020-03-17 16:32:41.210800195 +0100
@@ -309,7 +309,7 @@ DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_
 DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL)
 DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, "..R..")
-DEF_INTERNAL_FN (ASAN_MARK, ECF_LEAF | ECF_NOTHROW, NULL)
+DEF_INTERNAL_FN (ASAN_MARK, ECF_LEAF | ECF_NOTHROW, "..W.")
 DEF_INTERNAL_FN (ASAN_POISON, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
 DEF_INTERNAL_FN (ASAN_POISON_USE, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
 DEF_INTERNAL_FN (ADD_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
--- gcc/tree-ssa-alias.c.jj     2020-03-03 11:04:46.367821907 +0100
+++ gcc/tree-ssa-alias.c        2020-03-17 17:40:22.295385869 +0100
@@ -3032,6 +3032,14 @@ call_may_clobber_ref_p_1 (gcall *call, a
        default:
          /* Fallthru to general call handling.  */;
       }
+  else if (gimple_call_internal_p (call)
+          && gimple_call_internal_fn (call) == IFN_ASAN_MARK)
+    {
+      ao_ref dref;
+      tree size = gimple_call_arg (call, 2);
+      ao_ref_init_from_ptr_and_size (&dref, gimple_call_arg (call, 1), size);
+      return refs_may_alias_p_1 (&dref, ref, false);
+    }

   /* Check if base is a global static variable that is not written
      by the function.  */

  parent reply	other threads:[~2020-03-17 16:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-91146-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:58 ` jakub at gcc dot gnu.org
2020-03-17 15:29 ` jakub at gcc dot gnu.org
2020-03-17 15:40 ` jakub at gcc dot gnu.org
2020-03-17 15:43 ` jakub at gcc dot gnu.org
2020-03-17 16:43 ` jakub at gcc dot gnu.org [this message]
2020-03-18  7:41 ` jakub at gcc dot gnu.org
2020-03-18  9:45 ` jakub at gcc dot gnu.org
2020-04-29 17:42 ` law at redhat dot com
2021-06-01  8:14 ` [Bug middle-end/91146] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-05-27  9:41 ` [Bug middle-end/91146] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:37 ` jakub at gcc dot gnu.org
2023-07-07 10:35 ` [Bug middle-end/91146] [11/12/13/14 " 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-91146-4-u2s8jAGLy1@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).