[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

--- Comment #10 from Andrew Pinski  ---
Created attachment 62878
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62878&action=edit
testcase

This works with `-O2` but fails with `-O2 --param=ggc-min-expand=0
--param=ggc-min-heapsize=0`.

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||GC

--- Comment #9 from Andrew Pinski  ---
Ok, So now I have a testcase which works with `-O2` and fails with `-O2
--param=ggc-min-expand=1 --param=ggc-min-heapsize=1`. Which makes this a GC
issue.

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

--- Comment #8 from Andrew Pinski  ---
I have a testcase which fails with `-O2 -fdump-tree-all-details` but works with
`-O2`. I ran valgrind on cc1 and the only thing that sticked out was IRA/LRA
and some DF related uninitialization stuff but nothing gimple level.

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

--- Comment #7 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #6)
> Note removing some unused functions causes the store not to be removed.
> I don't know why though. Also maybe it is a cross compiler only; I have not
> tried on a native compiler yet; though in my case it is a cross compiler
> compiled at -O0 even.

Even more interesting sometimes dumping the dump files (with some of the
functions removed) changes the behavior.

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

Jeffrey A. Law  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

--- Comment #6 from Andrew Pinski  ---
Note removing some unused functions causes the store not to be removed.
I don't know why though. Also maybe it is a cross compiler only; I have not
tried on a native compiler yet; though in my case it is a cross compiler
compiled at -O0 even.

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

--- Comment #5 from Andrew Pinski  ---
I see it with:

[apinski@xeond2 upstream-cross-aarch64]$ ./install/bin/aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=./install/bin/aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/bajas/pinskia/src/upstream-cross-aarch64/install/bin/../libexec/gcc/aarch64-linux-gnu/16.0.0/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../configure --target=aarch64-linux-gnu
--prefix=/home/apinski/src/upstream-cross-aarch64/install
--enable-languages=c,c++,fortran
--with-sysroot=/home/apinski/src/upstream-cross-aarch64/install/aarch64-linux-gnu/sysroot
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20251115 (experimental) [trunk 05a3346353d] (GCC)

aka r16-5297-g05a3346353dce2

```
  ivtmp.105_7 = (unsigned long) &BS_VAR_11;
  _23 = ivtmp.105_7 + 160;

   [local count: 976138696]:
  # checksum_lsm.97_5 = PHI <_4(3), checksum_lsm.97_18(2)>
  # ivtmp.105_12 = PHI 
  _15 = (void *) ivtmp.105_12;
  _1 = MEM[(unsigned _BitInt(66) *)_15];
  _2 = (long unsigned int) _1;
  _4 = _2 ^ checksum_lsm.97_5;
  ivtmp.105_3 = ivtmp.105_12 + 16;
  if (ivtmp.105_3 != _23)
goto ; [90.00%]
  else
goto ; [10.00%]
```
This the IR for the loop.

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread xxs_chy at outlook dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

--- Comment #4 from XChy  ---
I can reproduce it without specifying -march/-mcpu on:
System: Ubuntu 22.04
Processor: Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz
Emulator: qemu-aarch64 version 10.1.50 (v10.1.0-846-g29b77c1a2d)

aarch64-unknown-linux-musl-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-unknown-linux-musl-gcc
COLLECT_LTO_WRAPPER=/opt/aarch64/bin/../libexec/gcc/aarch64-unknown-linux-musl/16.0.0/lto-wrapper
Target: aarch64-unknown-linux-musl
Configured with:
/home/shareduser/XChy/Projects/crosstool-ng/.build/aarch64-unknown-linux-musl/src/gcc/configure
--build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu
--target=aarch64-unknown-linux-musl
--prefix=/home/shareduser/x-tools/aarch64-unknown-linux-musl
--exec_prefix=/home/shareduser/x-tools/aarch64-unknown-linux-musl
--with-sysroot=/home/shareduser/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot
--enable-languages=c,c++ --with-pkgversion='crosstool-NG 1.28.0_rc1'
--enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp
--disable-libquadmath --disable-libquadmath-support --disable-libsanitizer
--disable-libmpx
--with-gmp=/home/shareduser/XChy/Projects/crosstool-ng/.build/aarch64-unknown-linux-musl/buildtools
--with-mpfr=/home/shareduser/XChy/Projects/crosstool-ng/.build/aarch64-unknown-linux-musl/buildtools
--with-mpc=/home/shareduser/XChy/Projects/crosstool-ng/.build/aarch64-unknown-linux-musl/buildtools
--with-isl=/home/shareduser/XChy/Projects/crosstool-ng/.build/aarch64-unknown-linux-musl/buildtools
--enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin
--disable-nls --disable-multilib
--with-local-prefix=/home/shareduser/x-tools/aarch64-unknown-linux-musl/aarch64-unknown-linux-musl/sysroot
--enable-long-long
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20251121 (experimental) (crosstool-NG 1.28.0_rc1)

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

--- Comment #3 from Sam James  ---
I can't either.

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-21 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Can't reproduce.  Which -march/-mcpu etc. configuration is this with?

[Bug tree-optimization/122624] [16 Regression] AArch64: Miscompile at -O2 with _BitInt

2025-11-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122624

Andrew Pinski  changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu.org
 Ever confirmed|0   |1
   Target Milestone|--- |16.0
   Last reconfirmed||2025-11-10
  Component|middle-end  |tree-optimization
Summary|[Trunk] AArch64: Miscompile |[16 Regression] AArch64:
   |at -O2 with _BitInt |Miscompile at -O2 with
   ||_BitInt
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
  Deleted dead store: BS_VAR_11 = *.LC1;

Happens incorrectly at -O2 during the last gimple level dse.