public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu
@ 2024-02-01 14:07 doko at gcc dot gnu.org
2024-02-01 14:13 ` [Bug middle-end/113705] " doko at gcc dot gnu.org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: doko at gcc dot gnu.org @ 2024-02-01 14:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Bug ID: 113705
Summary: [14 Regression] ICE in decompose, at wide-int.h:1049
on aarch64-linux-gnu
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: doko at gcc dot gnu.org
Target Milestone: ---
seen with trunk 20240201, works with 20240131 on aarch64-linux-gnu
during GIMPLE pass: widening_mul
../../src/gcc/value-range-storage.cc: In member function 'void
irange_storage::_ZN14irange_stor
age10set_irangeERK6irange.part.0(const irange&)':
../../src/gcc/value-range-storage.cc:277:1: internal compiler error: in
decompose, at wide-int.h:1049
277 | irange_storage::set_irange (const irange &r)
| ^~~~~~~~~~~~~~
0x134ff07 wi::int_traits<generic_wide_int<wide_int_storage> >::decompose(long*,
unsigned int, generic_wide_int<wide_int_storage> const&)
../../src/gcc/wide-int.h:1049
0x13a452f 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)
../../src/gcc/wide-int.h:1099
0x13a44db 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)
../../src/gcc/wide-int.h:855
0x16b5353 bool wi::eq_p<generic_wide_int<wide_int_ref_storage<false, false> >,
generic_wide_int<wide_int_storage>
>(generic_wide_int<wide_int_ref_storage<false, false> > const&,
generic_wide_int<wide_int_storage> const&)
../../src/gcc/wide-int.h:2250
0x16b424b wi::binary_traits<generic_wide_int<wide_int_ref_storage<false, false>
>, generic_wide_int<wide_int_storage>,
wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> >
>::precision_type, wi::int_traits<generic_wide_int<wide_int_storage>
>::precision_type>::predicate_result
operator==<generic_wide_int<wide_int_ref_storage<false, false> >,
generic_wide_int<wide_int_storage>
>(generic_wide_int<wide_int_ref_storage<false, false> > const&,
generic_wide_int<wide_int_storage> const&)
../../src/gcc/wide-int.h:3852
0x1fd2b3f is_widening_mult_rhs_p
../../src/gcc/tree-ssa-math-opts.cc:2576
0x1fd2fc3 is_widening_mult_p
../../src/gcc/tree-ssa-math-opts.cc:2654
0x1fd42eb convert_plusminus_to_widen
../../src/gcc/tree-ssa-math-opts.cc:3004
0x1fdf05f after_dom_children
../../src/gcc/tree-ssa-math-opts.cc:5912
0x374916f dom_walker::walk(basic_block_def*)
../../src/gcc/domwalk.cc:354
0x1fdf677 execute
../../src/gcc/tree-ssa-math-opts.cc:6036
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
make[5]: *** [Makefile:1199: value-range-storage.o] Error 1
make[5]: Leaving directory '/<<PKGBUILDDIR>>/build/gcc'
make[4]: *** [Makefile:5099: all-stage2-gcc] Error 2
make[4]: Leaving directory '/<<PKGBUILDDIR>>/build'
make[3]: *** [Makefile:32074: stage2-bubble] Error 2
make[3]: Leaving directory '/<<PKGBUILDDIR>>/build'
make[2]: *** [Makefile:32286: bootstrap] Error 2
make[2]: Leaving directory '/<<PKGBUILDDIR>>/build'
Configured with: -v
--with-pkgversion='Debian 14-20240201-1'
--with-bugurl='file:///usr/share/doc/gcc-14/README.Bugs'
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust
--prefix=/usr
--with-gcc-major-version-only
--program-suffix=-14
--program-prefix=aarch64-linux-gnu-
--enable-shared
--enable-linker-build-id
--libexecdir=/usr/libexec
--without-included-gettext
--enable-threads=posix
--libdir=/usr/lib
--enable-nls
--enable-clocale=gnu
--enable-libstdcxx-debug
--enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new
--enable-libstdcxx-backtrace
--enable-gnu-unique-object
--disable-libquadmath
--disable-libquadmath-support
--enable-plugin
--enable-default-pie
--with-system-zlib
--enable-libphobos-checking=release
--with-target-system-zlib=auto
--enable-objc-gc=auto
--enable-multiarch
--enable-fix-cortex-a53-843419
--disable-werror
--enable-offload-targets=nvptx-none=/<<PKGBUILDDIR>>/debian/tmp-nvptx/usr
--enable-offload-defaulted
--without-cuda-driver
--enable-checking=yes,extra,rtl
--build=aarch64-linux-gnu
--host=aarch64-linux-gnu
--target=aarch64-linux-gnu
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
@ 2024-02-01 14:13 ` doko at gcc dot gnu.org
2024-02-01 14:13 ` rguenth at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: doko at gcc dot gnu.org @ 2024-02-01 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
--- Comment #1 from Matthias Klose <doko at gcc dot gnu.org> ---
Created attachment 57281
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57281&action=edit
preprocessed source
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
2024-02-01 14:13 ` [Bug middle-end/113705] " doko at gcc dot gnu.org
@ 2024-02-01 14:13 ` rguenth at gcc dot gnu.org
2024-02-01 15:35 ` acoplan at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-01 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sayle at gcc dot gnu.org
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
2024-02-01 14:13 ` [Bug middle-end/113705] " doko at gcc dot gnu.org
2024-02-01 14:13 ` rguenth at gcc dot gnu.org
@ 2024-02-01 15:35 ` acoplan at gcc dot gnu.org
2024-02-01 16:09 ` mpolacek at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: acoplan at gcc dot gnu.org @ 2024-02-01 15:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Alex Coplan <acoplan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |acoplan at gcc dot gnu.org
Last reconfirmed| |2024-02-01
Ever confirmed|0 |1
--- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Confirmed. Here is a reduced testcase that ICEs with -O2 on aarch64-linux-gnu:
void free();
template <typename storage> struct generic_wide_int : storage {
long elt() const;
};
int elt_i;
template <typename storage> long generic_wide_int<storage>::elt() const {
return this->get_val()[elt_i];
}
struct wide_int_storage {
struct {
long val[0];
long valp;
} u;
unsigned len;
int precision;
wide_int_storage(const wide_int_storage &);
~wide_int_storage();
const long *get_val() const;
unsigned get_len() const;
};
wide_int_storage::wide_int_storage(const wide_int_storage &) {
if (__builtin_expect(precision, 0))
u.valp = 0;
}
wide_int_storage::~wide_int_storage() {
if (__builtin_expect(precision, 0))
free();
}
const long *wide_int_storage::get_val() const { return u.val; }
unsigned wide_int_storage::get_len() const { return len; }
struct irange {
generic_wide_int<wide_int_storage> upper_bound() const;
generic_wide_int<wide_int_storage> *m_base;
};
generic_wide_int<wide_int_storage> irange::upper_bound() const {
return m_base[1];
}
void set_irange() {
irange r;
for (unsigned i;;) {
generic_wide_int __trans_tmp_1 = r.upper_bound();
long *__trans_tmp_2;
unsigned short *len;
*len = __trans_tmp_1.get_len();
for (i = 0; i < *len; ++i)
*__trans_tmp_2++ = __trans_tmp_1.elt();
}
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (2 preceding siblings ...)
2024-02-01 15:35 ` acoplan at gcc dot gnu.org
@ 2024-02-01 16:09 ` mpolacek at gcc dot gnu.org
2024-02-01 16:22 ` [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985 acoplan at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-02-01 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
CC| |mpolacek at gcc dot gnu.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (3 preceding siblings ...)
2024-02-01 16:09 ` mpolacek at gcc dot gnu.org
@ 2024-02-01 16:22 ` acoplan at gcc dot gnu.org
2024-02-01 16:45 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: acoplan at gcc dot gnu.org @ 2024-02-01 16:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Alex Coplan <acoplan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14 Regression] ICE in |[14 Regression] ICE in
|decompose, at |decompose, at
|wide-int.h:1049 on |wide-int.h:1049 on
|aarch64-linux-gnu |aarch64-linux-gnu since
| |r14-8680-g2f14c0dbb78985
--- Comment #3 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Started with r14-8680-g2f14c0dbb789852947cb58fdf7d3162413f053fa :
commit 2f14c0dbb789852947cb58fdf7d3162413f053fa
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Thu Feb 1 06:10:42 2024
PR target/113560: Enhance is_widening_mult_rhs_p.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (4 preceding siblings ...)
2024-02-01 16:22 ` [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985 acoplan at gcc dot gnu.org
@ 2024-02-01 16:45 ` jakub at gcc dot gnu.org
2024-02-01 16:56 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-01 16:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Shouldn't that
wi::to_wide (gimple_assign_rhs2 (stmt))
in there be
wide_int::from (gimple_assign_rhs2 (stmt), prec, TYPE_SIGN (TREE_TYPE (rhs)))
instead?
Otherwise the ICE is obviously because wi::to_wide (gimple_assign_rhs2 (stmt))
is unsigned int 65535, while prec is 64-bit and comparing 32-bit vs. 64-bit
wide_int is not valid.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (5 preceding siblings ...)
2024-02-01 16:45 ` jakub at gcc dot gnu.org
@ 2024-02-01 16:56 ` jakub at gcc dot gnu.org
2024-02-01 17:37 ` xry111 at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-01 16:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/tree-ssa-math-opts.cc.jj 2024-02-01 09:14:16.623549514 +0100
+++ gcc/tree-ssa-math-opts.cc 2024-02-01 17:48:59.151771177 +0100
@@ -2572,7 +2572,8 @@ is_widening_mult_rhs_p (tree type, tree
if (is_gimple_assign (stmt)
&& gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
&& TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
- && wi::to_wide (gimple_assign_rhs2 (stmt))
+ && wide_int::from (wi::to_wide (gimple_assign_rhs2 (stmt)),
+ prec, TYPE_SIGN (TREE_TYPE (rhs)))
== wi::mask (hprec, false, prec))
*new_rhs_out = gimple_assign_rhs1 (stmt);
else
fixes the ICE.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (6 preceding siblings ...)
2024-02-01 16:56 ` jakub at gcc dot gnu.org
@ 2024-02-01 17:37 ` xry111 at gcc dot gnu.org
2024-02-01 18:08 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-02-01 17:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
Target|aarch64-linux-gnu |aarch64-linux-gnu,
| |loongarch64-linux-gnu
--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Just hit this doing an experimental Linux From Scratch build with GCC 14 on
LoongArch.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (7 preceding siblings ...)
2024-02-01 17:37 ` xry111 at gcc dot gnu.org
@ 2024-02-01 18:08 ` jakub at gcc dot gnu.org
2024-02-01 18:29 ` xry111 at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-01 18:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
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 #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57284
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57284&action=edit
gcc14-pr113705.patch
Full untested patch.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (8 preceding siblings ...)
2024-02-01 18:08 ` jakub at gcc dot gnu.org
@ 2024-02-01 18:29 ` xry111 at gcc dot gnu.org
2024-02-02 9:58 ` doko at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-02-01 18:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
--- Comment #8 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> --- gcc/tree-ssa-math-opts.cc.jj 2024-02-01 09:14:16.623549514 +0100
> +++ gcc/tree-ssa-math-opts.cc 2024-02-01 17:48:59.151771177 +0100
> @@ -2572,7 +2572,8 @@ is_widening_mult_rhs_p (tree type, tree
> if (is_gimple_assign (stmt)
> && gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
> && TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
> - && wi::to_wide (gimple_assign_rhs2 (stmt))
> + && wide_int::from (wi::to_wide (gimple_assign_rhs2 (stmt)),
> + prec, TYPE_SIGN (TREE_TYPE (rhs)))
> == wi::mask (hprec, false, prec))
> *new_rhs_out = gimple_assign_rhs1 (stmt);
> else
> fixes the ICE.
Works for me on LoongArch.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (9 preceding siblings ...)
2024-02-01 18:29 ` xry111 at gcc dot gnu.org
@ 2024-02-02 9:58 ` doko at gcc dot gnu.org
2024-02-02 10:26 ` cvs-commit at gcc dot gnu.org
2024-02-02 10:33 ` jakub at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: doko at gcc dot gnu.org @ 2024-02-02 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Matthias Klose <doko at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|aarch64-linux-gnu, |aarch64-linux-gnu,
|loongarch64-linux-gnu |loongarch64-linux-gnu,
| |mips64el-linux-gnu
--- Comment #9 from Matthias Klose <doko at gcc dot gnu.org> ---
also works on aarch64-linux-gnu and mips64el-linux-gnu
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (10 preceding siblings ...)
2024-02-02 9:58 ` doko at gcc dot gnu.org
@ 2024-02-02 10:26 ` cvs-commit at gcc dot gnu.org
2024-02-02 10:33 ` jakub at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-02 10:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
--- Comment #10 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:a8f335ccb61bf6105192a4197ef2d84900614dc1
commit r14-8742-ga8f335ccb61bf6105192a4197ef2d84900614dc1
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Feb 2 11:25:13 2024 +0100
tree-ssa-math-opts: Fix is_widening_mult_rhs_p - unbreak bootstrap
[PR113705]
On Tue, Jan 30, 2024 at 07:33:10AM -0000, Roger Sayle wrote:
+ wide_int bits = wide_int::from (tree_nonzero_bits (rhs),
+ prec,
+ TYPE_SIGN (TREE_TYPE (rhs)));
...
> + if (gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
> + && TREE_CODE (gimple_assign_rhs2 (stmt)) ==
INTEGER_CST
> + && wi::to_wide (gimple_assign_rhs2 (stmt))
> + == wi::mask (hprec, false, prec))
This change broke bootstrap on aarch64-linux.
The problem can be seen even on the reduced testcase.
The IL on the unreduced testcase before widening_mul has:
# val_583 = PHI <val_26(13), val_164(40)>
...
pretmp_266 = MEM[(const struct wide_int_storage *)&D.160657].len;
_264 = pretmp_266 & 65535;
...
_176 = (sizetype) val_583;
_439 = (sizetype) _264;
_284 = _439 * 8;
_115 = _176 + _284;
where 583/266/264 have unsigned int type and 176/439/284/115 have sizetype.
widening_mul first turns that into:
# val_583 = PHI <val_26(13), val_164(40)>
...
pretmp_266 = MEM[(const struct wide_int_storage *)&D.160657].len;
_264 = pretmp_266 & 65535;
...
_176 = (sizetype) val_583;
_439 = (sizetype) _264;
_284 = _264 w* 8;
_115 = _176 + _284;
and then is_widening_mult_rhs_p is called, with type sizetype (64-bit),
rhs _264, hprec 32 and prec 64. Now tree_nonzero_bits (rhs) is
65535, so bits is 64-bit wide_int 65535, stmt is BIT_AND_EXPR,
but we ICE on the
wi::to_wide (gimple_assign_rhs2 (stmt)) == wi::mask (hprec, false, prec)
comparison because wi::to_wide on gimple_assign_rhs2 (stmt) - unsigned int
65535 gives 32-bit wide_int 65535, while wi::mask (hprec, false, prec)
gives 64-bit wide_int 0xffffffff and comparison between different precision
wide_ints is forbidden.
The following patch fixes it the same way how bits is computed earlier,
by calling wide_int::from on the wi::to_wide (gimple_assign_rhs2 (stmt)),
so we compare 64-bit 65535 with 64-bit 0xffffffff.
2024-02-02 Jakub Jelinek <jakub@redhat.com>
PR middle-end/113705
* tree-ssa-math-opts.cc (is_widening_mult_rhs_p): Use wide_int_from
around wi::to_wide in order to compare value in prec precision.
* g++.dg/opt/pr113705.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
` (11 preceding siblings ...)
2024-02-02 10:26 ` cvs-commit at gcc dot gnu.org
@ 2024-02-02 10:33 ` jakub at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-02 10:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-02-02 10:33 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 14:07 [Bug middle-end/113705] New: [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu doko at gcc dot gnu.org
2024-02-01 14:13 ` [Bug middle-end/113705] " doko at gcc dot gnu.org
2024-02-01 14:13 ` rguenth at gcc dot gnu.org
2024-02-01 15:35 ` acoplan at gcc dot gnu.org
2024-02-01 16:09 ` mpolacek at gcc dot gnu.org
2024-02-01 16:22 ` [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985 acoplan at gcc dot gnu.org
2024-02-01 16:45 ` jakub at gcc dot gnu.org
2024-02-01 16:56 ` jakub at gcc dot gnu.org
2024-02-01 17:37 ` xry111 at gcc dot gnu.org
2024-02-01 18:08 ` jakub at gcc dot gnu.org
2024-02-01 18:29 ` xry111 at gcc dot gnu.org
2024-02-02 9:58 ` doko at gcc dot gnu.org
2024-02-02 10:26 ` cvs-commit at gcc dot gnu.org
2024-02-02 10:33 ` 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).