public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/109828] [13/14 Regression] C2x:static compound literal (with flexible array) in initializer leads to invalid size and ICE
Date: Fri, 12 May 2023 19:16:10 +0000	[thread overview]
Message-ID: <bug-109828-4-P30RxFhY2a@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109828-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Yann Droneaud from comment #4)
> I'm still playing with this, for example https://godbolt.org/z/dfjr8veh5,
> and I've noticed the size of the compound_initializer is incorrect too:
> Maybe it's the result of computing the size as 3 + -3 + 1, but it's far
> fetched.

Yes the .size is wrong. But it does not matter much as the ICE on the trunk is
definitely showing there are more issues.

Also yes the ICE is due to checking being enabled:
          gcc_checking_assert (check_string_literal (exp, size));

static bool
check_string_literal (tree string, unsigned HOST_WIDE_INT size)
{
  tree type = TREE_TYPE (string);
  tree eltype = TREE_TYPE (type);
  unsigned HOST_WIDE_INT elts = tree_to_uhwi (TYPE_SIZE_UNIT (eltype));
  unsigned HOST_WIDE_INT mem_size = tree_to_uhwi (TYPE_SIZE_UNIT (type));


The ICE is in that last tree_to_uhwi .

  parent reply	other threads:[~2023-05-12 19:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 12:42 [Bug c/109828] New: " yann at droneaud dot fr
2023-05-12 12:54 ` [Bug c/109828] " yann at droneaud dot fr
2023-05-12 14:32 ` yann at droneaud dot fr
2023-05-12 18:41 ` [Bug c/109828] [13/14 Regression] " pinskia at gcc dot gnu.org
2023-05-12 19:10 ` yann at droneaud dot fr
2023-05-12 19:16 ` pinskia at gcc dot gnu.org [this message]
2023-05-12 20:43 ` pinskia at gcc dot gnu.org
2023-05-15  6:47 ` [Bug c/109828] [13/14 Regression] static compound literal with flexible array " rguenth at gcc dot gnu.org
2023-05-15 12:38 ` yann at droneaud dot fr
2023-05-15 16:30 ` yann at droneaud dot fr
2023-07-27  9:26 ` rguenth at gcc dot gnu.org
2023-08-27 20:00 ` pinskia at gcc dot gnu.org
2024-01-10 17:28 ` jamborm at gcc dot gnu.org
2024-01-12 11:58 ` rguenth at gcc dot gnu.org
2024-05-21  9:15 ` [Bug c/109828] [13/14/15 " jakub 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-109828-4-P30RxFhY2a@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).