[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-10-01 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

 CC||prathamesh3492 at gcc dot 
gnu.org

--- Comment #16 from Xi Ruoyao  ---
*** Bug 110867 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-10-01 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

 CC||zsojka at seznam dot cz

--- Comment #15 from Xi Ruoyao  ---
*** Bug 71 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-10-01 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Xi Ruoyao  ---
Fixed at r14-4355:

commit 86b2ffc0b8334c86ed13974f7d986821040474a4
Author: Stefan Schulze Frielinghaus 
Date:   Sun Oct 1 16:11:32 2023 +0200

rtl-optimization/110939 Really fix narrow comparison of memory and constant

In the former fix in commit 41ef5a34161356817807be3a2e51fbdbe575ae85 I
completely missed the fact that the normal form of a CONST_INT for a
mode with fewer bits than in HOST_WIDE_INT is a sign extended version of
the actual constant.  This even holds true for unsigned constants.

Fixed by masking out the upper bits for the incoming constant and sign
extending the resulting unsigned constant.

gcc/ChangeLog:

* combine.cc (simplify_compare_const): Properly handle unsigned
constants while narrowing comparison of memory and constants.

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-10-01 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #13 from Xi Ruoyao  ---
The patch is pushed.  I'm running a bootstrap and I'll close this PR after it
successes.

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-25 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

   Last reconfirmed|2023-08-08 00:00:00 |2023-08-26
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-25 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-23 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

 CC||xen0n at gentoo dot org

--- Comment #12 from Xi Ruoyao  ---
*** Bug 24 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-11 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #11 from Stefan Schulze Frielinghaus  ---
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627024.html

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #10 from Chenghui Pan  ---
(In reply to Stefan Schulze Frielinghaus from comment #9)
> Thanks for the reproducer and sorry for the hassle.
> 
> The normal form of a constant for a mode with fewer bits than in
> HOST_WIDE_INT is a sign extended version of the original constant.  This
> even holds for unsigned constants which I missed.  The following should fix
> this:
> 
> diff --git a/gcc/combine.cc b/gcc/combine.cc
> index e46d202d0a7..9e5bf96a09d 100644
> --- a/gcc/combine.cc
> +++ b/gcc/combine.cc
> @@ -12059,7 +12059,7 @@ simplify_compare_const (enum rtx_code code,
> machine_mode mode,
>: (GET_MODE_SIZE (int_mode)
>   - GET_MODE_SIZE (narrow_mode_iter)));
>   *pop0 = adjust_address_nv (op0, narrow_mode_iter, offset);
> - *pop1 = GEN_INT (n);
> + *pop1 = gen_int_mode (n, narrow_mode_iter);
>   return adjusted_code;
> }
>  }
> 
> Can you give this a try?

Bootstrapping is successful with this, thank you!

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #9 from Stefan Schulze Frielinghaus  
---
Thanks for the reproducer and sorry for the hassle.

The normal form of a constant for a mode with fewer bits than in HOST_WIDE_INT
is a sign extended version of the original constant.  This even holds for
unsigned constants which I missed.  The following should fix this:

diff --git a/gcc/combine.cc b/gcc/combine.cc
index e46d202d0a7..9e5bf96a09d 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -12059,7 +12059,7 @@ simplify_compare_const (enum rtx_code code,
machine_mode mode,
   : (GET_MODE_SIZE (int_mode)
  - GET_MODE_SIZE (narrow_mode_iter)));
  *pop0 = adjust_address_nv (op0, narrow_mode_iter, offset);
- *pop1 = GEN_INT (n);
+ *pop1 = gen_int_mode (n, narrow_mode_iter);
  return adjusted_code;
}
 }

Can you give this a try?

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #8 from Chenghui Pan  ---
(In reply to Stefan Schulze Frielinghaus from comment #6)
> I tried to reproduce it with a cross compiler while using the reproducer
> from PR110867 without getting an ICE.  Can you attach a pre processed source
> file and a corresponding gcc invocation?

I attach the a preprocessed file that ICE happening when bootstrapping. Sorry
for not adding it at first. 

The command that uses to compile this file is:
/home/panchenghui/upstream-unmodded/stuff/gcc/./prev-gcc/xg++ -save-temps
-B/home/panchenghui/upstream-unmodded/stuff/gcc/./prev-gcc/
-B/home/panchenghui/upstream-unmodded/install/loongarch64-unknown-linux-gnu/bin/
-nostdinc++
-B/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/include/loongarch64-unknown-linux-gnu

-I/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/include
 -I/home/panchenghui/upstream-unmodded/gcc/libstdc++-v3/libsupc++
-L/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
 -fno-PIE -c   -g -O2 -fno-checking -gtoggle -DIN_GCC-fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Wconditionally-supported
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -fno-PIE -I. -I.
-I/home/panchenghui/upstream-unmodded/gcc/gcc
-I/home/panchenghui/upstream-unmodded/gcc/gcc/.
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../include 
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libcpp/include
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libcody 
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libdecnumber
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libdecnumber/dpd
-I../libdecnumber -I/home/panchenghui/upstream-unmodded/gcc/gcc/../libbacktrace
  -o tree-cfgcleanup.o -MT tree-cfgcleanup.o -MMD -MP -MF
./.deps/tree-cfgcleanup.TPo
/home/panchenghui/upstream-unmodded/gcc/gcc/tree-cfgcleanup.cc

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #7 from Chenghui Pan  ---
Created attachment 55706
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55706=edit
preprocessed file of gcc/tree-cfgcleanup.cc, ICE occurred in this place.

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #6 from Stefan Schulze Frielinghaus  
---
I tried to reproduce it with a cross compiler while using the reproducer from
PR110867 without getting an ICE.  Can you attach a pre processed source file
and a corresponding gcc invocation?

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

 Resolution|DUPLICATE   |---
 Ever confirmed|1   |0
 Status|RESOLVED|UNCONFIRMED

--- Comment #5 from Xi Ruoyao  ---
Reopen then.

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #4 from Chenghui Pan  ---
(In reply to Richard Biener from comment #1)
> I think this was reported before (and fixed by r14-2932-g41ef5a34161356). 
> Can you try again with updated GCC?

I still get the exact same ICE message with updated GCC. (The commit I use for
now is 25c4b1620ebc10fceabd86a34fdbbaf8037e7e82, with same configure options.)

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Xi Ruoyao  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|WAITING |RESOLVED

--- Comment #3 from Xi Ruoyao  ---


*** This bug has been marked as a duplicate of bug 110867 ***

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #2 from Chenghui Pan  ---
(In reply to Richard Biener from comment #1)
> I think this was reported before (and fixed by r14-2932-g41ef5a34161356). 
> Can you try again with updated GCC?

Ok, I clone a new copy of codes and is bootstrapping on loongarch64 now.

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Richard Biener  changed:

   What|Removed |Added

 CC||stefansf at linux dot ibm.com
 Ever confirmed|0   |1
   Last reconfirmed||2023-08-08
 Status|UNCONFIRMED |WAITING

--- Comment #1 from Richard Biener  ---
I think this was reported before (and fixed by r14-2932-g41ef5a34161356).  Can
you try again with updated GCC?

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||build, ice-on-valid-code
Summary|14.0 ICE at rtl.h:2297  |[14 Regression] 14.0 ICE at
   |while bootstrapping on  |rtl.h:2297 while
   |loongarch64 |bootstrapping on
   ||loongarch64
   Target Milestone|--- |14.0
  Component|bootstrap   |rtl-optimization