public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/108543] [10/11/12/13 Regression] ICE in build_call_expr_loc_array, at tree.cc:10686
Date: Thu, 26 Jan 2023 18:39:38 +0000	[thread overview]
Message-ID: <bug-108543-4-jMZFSzLg13@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108543-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:786923f74d6adfaf572f3d7c0307c51c522567f9

commit r12-9071-g786923f74d6adfaf572f3d7c0307c51c522567f9
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Jan 25 17:19:54 2023 -0500

    opts: SANITIZE_ADDRESS wrongly cleared [PR108543]

    Here we crash on a null fndecl ultimately because we haven't defined
    the built-ins described in sanitizer.def.  So
    builtin_decl_explicit (BUILT_IN_ASAN_POINTER_SUBTRACT);
    returns NULL_TREE, causing an ICE later.

    DEF_SANITIZER_BUILTIN only actually defines the built-ins when
flag_sanitize
    has SANITIZE_ADDRESS, or some of the other SANITIZE_*, but it doesn't check
    SANITIZE_KERNEL_ADDRESS or SANITIZE_USER_ADDRESS.  Unfortunately, with
    -fsanitize=address -fno-sanitize=kernel-address
    or
    -fsanitize=kernel-address -fno-sanitize=address
    SANITIZE_ADDRESS ends up being unset from flag_sanitize even though
    _USER/_KERNEL are set.  That's because -fsanitize=address means
    SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS and -fsanitize=kernel-address
    is SANITIZE_ADDRESS | SANITIZE_KERNEL_ADDRESS but parse_sanitizer_options
    does
      flags &= ~sanitizer_opts[i].flag;
    so the subsequent -fno- unsets SANITIZE_ADDRESS.  Then no sanitizer
    built-ins are actually defined.

    I'm not sure why SANITIZE_ADDRESS isn't just SANITIZE_USER_ADDRESS |
    SANITIZE_KERNEL_ADDRESS, I don't think we need 3 bits.

            PR middle-end/108543

    gcc/ChangeLog:

            * opts.cc (parse_sanitizer_options): Don't always clear
SANITIZE_ADDRESS
            if it was previously set.

    gcc/testsuite/ChangeLog:

            * c-c++-common/asan/pointer-subtract-5.c: New test.
            * c-c++-common/asan/pointer-subtract-6.c: New test.
            * c-c++-common/asan/pointer-subtract-7.c: New test.
            * c-c++-common/asan/pointer-subtract-8.c: New test.

    (cherry picked from commit a82ce9c8d155ecda2d1c647d5c588f29e21ef4a3)

  parent reply	other threads:[~2023-01-26 18:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 17:47 [Bug c++/108543] New: " gscfq@t-online.de
2023-01-25 18:30 ` [Bug c++/108543] [10/11/12/13 Regression] " mpolacek at gcc dot gnu.org
2023-01-25 18:46 ` mpolacek at gcc dot gnu.org
2023-01-25 18:49 ` mpolacek at gcc dot gnu.org
2023-01-25 19:27 ` mpolacek at gcc dot gnu.org
2023-01-26 17:59 ` [Bug middle-end/108543] " cvs-commit at gcc dot gnu.org
2023-01-26 18:39 ` cvs-commit at gcc dot gnu.org [this message]
2023-01-26 18:46 ` [Bug middle-end/108543] [10/11 " mpolacek 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-108543-4-jMZFSzLg13@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).