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 tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
Date: Tue, 07 Jul 2020 19:02:07 +0000 [thread overview]
Message-ID: <bug-96058-4-va5CRQ7XXt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96058-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96058
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #6)
> Am I misreading it? What's mem_size?
Yes. See Martin L.'s comment, it is 10.1 release, so the line numbers are
slightly different from trunk or current 10 branch.
Obviously the two tree_to_uhwi calls guarded with tree_fits_uhwi_p can't be it,
but it is the third one.
tree eltype = TREE_TYPE (TREE_TYPE (src));
/* Support only properly NUL-terminated single byte strings. */
if (tree_to_uhwi (TYPE_SIZE_UNIT (eltype)) != 1)
return NULL;
And see #c5 on what it happens.
The string_constant code added in g:14b7950f126f doesn't try to verify that
chartype is some character or even integral type, nor whether it is a complete
type.
It actually doesn't seem correct even for wchar_t/char16_t/char32_t etc.,
because initsize is size in bytes. Nothing tries to verify tree_fits_uhwi_p
(initsize) and calls build_string_literal with the chartype and initsize
converted to uhwi.
Now, if initsize is HOST_WIDE_INT_M1U, it will do something different, and even
if not, build_string_literal assumes that the string has type chartype[size],
so whenever chartype is not a byte type, but 2/4/8 byte integer, the string
literal will have size that is twice/4/8 times larger type than desired.
next prev parent reply other threads:[~2020-07-07 19:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 9:16 [Bug tree-optimization/96058] New: " marxin at gcc dot gnu.org
2020-07-04 9:19 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
2020-07-04 14:09 ` pinskia at gcc dot gnu.org
2020-07-04 16:33 ` marxin at gcc dot gnu.org
2020-07-06 7:19 ` rguenth at gcc dot gnu.org
2020-07-07 11:51 ` marxin at gcc dot gnu.org
2020-07-07 17:59 ` msebor at gcc dot gnu.org
2020-07-07 19:02 ` jakub at gcc dot gnu.org [this message]
2020-07-08 7:04 ` marxin at gcc dot gnu.org
2020-07-15 6:54 ` [Bug tree-optimization/96058] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-07-23 6:51 ` rguenth at gcc dot gnu.org
2020-07-23 13:41 ` marxin at gcc dot gnu.org
2020-07-27 10:30 ` marxin at gcc dot gnu.org
2020-07-27 14:18 ` cvs-commit at gcc dot gnu.org
2020-07-27 14:22 ` [Bug tree-optimization/96058] [11 " marxin at gcc dot gnu.org
2020-07-28 10:37 ` cvs-commit at gcc dot gnu.org
2020-07-28 10:39 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
2020-08-18 6:47 ` asolokha at gmx dot com
2020-08-18 7:21 ` marxin at gcc dot gnu.org
2020-08-18 7:21 ` marxin 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-96058-4-va5CRQ7XXt@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).