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 sanitizer/95693] [8/9 Regression] Incorrect error from undefined behavior sanitizer
Date: Thu, 22 Apr 2021 16:49:59 +0000	[thread overview]
Message-ID: <bug-95693-4-cKq8HB4kRD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95693-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:a3458b238e1297ad7ab6f92ab1a00837f282691a

commit r8-10875-ga3458b238e1297ad7ab6f92ab1a00837f282691a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 22 19:03:23 2021 +0100

    c++: Fix up ubsan false positives on references [PR95693]

    Alex' 2 years old change to build_zero_init_1 to return NULL pointer with
    reference type for references breaks the sanitizers, the assignment of NULL
    to a reference typed member is then instrumented before it is overwritten
    with a non-NULL address later on.
    That change has been done to fix error recovery ICE during
    process_init_constructor_record, where we:
              if (TYPE_REF_P (fldtype))
                {
                  if (complain & tf_error)
                    error ("member %qD is uninitialized reference", field);
                  else
                    return PICFLAG_ERRONEOUS;
                }
    a few lines earlier, but then continue and ICE when build_zero_init returns
    NULL.

    The following patch reverts the build_zero_init_1 change and instead
creates
    the NULL with reference type constants during the error recovery.

    The pr84593.C testcase Alex' change was fixing still works as before.

    2021-01-22  Jakub Jelinek  <jakub@redhat.com>

            PR sanitizer/95693
            * init.c (build_zero_init_1): Revert the 2018-03-06 change to
            return build_zero_cst for reference types.
            * typeck2.c (process_init_constructor_record): Instead call
            build_zero_cst here during error recovery instead of
build_zero_init.

            * g++.dg/ubsan/pr95693.C: New test.

    (cherry picked from commit e5750f847158e7f9bdab770fd9c5fff58c5074d3)

  parent reply	other threads:[~2021-04-22 16:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  5:12 [Bug c++/95693] New: " gcc-90 at tbilles dot hu
2020-06-16  6:43 ` [Bug sanitizer/95693] [8/9/10/11 Regression] " rguenth at gcc dot gnu.org
2020-06-16  6:57 ` marxin at gcc dot gnu.org
2020-06-16  7:24 ` jakub at gcc dot gnu.org
2020-06-16  8:41 ` redi at gcc dot gnu.org
2021-01-14  9:02 ` rguenth at gcc dot gnu.org
2021-01-14 12:58 ` nathan at gcc dot gnu.org
2021-01-21 13:50 ` jakub at gcc dot gnu.org
2021-01-22 18:05 ` cvs-commit at gcc dot gnu.org
2021-01-22 18:06 ` [Bug sanitizer/95693] [8/9/10 " jakub at gcc dot gnu.org
2021-01-29 19:19 ` cvs-commit at gcc dot gnu.org
2021-01-29 19:24 ` [Bug sanitizer/95693] [8/9 " jakub at gcc dot gnu.org
2021-04-20 23:31 ` cvs-commit at gcc dot gnu.org
2021-04-22 16:49 ` cvs-commit at gcc dot gnu.org [this message]
2021-04-22 17:06 ` jakub at gcc dot gnu.org
2021-04-23 14:14 ` gcc-90 at tbilles dot hu

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-95693-4-cKq8HB4kRD@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).