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

            Bug ID: 98262
           Summary: Internal compiler error when clobbering m68k frame
                    pointer in extended asm
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomasj at thomasjager dot ca
  Target Milestone: ---

Created attachment 49752
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49752&action=edit
Preprocessed minimal source file causing error

In GCC 10.2.0 for m68k, specifying the the frame pointer (a6) in the clobber
list of extended inline assembly causes an internal compiler error.

The issue only appears in my testing when using optimization level -O1 or
greater. The error does not occur when not using the function arguments.

I do not expect clobbering the frame pointer to work, but I do expect it to
provide a graceful error, as it does in -O0, or when clobbering the sp, instead
of causing an internal compiler error as it does with -O1. Clobbering other
callee- or caller-saved address registers works as expected.


(An) Expected result (result when using -O0):
bugtest.c: In function 'do_ipc':
bugtest.c:8:1: error: %a6 cannot be used in 'asm' here


Another expected result would be to provide an error like the when the stack
pointer is specified as clobbered:
error: listing the stack pointer register 'sp' in a clobber list is deprecated


Actual result (result when using -O1):
during RTL pass: final
bugtest.c: In function 'do_ipc':
bugtest.c:8:1: internal compiler error: in print_operand_address, at
config/m68k/m68k.c:5205
    8 | }
      | ^
0x7f05ca5dccc9 __libc_start_main
        ../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.




The output of `m68k-elf-gcc -v -save-temps -std=gnu11 -Wall -Wextra -pedantic
-Werror -mcpu=68010 -march=68010 -mtune=68010 -O1 -c bugtest.c` is below, and
the resulting preprocessed source file is attached.

Using built-in specs.
COLLECT_GCC=m68k-elf-gcc
Target: m68k-elf
Configured with: ../gcc-10.2.0/configure --disable-debug
--disable-dependency-tracking --disable-silent-rules --target=m68k-elf
--enable-languages=c,c++ --disable-nls
--with-as=/home/linuxbrew/.linuxbrew/opt/binutils-cross-m68k/bin/m68k-elf-as
--with-ld=/home/linuxbrew/.linuxbrew/opt/binutils-cross-m68k/bin/m68k-elf-ld
--prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc-cross-m68k@10/10.2.0
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=gnu11' '-Wall' '-Wextra'
'-Wpedantic' '-Werror' '-mcpu=68010' '-march=68010' '-mtune=68010' '-O1' '-c'

/home/linuxbrew/.linuxbrew/Cellar/gcc-cross-m68k@10/10.2.0/libexec/gcc/m68k-elf/10.2.0/cc1
-E -quiet -v -imultilib m68000 bugtest.c -mcpu=68010 -march=68010 -mtune=68010
-std=gnu11 -Wall -Wextra -Wpedantic -Werror -O1 -fpch-preprocess -o bugtest.i
ignoring nonexistent directory
"/home/linuxbrew/.linuxbrew/Cellar/gcc-cross-m68k@10/10.2.0/lib/gcc/m68k-elf/10.2.0/../../../../m68k-elf/sys-include"
ignoring nonexistent directory
"/home/linuxbrew/.linuxbrew/Cellar/gcc-cross-m68k@10/10.2.0/lib/gcc/m68k-elf/10.2.0/../../../../m68k-elf/include"
#include "..." search starts here:
#include <...> search starts here:

/home/linuxbrew/.linuxbrew/Cellar/gcc-cross-m68k@10/10.2.0/lib/gcc/m68k-elf/10.2.0/include

/home/linuxbrew/.linuxbrew/Cellar/gcc-cross-m68k@10/10.2.0/lib/gcc/m68k-elf/10.2.0/include-fixed
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=gnu11' '-Wall' '-Wextra'
'-Wpedantic' '-Werror' '-mcpu=68010' '-march=68010' '-mtune=68010' '-O1' '-c'

/home/linuxbrew/.linuxbrew/Cellar/gcc-cross-m68k@10/10.2.0/libexec/gcc/m68k-elf/10.2.0/cc1
-fpreprocessed bugtest.i -quiet -dumpbase bugtest.c -mcpu=68010 -march=68010
-mtune=68010 -auxbase bugtest -O1 -Wall -Wextra -Wpedantic -Werror -std=gnu11
-version -o bugtest.s
GNU C11 (GCC) version 10.2.0 (m68k-elf)
        compiled by GNU C version 10.2.0, GMP version 6.2.0, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C11 (GCC) version 10.2.0 (m68k-elf)
        compiled by GNU C version 10.2.0, GMP version 6.2.0, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 34b7dbb97e323204d9aacd318bb4d69c
during RTL pass: final
bugtest.c: In function 'do_ipc':
bugtest.c:8:1: internal compiler error: in print_operand_address, at
config/m68k/m68k.c:5205
    8 | }
      | ^
0x7ff6354a8cc9 __libc_start_main
        ../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.




Because this is a result of using inline-asm, that component has been
specified. It may however belong to the c component.

Reply via email to