public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl()
@ 2023-11-27 6:54 zsojka at seznam dot cz
2023-11-27 8:17 ` [Bug target/112719] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2023-11-27 6:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
Bug ID: 112719
Summary: [14 Regression] ICE: in decompose, at wide-int.h:1049
with -O -msse4 and __builtin_popcountl()
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: target
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 56693
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56693&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc -O -msse4 testcase.c
during GIMPLE pass: forwprop
testcase.c: In function 'foo':
testcase.c:5:1: internal compiler error: in decompose, at wide-int.h:1049
5 | }
| ^
0xda660c wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> >
>::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false,
false> > const&)
/repo/gcc-trunk/gcc/wide-int.h:1049
0xda6dc9 wi::int_traits<generic_wide_int<wide_int_storage> >::decompose(long*,
unsigned int, generic_wide_int<wide_int_storage> const&)
/repo/gcc-trunk/gcc/tree.h:3748
0xda6dc9 wide_int_ref_storage<true,
false>::wide_int_ref_storage<generic_wide_int<wide_int_storage>
>(generic_wide_int<wide_int_storage> const&, unsigned int)
/repo/gcc-trunk/gcc/wide-int.h:1099
0xda6dc9 generic_wide_int<wide_int_ref_storage<true, false>
>::generic_wide_int<generic_wide_int<wide_int_storage>
>(generic_wide_int<wide_int_storage> const&, unsigned int)
/repo/gcc-trunk/gcc/wide-int.h:855
0xda6dc9 wi::binary_traits<generic_wide_int<wide_int_storage>,
generic_wide_int<wide_int_storage>,
wi::int_traits<generic_wide_int<wide_int_storage> >::precision_type,
wi::int_traits<generic_wide_int<wide_int_storage>
>::precision_type>::result_type wi::bit_and<generic_wide_int<wide_int_storage>,
generic_wide_int<wide_int_storage> >(generic_wide_int<wide_int_storage> const&,
generic_wide_int<wide_int_storage> const&)
/repo/gcc-trunk/gcc/wide-int.h:2756
0xda6dc9 gimple_simplify_71(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node*, tree_node**, combined_fn)
/repo/build-gcc-trunk-amd64/gcc/gimple-match-2.cc:580
0x1af1419 gimple_simplify_PLUS_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*)
/repo/build-gcc-trunk-amd64/gcc/gimple-match-9.cc:12234
0x1b2ec8a gimple_resimplify2
/repo/gcc-trunk/gcc/gimple-match-exports.cc:1008
0x1b2f917 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
/repo/gcc-trunk/gcc/gimple-match-exports.cc:875
0x114d4ac fold_stmt_1
/repo/gcc-trunk/gcc/gimple-fold.cc:6353
0x162f7dd execute
/repo/gcc-trunk/gcc/tree-ssa-forwprop.cc:3950
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-5865-20231127072427-gb6db325ac3e-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/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-5865-20231127072427-gb6db325ac3e-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231127 (experimental) (GCC)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl()
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
@ 2023-11-27 8:17 ` rguenth at gcc dot gnu.org
2023-11-27 9:01 ` [Bug target/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557 jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-27 8:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-11-27
Target Milestone|--- |14.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Priority|P3 |P1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
2023-11-27 8:17 ` [Bug target/112719] " rguenth at gcc dot gnu.org
@ 2023-11-27 9:01 ` jakub at gcc dot gnu.org
2023-11-27 9:49 ` [Bug tree-optimization/112719] " jakub at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-27 9:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
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
CC| |jakub at gcc dot gnu.org
Summary|[14 Regression] ICE: in |[14 Regression] ICE: in
|decompose, at |decompose, at
|wide-int.h:1049 with -O |wide-int.h:1049 with -O
|-msse4 and |-msse4 and
|__builtin_popcountl() |__builtin_popcountl() since
| |r14-5557
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-5557-g6dd4c703be17fa5dd56136d067e7fdc4a61584b3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
2023-11-27 8:17 ` [Bug target/112719] " rguenth at gcc dot gnu.org
2023-11-27 9:01 ` [Bug target/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557 jakub at gcc dot gnu.org
@ 2023-11-27 9:49 ` jakub at gcc dot gnu.org
2023-11-27 10:48 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-27 9:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56694
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56694&action=edit
gcc14-pr112719.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
` (2 preceding siblings ...)
2023-11-27 9:49 ` [Bug tree-optimization/112719] " jakub at gcc dot gnu.org
@ 2023-11-27 10:48 ` jakub at gcc dot gnu.org
2023-11-28 9:15 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-27 10:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note,
int
foo (unsigned _BitInt(239) x, unsigned _BitInt(252) y)
{
x &= 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauwb;
y &= 0x555555555555555555555555555555555555555555555555555555555555555uwb;
return __builtin_popcountg (x) + __builtin_popcountg (y);
}
int
bar (unsigned _BitInt(239) x, unsigned _BitInt(252) y)
{
return __builtin_parityg (x) ^ __builtin_parityg (y);
}
regressed already with the addition of the builtins in
r14-5435-g7383cb56e1170789929201b0dadc156888928fdd. Surprisingly the second
function doesn't trigger even when there is another bug, looking for others.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
` (3 preceding siblings ...)
2023-11-27 10:48 ` jakub at gcc dot gnu.org
@ 2023-11-28 9:15 ` cvs-commit at gcc dot gnu.org
2023-11-28 9:16 ` cvs-commit at gcc dot gnu.org
2023-11-28 9:31 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-28 9:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
--- Comment #5 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:03877e7eccd2734ca93a2d13aa2abf55e0aec923
commit r14-5900-g03877e7eccd2734ca93a2d13aa2abf55e0aec923
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Nov 28 10:14:55 2023 +0100
match.pd: Fix popcount (X) + popcount (Y) simplification [PR112719]
Since my PR112566 r14-5557 changes the following testcase ICEs, because
.POPCOUNT (x) + .POPCOUNT (y) has a simplification attempted even when
x and y have incompatible types (different precisions).
Note, with _BitInt it can ICE already starting with r14-5435 and
I think as a latent problem it exists for years, because IFN_POPCOUNT
calls inherently can have different argument types and return type
is always the same.
The following patch fixes it by using widest_int during the analysis
(which is where it was ICEing) and if it is optimizable, casting to
the wider type so that bit_ior has matching argument types.
2023-11-28 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/112719
* match.pd (popcount (X) + popcount (Y) -> POPCOUNT (X | Y)): Deal
with argument types with different precisions.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
` (4 preceding siblings ...)
2023-11-28 9:15 ` cvs-commit at gcc dot gnu.org
@ 2023-11-28 9:16 ` cvs-commit at gcc dot gnu.org
2023-11-28 9:31 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-28 9:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
--- 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:f1b03fa964527678f15e6ef416bfe37e60b3dc54
commit r14-5901-gf1b03fa964527678f15e6ef416bfe37e60b3dc54
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Nov 28 10:15:52 2023 +0100
match.pd: Fix parity (X) ^ parity (Y) simplification [PR112719]
When looking around, I've noticed we have a similar simplification
for parity (with ^ rather than +). Note, unlike the popcount one,
this one doesn't check for INTEGRAL_TYPE_P (type) (which rules out
vector simplification), so I've used the old handling for types_match and
otherwise do it only for scalar argument types and handle different
precision in there.
The testcase ICEs without the previous patch on the first function,
but strangely not on the second which tests parity. The reason
is that in this case there is no wi::bit_and test like for popcount
and for BITINT_TYPEs build_call_internal actually refuses to create it
and thus the whole simplification fails. While
.{CLZ,CTZ,CLRSB,FFS,POPCOUNT,PARITY} ifns are direct optab ifns for
normal integer and vector types (and thus it is desirable to punt if
there is no supported optab for them), they have this large/huge _BitInt
extension before bitint lowering, so the patch also adjusts
build_call_internal to allow that case.
2023-11-28 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/112719
* match.pd (parity(X)^parity(Y) -> parity(X^Y)): Handle case of
mismatched types.
* gimple-match-exports.cc (build_call_internal): Add special-case
for
bit query ifns on large/huge BITINT_TYPE before bitint lowering.
* gcc.dg/bitint-43.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
` (5 preceding siblings ...)
2023-11-28 9:16 ` cvs-commit at gcc dot gnu.org
@ 2023-11-28 9:31 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-28 9:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112719
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- 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:[~2023-11-28 9:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-27 6:54 [Bug target/112719] New: [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() zsojka at seznam dot cz
2023-11-27 8:17 ` [Bug target/112719] " rguenth at gcc dot gnu.org
2023-11-27 9:01 ` [Bug target/112719] [14 Regression] ICE: in decompose, at wide-int.h:1049 with -O -msse4 and __builtin_popcountl() since r14-5557 jakub at gcc dot gnu.org
2023-11-27 9:49 ` [Bug tree-optimization/112719] " jakub at gcc dot gnu.org
2023-11-27 10:48 ` jakub at gcc dot gnu.org
2023-11-28 9:15 ` cvs-commit at gcc dot gnu.org
2023-11-28 9:16 ` cvs-commit at gcc dot gnu.org
2023-11-28 9:31 ` 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).