public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
@ 2024-01-17 20:33 zsojka at seznam dot cz
2024-01-18 8:14 ` [Bug tree-optimization/113459] " rguenth at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-17 20:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
Bug ID: 113459
Summary: ICE: in as_a, at machmode.h:381 with memset() on a
_BitInt() at -O1 and above
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 57119
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57119&action=edit
reduced testcase
Compiler output:
$ cc1 -quiet -O testcase.c
during GIMPLE pass: fre
testcase.c: In function 'foo':
testcase.c:8:1: internal compiler error: in as_a, at machmode.h:381
8 | }
| ^
0x876149 scalar_int_mode as_a<scalar_int_mode>(machine_mode)
/repo/gcc-trunk/gcc/machmode.h:381
0x876149 scalar_int_mode as_a<scalar_int_mode>(machine_mode)
/repo/gcc-trunk/gcc/machmode.h:379
0x876149 vn_reference_lookup_3
/repo/gcc-trunk/gcc/tree-ssa-sccvn.cc:2972
0x16226f7 walk_non_aliased_vuses(ao_ref*, tree_node*, bool, void* (*)(ao_ref*,
tree_node*, void*), void* (*)(ao_ref*, tree_node*, void*, translate_flags*),
tree_node* (*)(tree_node*), unsigned int&, void*)
/repo/gcc-trunk/gcc/tree-ssa-alias.cc:3914
0x171a4ef vn_reference_lookup(tree_node*, tree_node*, vn_lookup_kind,
vn_reference_s**, bool, tree_node**, tree_node*, bool)
/repo/gcc-trunk/gcc/tree-ssa-sccvn.cc:4023
0x171e7e7 visit_reference_op_load
/repo/gcc-trunk/gcc/tree-ssa-sccvn.cc:5740
0x171e7e7 visit_stmt
/repo/gcc-trunk/gcc/tree-ssa-sccvn.cc:6261
0x171ee6b process_bb
/repo/gcc-trunk/gcc/tree-ssa-sccvn.cc:8025
0x1720846 do_rpo_vn_1
/repo/gcc-trunk/gcc/tree-ssa-sccvn.cc:8626
0x17223bb execute
/repo/gcc-trunk/gcc/tree-ssa-sccvn.cc:8787
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.
$ xgcc -v
Using built-in specs.
COLLECT_GCC=/repo/build-gcc-trunk-amd64A/gcc/xgcc
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-8193-20240117105849-g3340878009a-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240117 (experimental) (GCC)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
@ 2024-01-18 8:14 ` rguenth at gcc dot gnu.org
2024-01-18 8:20 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-18 8:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Last reconfirmed| |2024-01-18
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
We're relying on INTEGRAL_TYPE_P (vr->type) -> vr->type has integer mode.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
2024-01-18 8:14 ` [Bug tree-optimization/113459] " rguenth at gcc dot gnu.org
@ 2024-01-18 8:20 ` rguenth at gcc dot gnu.org
2024-01-18 9:34 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-18 8:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|rguenth at gcc dot gnu.org |unassigned at gcc dot gnu.org
Status|ASSIGNED |NEW
CC| |rguenth at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
unsigned buflen = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (vr->type)) +
1;
if (INTEGRAL_TYPE_P (vr->type))
buflen = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (vr->type)) + 1;
there's other spots using the pattern
if (INTEGRAL_TYPE_P (type))
sz = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type));
I wonder when GET_MODE_SIZE differs from TYPE_SIZE_UNIT? PSImode?
Packed bitfields? r10-6885-g5f9cd512c42786 added the INTEGRAL_TYPE_P
special-casing we now run into with the TYPE_SIZE_UNIT code being there
before.
Jakub, do you remember?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
2024-01-18 8:14 ` [Bug tree-optimization/113459] " rguenth at gcc dot gnu.org
2024-01-18 8:20 ` rguenth at gcc dot gnu.org
@ 2024-01-18 9:34 ` jakub at gcc dot gnu.org
2024-01-18 10:06 ` rguenther at suse dot de
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-18 9:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> unsigned buflen = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (vr->type))
> + 1;
> if (INTEGRAL_TYPE_P (vr->type))
> buflen = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (vr->type)) + 1;
>
> there's other spots using the pattern
>
> if (INTEGRAL_TYPE_P (type))
> sz = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type));
>
> I wonder when GET_MODE_SIZE differs from TYPE_SIZE_UNIT? PSImode?
I'm afraid I don't know either.
> Packed bitfields? r10-6885-g5f9cd512c42786 added the INTEGRAL_TYPE_P
> special-casing we now run into with the TYPE_SIZE_UNIT code being there
> before.
>
> Jakub, do you remember?
I bet the above comes from what the native_{encode,interpret}_int has been
doing (and which has been tweaked for BITINT_TYPE).
If we don't want to throw it away, we could just change it to
if (INTEGRAL_TYPE_P (...) && TYPE_MODE (...) != BLKmode)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
` (2 preceding siblings ...)
2024-01-18 9:34 ` jakub at gcc dot gnu.org
@ 2024-01-18 10:06 ` rguenther at suse dot de
2024-01-18 11:45 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenther at suse dot de @ 2024-01-18 10:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 18 Jan 2024, jakub at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
>
> --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #2)
> > unsigned buflen = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (vr->type))
> > + 1;
> > if (INTEGRAL_TYPE_P (vr->type))
> > buflen = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (vr->type)) + 1;
> >
> > there's other spots using the pattern
> >
> > if (INTEGRAL_TYPE_P (type))
> > sz = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type));
> >
> > I wonder when GET_MODE_SIZE differs from TYPE_SIZE_UNIT? PSImode?
>
> I'm afraid I don't know either.
>
> > Packed bitfields? r10-6885-g5f9cd512c42786 added the INTEGRAL_TYPE_P
> > special-casing we now run into with the TYPE_SIZE_UNIT code being there
> > before.
> >
> > Jakub, do you remember?
>
> I bet the above comes from what the native_{encode,interpret}_int has been
> doing (and which has been tweaked for BITINT_TYPE).
> If we don't want to throw it away, we could just change it to
> if (INTEGRAL_TYPE_P (...) && TYPE_MODE (...) != BLKmode)
Yeah, that might work. There are a few occurances in tree-ssa-sccvn.cc
that need such adjustment.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
` (3 preceding siblings ...)
2024-01-18 10:06 ` rguenther at suse dot de
@ 2024-01-18 11:45 ` jakub at gcc dot gnu.org
2024-01-19 9:02 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-18 11:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
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 #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57137
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57137&action=edit
gcc14-pr113459.patch
Untested fix.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
` (4 preceding siblings ...)
2024-01-18 11:45 ` jakub at gcc dot gnu.org
@ 2024-01-19 9:02 ` cvs-commit at gcc dot gnu.org
2024-01-19 9:05 ` jakub at gcc dot gnu.org
2024-01-20 17:07 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-19 9:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
--- 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:dcd5601c2b7298155c9a8e1bfb93ee8e952eca0b
commit r14-8276-gdcd5601c2b7298155c9a8e1bfb93ee8e952eca0b
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Jan 19 10:00:16 2024 +0100
sccvn: Don't use SCALAR_INT_TYPE_MODE on BLKmode BITINT_TYPEs [PR113459]
sccvn uses GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)) for INTEGER_TYPEs,
most likely because that is what native_{interpret,encode}_int used.
This obviously doesn't work for larger BITINT_TYPEs which have BLKmode
and the above ICEs on those. native_{interpret,encode}_int checks whether
the BITINT_TYPE is medium/large/huge (i.e. an array of 2+ ABI limbs)
and uses TYPE_SIZE_UNIT for that case, otherwise SCALAR_INT_TYPE_MODE like
for the INTEGER_TYPE case.
The following patch instead just uses SCALAR_INT_TYPE_MODE for non-BLKmode
TYPE_MODE and TYPE_SIZE_UNIT otherwise.
2024-01-19 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/113459
* tree-ssa-sccvn.cc (vn_walk_cb_data::push_partial_def): Use
TREE_INT_CST_LOW of TYPE_SIZE_UNIT rather than GET_MODE_SIZE
of SCALAR_INT_TYPE_MODE if type has BLKmode.
(vn_reference_lookup_3): Likewise. Formatting fix.
* gcc.dg/bitint-73.c: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
` (5 preceding siblings ...)
2024-01-19 9:02 ` cvs-commit at gcc dot gnu.org
@ 2024-01-19 9:05 ` jakub at gcc dot gnu.org
2024-01-20 17:07 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-19 9:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
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] 9+ messages in thread
* [Bug tree-optimization/113459] ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
` (6 preceding siblings ...)
2024-01-19 9:05 ` jakub at gcc dot gnu.org
@ 2024-01-20 17:07 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 17:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113459
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-01-20 17:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17 20:33 [Bug tree-optimization/113459] New: ICE: in as_a, at machmode.h:381 with memset() on a _BitInt() at -O1 and above zsojka at seznam dot cz
2024-01-18 8:14 ` [Bug tree-optimization/113459] " rguenth at gcc dot gnu.org
2024-01-18 8:20 ` rguenth at gcc dot gnu.org
2024-01-18 9:34 ` jakub at gcc dot gnu.org
2024-01-18 10:06 ` rguenther at suse dot de
2024-01-18 11:45 ` jakub at gcc dot gnu.org
2024-01-19 9:02 ` cvs-commit at gcc dot gnu.org
2024-01-19 9:05 ` jakub at gcc dot gnu.org
2024-01-20 17:07 ` 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).