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 debug/112878] ICE: in ctf_add_slice, at ctfc.cc:499 with _BitInt > 255 in a struct and -gctf1
Date: Thu, 11 Apr 2024 00:32:39 +0000	[thread overview]
Message-ID: <bug-112878-4-LncFDPm9xZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112878-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Indu Bhagat <ibhagat@gcc.gnu.org>:

https://gcc.gnu.org/g:5c869aa8a4538b218d9e59de6c96133971e7b965

commit r14-9906-g5c869aa8a4538b218d9e59de6c96133971e7b965
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Wed Apr 10 17:27:52 2024 -0700

    ctf: fix PR debug/112878

    PR debug/112878: ICE: in ctf_add_slice, at ctfc.cc:499 with
    _BitInt > 255 in a struct and -gctf1

    The CTF generation in GCC does not have a mechanism to roll-back an
    already added type.  In this testcase presented in the PR, we hit a
    representation limit in CTF slices (for a member of a struct) and ICE,
    after the type for struct (CTF_K_STRUCT) has already been added to the
    container.

    To exit gracefully instead, we now check for both the offset and size of
    the bitfield to be explicitly <= 255.  If the check fails, we emit the
    member with type CTF_K_UNKNOWN.  Note that, the value 255 stems from the
    existing binutils libctf checks which were motivated to guard against
    malformed inputs.

    Although it is not accurate to say that this is a CTF representation
    limit, mark the code with TBD_CTF_REPRESENTATION_LIMIT for now so that
    this can be taken care of with the next format version bump, when
    libctf's checks for the slice data can be lifted as well.

    gcc/ChangeLog:
            PR debug/112878
            * dwarf2ctf.cc (gen_ctf_sou_type): Check for conditions before
            call to ctf_add_slice.  Use CTF_K_UNKNOWN type if fail.

    gcc/testsuite/ChangeLog:
            PR debug/112878
            * gcc.dg/debug/ctf/ctf-bitfields-5.c: New test.

      parent reply	other threads:[~2024-04-11  0:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 10:51 [Bug debug/112878] New: ICE: in ctf_add_slice, at ctfc.cc:499 with -std=c23 -gctf1 iamanonymous.cs at gmail dot com
2024-01-19 15:57 ` [Bug c/112878] " zsojka at seznam dot cz
2024-01-20  9:02 ` [Bug debug/112878] " pinskia at gcc dot gnu.org
2024-04-09 18:34 ` [Bug debug/112878] ICE: in ctf_add_slice, at ctfc.cc:499 with _BitInt > 255 in a struct and -gctf1 ibhagat at gcc dot gnu.org
2024-04-09 18:44 ` pinskia at gcc dot gnu.org
2024-04-09 21:18 ` ibhagat at gcc dot gnu.org
2024-04-11  0:32 ` cvs-commit at gcc dot gnu.org [this message]

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-112878-4-LncFDPm9xZ@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).