Bug 117189 - [avr][lra] DSE removing instruction that is not dead
Summary: [avr][lra] DSE removing instruction that is not dead
Status: RESOLVED DUPLICATE of bug 117191
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 15.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks: 113934
  Show dependency treegraph
 
Reported: 2024-10-17 14:51 UTC by Georg-Johann Lay
Modified: 2024-10-19 10:35 UTC (History)
0 users

See Also:
Host:
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2024-10-17 14:51:42 UTC
typedef int __attribute__((mode(SI))) __attribute__((vector_size (16))) vecint;
typedef int __attribute__((mode(SI))) siint;

vecint i = { 150, 100, 150, 200 };
vecint j = { 10, 13, 20, 30 };
vecint k;

int main (void)
{
  k = i / j;
  /* k = {15, 7, 7, 6} */
  if (k[0] != 15 || k[1] != 7)
    __builtin_abort ();

  k = i & j;
  /* k = {2, 4, 20, 8} */
  if (k[1] != 4)
    __builtin_abort ();

  return 0;
}

$ avr-gcc -mmcu=atmega128 -O1 -mlra

is running into abort with current trunk.

Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls --with-dwarf2 --with-gnu-as --with-gnu-ld --disable-shared --enable-languages=c,c++

GNU C17 (GCC) version 15.0.0 20241016 (experimental) (avr)
	compiled by GNU C version 13.2.1 20231022, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP
Comment 1 Georg-Johann Lay 2024-10-17 15:27:06 UTC
For example, run the following command in $builddir/gcc (using AVRtest):

$ make -k check-gcc RUNTESTFLAGS="--target_board=atmega128-sim --tool_opts='-mlra' avr-torture.exp=pr117189.c"
[...]
Target is avr-unknown-none
Host   is x86_64-pc-linux-gnu

		=== gcc tests ===

Schedule of variations:
    atmega128-sim

Running target atmega128-sim
Using $AVRTEST/dejagnuboards/atmega128-sim.exp as board description file for target.
Using $AVRTEST/dejagnuboards/avrtest.exp as generic interface file for target.
Using /usr/share/dejagnu/config/sim.exp as generic interface file for target.
Using $srcdir/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running $srcdir/gcc/testsuite/gcc.target/avr/torture/avr-torture.exp ...
FAIL: gcc.target/avr/torture/pr117189.c   -O1  execution test

		=== gcc Summary ===

# of expected passes		21
# of unexpected failures	1
$builddir/gcc/xgcc  version 15.0.0 20241016 (experimental) (GCC)
Comment 2 Georg-Johann Lay 2024-10-17 16:27:14 UTC
dup of PR117191

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