https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120347

            Bug ID: 120347
           Summary: invalid arm32/thumb assembly output
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnd at linaro dot org
  Target Milestone: ---

During build testing on the Linux kernel, I came across a new failure with
gcc-15.1 producing a single invalid instruction, in exactly one file/function:

/tmp/ccGz2dNz.s: Assembler messages:
/tmp/ccGz2dNz.s:681: Error: registers may not be the same -- `str r1,[r1],#4'
make[8]: *** [scripts/Makefile.build:195: drivers/gpu/drm/radeon/radeon_test.o]
Error 1

I managed to produce a reduced test case with the same output:

void *end;
void **start;
void main(void)
{
  for (; end; start++) {
    if (*start)
      return;
    *start = start;
  }
}
$ arm-linux-gcc-15.1 -O2 -march=armv7-a -mthumb test.c -c
/tmp/ccjHgo9c.s:43: Error: registers may not be the same -- `str r3,[r3],#4'

See https://godbolt.org/z/4v41cnsbY for reference. The test case also
reproduces on current 'trunk' but not on gcc-14.2 or earlier.

Reply via email to