public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113410] New: ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length
@ 2024-01-15 20:58 zsojka at seznam dot cz
2024-01-16 0:04 ` [Bug middle-end/113410] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-15 20:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113410
Bug ID: 113410
Summary: ICE: in maybe_check_access_sizes, at
gimple-ssa-warn-access.cc:3423 with _BitInt() used as
array length
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
CC: jakub at gcc dot gnu.org
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 57096
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57096&action=edit
reduced testcase
This is reduced from gcc.dg/builtin-dynamic-object-size-20.c, when testsuite is
run with -Dint=_BitInt($RANDOM)
Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c
during GIMPLE pass: waccess
testcase.c: In function 'foo':
testcase.c:4:1: internal compiler error: in maybe_check_access_sizes, at
gimple-ssa-warn-access.cc:3423
4 | foo (int n)
| ^~~
0x783992 maybe_check_access_sizes
/repo/gcc-trunk/gcc/gimple-ssa-warn-access.cc:3423
0x1186c57 check_call_access
/repo/gcc-trunk/gcc/gimple-ssa-warn-access.cc:3644
0x1186c57 check_call
/repo/gcc-trunk/gcc/gimple-ssa-warn-access.cc:4351
0x1186c57 check_block
/repo/gcc-trunk/gcc/gimple-ssa-warn-access.cc:4434
0x1186c57 execute
/repo/gcc-trunk/gcc/gimple-ssa-warn-access.cc:4769
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-7255-20240115165927-g6c703b4eb68-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-7255-20240115165927-g6c703b4eb68-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240115 (experimental) (GCC)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/113410] ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length
2024-01-15 20:58 [Bug tree-optimization/113410] New: ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length zsojka at seznam dot cz
@ 2024-01-16 0:04 ` pinskia at gcc dot gnu.org
2024-01-16 18:34 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-16 0:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113410
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic, ice-checking
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-01-16
Component|tree-optimization |middle-end
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
The assert that is being triggered:
```
char sizstr[80];
...
gcc_checking_assert (strlen (s0) + strlen (s1)
< sizeof sizstr - 4);
sprintf (sizstr, "[%.37s, %.37s]", s0, s1);
```
Yes the size of the array is too small to print out the values now ...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/113410] ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length
2024-01-15 20:58 [Bug tree-optimization/113410] New: ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length zsojka at seznam dot cz
2024-01-16 0:04 ` [Bug middle-end/113410] " pinskia at gcc dot gnu.org
@ 2024-01-16 18:34 ` jakub at gcc dot gnu.org
2024-01-17 12:57 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-16 18:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113410
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57105
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57105&action=edit
gcc14-pr113410.patch
Untested fix.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/113410] ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length
2024-01-15 20:58 [Bug tree-optimization/113410] New: ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length zsojka at seznam dot cz
2024-01-16 0:04 ` [Bug middle-end/113410] " pinskia at gcc dot gnu.org
2024-01-16 18:34 ` jakub at gcc dot gnu.org
@ 2024-01-17 12:57 ` cvs-commit at gcc dot gnu.org
2024-01-17 12:58 ` jakub at gcc dot gnu.org
2024-01-20 17:11 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-17 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113410
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:a98a24ac65c1a0ee598e5b54d9e4c921a9744a08
commit r14-8185-ga98a24ac65c1a0ee598e5b54d9e4c921a9744a08
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Jan 17 13:57:07 2024 +0100
gimple-ssa-warn-access: Cast huge params to sizetype before using them in
maybe_check_access_sizes [PR113410]
WHen a VLA is created with some very high precision size expression
(say __int128, or _BitInt(65535) etc.), we cast it to sizetype, because
we can't have arrays longer than what can be expressed in sizetype.
But the maybe_check_access_sizes code when trying to determine ranges
wasn't doing this but was using fixed buffers for the sizes. While
__int128 could still be handled (fit into the buffers), obviously
arbitrary _BitInt parameter ranges can't, they can be in the range of
up to almost 20KB per number. It doesn't make sense to print such
ranges though, no array can be larger than sizetype precision, and
ranger's range_of_expr can handle NOP_EXPRs/CONVERT_EXPRs wrapping a
PARM_DECL just fine, so the following patch just casts the excessively
large counters for the range determination purposes to sizetype.
2024-01-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/113410
* gimple-ssa-warn-access.cc
(pass_waccess::maybe_check_access_sizes):
If access_nelts is integral with larger precision than sizetype,
fold_convert it to sizetype.
* gcc.dg/bitint-72.c: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/113410] ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length
2024-01-15 20:58 [Bug tree-optimization/113410] New: ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length zsojka at seznam dot cz
` (2 preceding siblings ...)
2024-01-17 12:57 ` cvs-commit at gcc dot gnu.org
@ 2024-01-17 12:58 ` jakub at gcc dot gnu.org
2024-01-20 17:11 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-17 12:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113410
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/113410] ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length
2024-01-15 20:58 [Bug tree-optimization/113410] New: ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length zsojka at seznam dot cz
` (3 preceding siblings ...)
2024-01-17 12:58 ` jakub at gcc dot gnu.org
@ 2024-01-20 17:11 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 17:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113410
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-20 17:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15 20:58 [Bug tree-optimization/113410] New: ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length zsojka at seznam dot cz
2024-01-16 0:04 ` [Bug middle-end/113410] " pinskia at gcc dot gnu.org
2024-01-16 18:34 ` jakub at gcc dot gnu.org
2024-01-17 12:57 ` cvs-commit at gcc dot gnu.org
2024-01-17 12:58 ` jakub at gcc dot gnu.org
2024-01-20 17:11 ` pinskia at gcc dot gnu.org
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).