public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
@ 2024-01-31 21:20 zsojka at seznam dot cz
2024-01-31 21:25 ` [Bug tree-optimization/113692] " pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-31 21:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
Bug ID: 113692
Summary: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at
-O with _BitInt() in a condition
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
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 57273
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57273&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c -O
during GIMPLE pass: bitintlower
testcase.c: In function 'foo':
testcase.c:4:1: internal compiler error: in lower_stmt, at
gimple-lower-bitint.cc:5444
4 | foo(void)
| ^~~
0xd8cab5 lower_stmt
/repo/gcc-trunk/gcc/gimple-lower-bitint.cc:5444
0x2720009 gimple_lower_bitint
/repo/gcc-trunk/gcc/gimple-lower-bitint.cc:6564
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-8665-20240131161256-g3fed1609f61-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-8665-20240131161256-g3fed1609f61-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240131 (experimental) (GCC)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/113692] ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
@ 2024-01-31 21:25 ` pinskia at gcc dot gnu.org
2024-01-31 21:50 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-31 21:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
My bet you could get the same error with:
_BitInt(129) i;
void *
foo(void)
{
void *ret = 0;
ret = (void *)(__SIZETYPE__)(i & 1);
return ret;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/113692] ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
2024-01-31 21:25 ` [Bug tree-optimization/113692] " pinskia at gcc dot gnu.org
@ 2024-01-31 21:50 ` pinskia at gcc dot gnu.org
2024-02-01 7:48 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-31 21:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-01-31
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> My bet you could get the same error with:
> _BitInt(129) i;
>
> void *
> foo(void)
> {
> void *ret = 0;
> ret = (void *)(__SIZETYPE__)(i & 1);
> return ret;
> }
the above works.
The question is there an extra cast in the IR between _BitInt and void*
required or not?
PHIOPT/match-and-simplify does:
```
phiopt match-simplify trying:
_2 != 0 ? 1B : 0B
Matching expression match.pd:2274, gimple-match-3.cc:23
Matching expression match.pd:2823, gimple-match-2.cc:35
Matching expression match.pd:2826, gimple-match-1.cc:66
Matching expression match.pd:2833, gimple-match-2.cc:96
Matching expression match.pd:2274, gimple-match-3.cc:23
Applying pattern match.pd:3396, gimple-match-6.cc:2527
Applying pattern match.pd:5327, gimple-match-9.cc:17991
phiopt match-simplify back:
_5 = _2 != 0;
_6 = (void *) _2;
result: _6
```
Notice how there is just cast a between _2 and `void*`.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/113692] ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
2024-01-31 21:25 ` [Bug tree-optimization/113692] " pinskia at gcc dot gnu.org
2024-01-31 21:50 ` pinskia at gcc dot gnu.org
@ 2024-02-01 7:48 ` rguenth at gcc dot gnu.org
2024-02-01 11:03 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-01 7:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
integer to pointer conversions are not constrained in GIMPLE, only
pointer-to-int widening conversions are.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/113692] ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
` (2 preceding siblings ...)
2024-02-01 7:48 ` rguenth at gcc dot gnu.org
@ 2024-02-01 11:03 ` jakub at gcc dot gnu.org
2024-02-01 11:30 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-01 11:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
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 #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57280
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57280&action=edit
gcc14-pr113692.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/113692] ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
` (3 preceding siblings ...)
2024-02-01 11:03 ` jakub at gcc dot gnu.org
@ 2024-02-01 11:30 ` jakub at gcc dot gnu.org
2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
2024-02-02 10:34 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-01 11:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 113691 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/113692] ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
` (4 preceding siblings ...)
2024-02-01 11:30 ` jakub at gcc dot gnu.org
@ 2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
2024-02-02 10:34 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-02 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
--- Comment #6 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:fb28d5cdae149f08f0d472c210a5143a64771410
commit r14-8747-gfb28d5cdae149f08f0d472c210a5143a64771410
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Feb 2 11:28:31 2024 +0100
lower-bitint: Handle casts from large/huge _BitInt to pointer/reference
types [PR113692]
I thought one needs to cast first to pointer-sized integer before casting
to
pointer, but apparently that is not the case.
So the following patch arranges for the large/huge _BitInt to
pointer/reference conversions to use the same code as for conversions
of them to small integral types.
2024-02-02 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/113692
* gimple-lower-bitint.cc (bitint_large_huge::lower_stmt): Handle
casts
from large/huge BITINT_TYPEs to POINTER_TYPE/REFERENCE_TYPE as
final_cast_p.
* gcc.dg/bitint-82.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/113692] ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
` (5 preceding siblings ...)
2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
@ 2024-02-02 10:34 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-02 10:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113692
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-02-02 10:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-31 21:20 [Bug tree-optimization/113692] New: ICE: in lower_stmt, at gimple-lower-bitint.cc:5444 at -O with _BitInt() in a condition zsojka at seznam dot cz
2024-01-31 21:25 ` [Bug tree-optimization/113692] " pinskia at gcc dot gnu.org
2024-01-31 21:50 ` pinskia at gcc dot gnu.org
2024-02-01 7:48 ` rguenth at gcc dot gnu.org
2024-02-01 11:03 ` jakub at gcc dot gnu.org
2024-02-01 11:30 ` jakub at gcc dot gnu.org
2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
2024-02-02 10:34 ` jakub 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).