public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
@ 2023-02-02 14:51 aarnold.gcc at antonarnold dot de
  2023-02-02 19:45 ` [Bug target/108640] " mikpelinux at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: aarnold.gcc at antonarnold dot de @ 2023-02-02 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108640
           Summary: ICE compiling busybox for m68k in change_address_1, at
                    emit-rtl.cc:2283
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aarnold.gcc at antonarnold dot de
  Target Milestone: ---

Created attachment 54390
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54390&action=edit
preprocessed source file

Compiling busybox for a m68k-nommu target via buildroot fails with an ICE:

  CC      coreutils/ls.o
Using built-in specs.
COLLECT_GCC=/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/m68k-linux-gcc.br_real
Target: m68k-buildroot-uclinux-uclibc
Configured with: ./configure
--prefix=/home/dev/projects/buildroot-tp50/output/host
--sysconfdir=/home/dev/projects/buildroot-tp50/output/host/etc --enable-static
-q --target=m68k-buildroot-uclinux-uclibc --with
-sysroot=/home/dev/projects/buildroot-tp50/output/host/m68k-buildroot-uclinux-uclibc/sysroot
--enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib
--disable-decimal-float --enable-plugins --ena
ble-lto --with-gmp=/home/dev/projects/buildroot-tp50/output/host
--with-mpc=/home/dev/projects/buildroot-tp50/output/host
--with-mpfr=/home/dev/projects/buildroot-tp50/output/host
--with-pkgversion='Buildroot 87
ts51/P0003-V0009-14872-g19d8c0fb50' --with-bugurl=http://bugs.buildroot.net/
--without-zstd --disable-libquadmath --disable-libquadmath-support
--disable-libsanitizer --disable-tls --enable-threads --without-isl
--without-cloog --enable-languages=c,c++
--with-build-time-tools=/home/dev/projects/buildroot-tp50/output/host/m68k-buildroot-uclinux-uclibc/bin
--disable-shared --disable-libgomp --silent
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (Buildroot m68k-dev) 
COLLECT_GCC_OPTIONS='--sysroot=/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/m68k-buildroot-uclinux-uclibc/sysroot'
'-fstack-protector-strong' '-std=gnu99' '-I' 'include' '-I' 'libbb' '-include'
'include/autoconf.h' '-D' '_GNU_SOURCE' '-D' 'NDEBUG' '-D' '_LARGEFILE_SOURCE'
'-D' '_LARGEFILE64_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-D' 'BB_VER="1.35.0"'
'-v' '-save-temps' '-freport-bug' '-D' '_LARGEFILE_SOURCE' '-D'
'_LARGEFILE64_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-O1' '-g0'
'-fno-dwarf2-cfi-asm' '-static' '-Wall' '-Wshadow' '-Wwrite-strings' '-Wundef'
'-Wstrict-prototypes' '-Wunused' '-Wunused-parameter' '-Wunused-function'
'-Wunused-value' '-Wmissing-prototypes' '-Wmissing-declarations'
'-Wno-format-security' '-Wdeclaration-after-statement' '-Wold-style-definition'
'-finline-limit=0' '-fno-builtin-strlen' '-fomit-frame-pointer'
'-ffunction-sections' '-fdata-sections' '-fno-guess-branch-probability'
'-funsigned-char' '-static-libgcc' '-falign-functions=1' '-falign-jumps=1'
'-falign-labels=1' '-falign-loops=1' '-fno-unwind-tables'
'-fno-asynchronous-unwind-tables' '-fno-builtin-printf' '-Os' '-D'
'KBUILD_BASENAME="ls"' '-D' 'KBUILD_MODNAME="ls"' '-c' '-o' 'coreutils/ls.o'
'-mcpu=68020' '-dumpdir' 'coreutils/'

/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../libexec/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/cc1
-E -quiet -v -I include -I libbb -iprefix
/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../lib/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/
-isysroot
/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/m68k-buildroot-uclinux-uclibc/sysroot
-D _GNU_SOURCE -D NDEBUG -D _LARGEFILE_SOURCE -D _LARGEFILE64_SOURCE -D
_FILE_OFFSET_BITS=64 -D BB_VER="1.35.0" -D _LARGEFILE_SOURCE -D
_LARGEFILE64_SOURCE -D _FILE_OFFSET_BITS=64 -D KBUILD_BASENAME="ls" -D
KBUILD_MODNAME="ls" -include include/autoconf.h -MD coreutils/.ls.o.d
coreutils/ls.c -mcpu=68020 -std=gnu99 -Wall -Wshadow -Wwrite-strings -Wundef
-Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function
-Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security
-Wdeclaration-after-statement -Wold-style-definition -fstack-protector-strong
-freport-bug -fno-dwarf2-cfi-asm -finline-limit=0 -fno-builtin-strlen
-fomit-frame-pointer -ffunction-sections -fdata-sections
-fno-guess-branch-probability -funsigned-char -falign-functions=1
-falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables
-fno-asynchronous-unwind-tables -fno-builtin-printf -O1 -Os -fpch-preprocess -o
coreutils/ls.i
ignoring duplicate directory
"/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../lib/gcc/../../lib/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/include"
ignoring nonexistent directory
"/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/m68k-buildroot-uclinux-uclibc/sysroot/usr/local/include"
ignoring duplicate directory
"/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../lib/gcc/../../lib/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/include-fixed"
ignoring duplicate directory
"/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../lib/gcc/../../lib/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/../../../../m68k-buildroot-uclinux-uclibc/include"
#include "..." search starts here:
#include <...> search starts here:
 include
 libbb

/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../lib/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/include

/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../lib/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/include-fixed

/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../lib/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/../../../../m68k-buildroot-uclinux-uclibc/include

/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/m68k-buildroot-uclinux-uclibc/sysroot/usr/include
End of search list.
COLLECT_GCC_OPTIONS='--sysroot=/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/m68k-buildroot-uclinux-uclibc/sysroot'
'-fstack-protector-strong' '-std=gnu99' '-I' 'include' '-I' 'libbb' '-include'
'include/autoconf.h' '-D' '_GNU_SOURCE' '-D' 'NDEBUG' '-D' '_LARGEFILE_SOURCE'
'-D' '_LARGEFILE64_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-D' 'BB_VER="1.35.0"'
'-v' '-save-temps' '-freport-bug' '-D' '_LARGEFILE_SOURCE' '-D'
'_LARGEFILE64_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-O1' '-g0'
'-fno-dwarf2-cfi-asm' '-static' '-Wall' '-Wshadow' '-Wwrite-strings' '-Wundef'
'-Wstrict-prototypes' '-Wunused' '-Wunused-parameter' '-Wunused-function'
'-Wunused-value' '-Wmissing-prototypes' '-Wmissing-declarations'
'-Wno-format-security' '-Wdeclaration-after-statement' '-Wold-style-definition'
'-finline-limit=0' '-fno-builtin-strlen' '-fomit-frame-pointer'
'-ffunction-sections' '-fdata-sections' '-fno-guess-branch-probability'
'-funsigned-char' '-static-libgcc' '-falign-functions=1' '-falign-jumps=1'
'-falign-labels=1' '-falign-loops=1' '-fno-unwind-tables'
'-fno-asynchronous-unwind-tables' '-fno-builtin-printf' '-Os' '-D'
'KBUILD_BASENAME="ls"' '-D' 'KBUILD_MODNAME="ls"' '-c' '-o' 'coreutils/ls.o'
'-mcpu=68020' '-dumpdir' 'coreutils/'

/opt/m68k-buildroot-uclinux-uclibc_sdk-buildroot/bin/../libexec/gcc/m68k-buildroot-uclinux-uclibc/12.2.0/cc1
-fpreprocessed coreutils/ls.i -quiet -dumpdir coreutils/ -dumpbase ls.c
-dumpbase-ext .c -mcpu=68020 -g0 -O1 -Os -Wall -Wshadow -Wwrite-strings -Wundef
-Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function
-Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security
-Wdeclaration-after-statement -Wold-style-definition -std=gnu99 -version
-fstack-protector-strong -freport-bug -fno-dwarf2-cfi-asm -finline-limit=0
-fno-builtin-strlen -fomit-frame-pointer -ffunction-sections -fdata-sections
-fno-guess-branch-probability -funsigned-char -falign-functions=1
-falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables
-fno-asynchronous-unwind-tables -fno-builtin-printf -o coreutils/ls.s
GNU C99 (Buildroot m68k-dev) version 12.2.0 (m68k-buildroot-uclinux-uclibc)
        compiled by GNU C version 8.3.0, GMP version 6.2.1, MPFR version 4.1.1,
MPC version 1.2.1, isl version none
warning: MPFR header version 4.1.1 differs from library version 4.2.0.
warning: MPC header version 1.2.1 differs from library version 1.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C99 (Buildroot m68k-dev) version 12.2.0 (m68k-buildroot-uclinux-uclibc)
        compiled by GNU C version 8.3.0, GMP version 6.2.1, MPFR version 4.1.1,
MPC version 1.2.1, isl version none
warning: MPFR header version 4.1.1 differs from library version 4.2.0.
warning: MPC header version 1.2.1 differs from library version 1.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c2fea2109e818f31c0714c451479c88d
during RTL pass: final
coreutils/ls.c: In function ‘ls_main’:
coreutils/ls.c:1265:1: internal compiler error: in change_address_1, at
emit-rtl.cc:2283
 1265 | }
      | ^
0x132dc56 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
        ???:0
0x132e8a6 internal_error(char const*, ...)
        ???:0
0x5a854d fancy_abort(char const*, int, char const*)
        ???:0
0x57a46a change_address_1(rtx_def*, machine_mode, rtx_def*, int, bool) [clone
.cold.270]
        ???:0
0x7a0e14 adjust_address_1(rtx_def*, machine_mode, poly_int<1u, long>, int, int,
int, poly_int<1u, long>)
        ???:0
0xde417e output_iorsi3(rtx_def**)
        ???:0
0x7e062c final_scan_insn_1(rtx_insn*, _IO_FILE*, int, int, int*)
        ???:0
0x7e1748 final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
        ???:0
0x7e19d5 final_1(rtx_insn*, _IO_FILE*, int, int)
        ???:0
0x7e21a2 (anonymous namespace)::pass_final::execute(function*)
        ???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <http://bugs.buildroot.net/> for instructions.
Preprocessed source stored into /tmp/ccgTklCf.out file, please attach this to
your bugreport.
make[1]: *** [scripts/Makefile.build:197: coreutils/ls.o] Fehler 1
make: *** [Makefile:744: coreutils] Fehler 2

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
@ 2023-02-02 19:45 ` mikpelinux at gmail dot com
  2023-02-02 20:59 ` mikpelinux at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mikpelinux at gmail dot com @ 2023-02-02 19:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
I can reproduce. Doesn't happen with the m68k-linux-gnu target though.

> cross-m68k-uclinux/bin/m68k-unknown-uclinux-uclibc-gcc -Os -c /tmp/ls.i 
during RTL pass: final
coreutils/ls.c: In function 'ls_main':
coreutils/ls.c:1265:1: internal compiler error: in change_address_1, at
emit-rtl.cc:2283
0x40c57b change_address_1
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/emit-rtl.cc:2283
0x64e80d adjust_address_1(rtx_def*, machine_mode, poly_int<1u, long>, int, int,
int, poly_int<1u, long>)
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/emit-rtl.cc:2417
0xc6da2f output_iorsi3(rtx_def**)
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/config/m68k/m68k.cc:5498
0x691b05 final_scan_insn_1
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/final.cc:2827
0x692108 final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/final.cc:2940
0x692395 final_1
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/final.cc:1997
0x692b92 rest_of_handle_final
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/final.cc:4285
0x692b92 execute
        /mnt/scratch/cross/sources/gcc-12.2.0/gcc/final.cc:4363
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
  2023-02-02 19:45 ` [Bug target/108640] " mikpelinux at gmail dot com
@ 2023-02-02 20:59 ` mikpelinux at gmail dot com
  2023-03-30 11:20 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mikpelinux at gmail dot com @ 2023-02-02 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Happens with 11.3.0, 10.4.0, and 9.5.0 too, so shouldn't be related to the CC0
conversion.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
  2023-02-02 19:45 ` [Bug target/108640] " mikpelinux at gmail dot com
  2023-02-02 20:59 ` mikpelinux at gmail dot com
@ 2023-03-30 11:20 ` marxin at gcc dot gnu.org
  2023-10-15 17:10 ` matthias.reis at posteo dot de
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-30 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org
           Keywords|needs-reduction             |
   Last reconfirmed|                            |2023-03-30

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

$ cat pr108640.i
int option_mask32;

enum {
  OPTBIT_F = 12,
  OPTBIT_R,
  OPTBIT_Z,
  OPTBIT_c,
  OPTBIT_t,
  OPT_t = 1 << OPTBIT_t
} ls_main() {
  option_mask32 |= OPT_t;
}

$ ./xgcc -B. ~/Programming/testcases/pr108640.i -c -Os
during RTL pass: final
/home/marxin/Programming/testcases/pr108640.i: In function ‘ls_main’:
/home/marxin/Programming/testcases/pr108640.i:12:1: internal compiler error: in
change_address_1, at emit-rtl.cc:2287
   12 | }
      | ^
0xee4b72 change_address_1
        /home/marxin/Programming/gcc/gcc/emit-rtl.cc:2287
0xee5684 adjust_address_1(rtx_def*, machine_mode, poly_int<1u, long>, int, int,
int, poly_int<1u, long>)
        /home/marxin/Programming/gcc/gcc/emit-rtl.cc:2421
0x190e4e3 output_iorsi3(rtx_def**)
        /home/marxin/Programming/gcc/gcc/config/m68k/m68k.cc:5513
0x1fd17bd output_255
        /home/marxin/Programming/gcc/gcc/config/m68k/m68k.md:3779
0xf64f4f get_insn_template(int, rtx_insn*)
        /home/marxin/Programming/gcc/gcc/final.cc:2029
0xf66b5e final_scan_insn_1
        /home/marxin/Programming/gcc/gcc/final.cc:2774
0xf66fd2 final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
        /home/marxin/Programming/gcc/gcc/final.cc:2887
0xf64d79 final_1
        /home/marxin/Programming/gcc/gcc/final.cc:1979
0xf69bbc rest_of_handle_final
        /home/marxin/Programming/gcc/gcc/final.cc:4240
0xf69f1a execute
        /home/marxin/Programming/gcc/gcc/final.cc:4318
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (2 preceding siblings ...)
  2023-03-30 11:20 ` marxin at gcc dot gnu.org
@ 2023-10-15 17:10 ` matthias.reis at posteo dot de
  2023-12-30 17:37 ` mikpelinux at gmail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: matthias.reis at posteo dot de @ 2023-10-15 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Matthias Reis <matthias.reis at posteo dot de> ---
I have the same problem unfortunately. Changing '-Os' into '-O2' fixes the
problem for me.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (3 preceding siblings ...)
  2023-10-15 17:10 ` matthias.reis at posteo dot de
@ 2023-12-30 17:37 ` mikpelinux at gmail dot com
  2023-12-30 17:51 ` mikpelinux at gmail dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mikpelinux at gmail dot com @ 2023-12-30 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #5 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Further reduced test case:

> cat pr108640v2.i 
int x;
void iorsi3(void) { x |= (1 << 16); }
> gcc/xgcc -Bgcc -O1 -S pr108640v2.i
during RTL pass: final
../pr108640v2.i: In function 'iorsi3':
../pr108640v2.i:2:38: internal compiler error: in change_address_1, at
emit-rtl.cc:2299
    2 | void iorsi3(void) { x |=  (1 << 16); }
      |                                      ^
0x40dc15 change_address_1
        /mnt/scratch/other/mikpe-gcc.git/gcc/emit-rtl.cc:2299
0x668f79 adjust_address_1(rtx_def*, machine_mode, poly_int<1u, long>, int, int,
int, poly_int<1u, long>)
        /mnt/scratch/other/mikpe-gcc.git/gcc/emit-rtl.cc:2433
0xd3ae93 output_iorsi3(rtx_def**)
        /mnt/scratch/other/mikpe-gcc.git/gcc/config/m68k/m68k.cc:5513
...

In output_iorsi3() the m68k backend wants to change "x |= (1 << 16)" to
"*(((char *) &x) + 1) |= 1". It calls adjust_address() to offset x by 1, but it
keeps the mode as SImode (4-byte). This address expr reaches
m68k_legitimate_constant_address_p(). On the uclinux target
M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P is 1 so it calls
offset_within_block_p(x, 4) which fails because that is out of bounds, causing
the assert in change_address_1() to fail.

The other m68k targets don't define M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P so
this works there.

The bug is that the adjust_address() call should have specified QImode as mode
since the resulting address is to be used in a 1-byte RMW operation. It gets it
right in the nearby code which rewrites to a HImode (2-byte) RMW.

output_andsi3() and output_xorsi3() have the exact same bug.

I have a patch.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (4 preceding siblings ...)
  2023-12-30 17:37 ` mikpelinux at gmail dot com
@ 2023-12-30 17:51 ` mikpelinux at gmail dot com
  2024-01-18 16:42 ` mikpelinux at gmail dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mikpelinux at gmail dot com @ 2023-12-30 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Created attachment 56965
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56965&action=edit
Preliminary patch, only tested on the test case so far.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (5 preceding siblings ...)
  2023-12-30 17:51 ` mikpelinux at gmail dot com
@ 2024-01-18 16:42 ` mikpelinux at gmail dot com
  2024-01-19 23:05 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mikpelinux at gmail dot com @ 2024-01-18 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643383.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (6 preceding siblings ...)
  2024-01-18 16:42 ` mikpelinux at gmail dot com
@ 2024-01-19 23:05 ` cvs-commit at gcc dot gnu.org
  2024-01-19 23:25 ` law at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-19 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:

https://gcc.gnu.org/g:a834414794d80f21550dd0591e260fc833f49eb9

commit r14-8298-ga834414794d80f21550dd0591e260fc833f49eb9
Author: Mikael Pettersson <mikpelinux@gmail.com>
Date:   Fri Jan 19 16:05:34 2024 -0700

    [PATCH] Avoid ICE in single-bit logical RMWs on m68k-uclinux [PR108640]

    When generating RMW logical operations on m68k, the backend
    recognizes single-bit operations and rewrites them as bit
    instructions on operands adjusted to address the intended byte.
    When offsetting the addresses the backend keeps the modes as
    SImode, even though the actual access will be in QImode.

    The uclinux target defines M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P
    which adds a check that the adjusted operand is within the bounds
    of the original object.  Since the address has been offset it is
    not, and the compiler ICEs.

    The bug is that the modes of the adjusted operands should have been
    narrowed to QImode, which is that this patch does.  Nearby code
    which narrows to HImode gets that right.

    Bootstrapped and regression tested on m68k-linux-gnu.

    Ok for master? (Note: I don't have commit rights.)

    gcc/

            PR target/108640
            * config/m68k/m68k.cc (output_andsi3): Use QImode for
            address adjusted for 1-byte RMW access.
            (output_iorsi3): Likewise.
            (output_xorsi3): Likewise.

    gcc/testsuite/

            PR target/108640
            * gcc.target/m68k/pr108640.c: New test.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (7 preceding siblings ...)
  2024-01-19 23:05 ` cvs-commit at gcc dot gnu.org
@ 2024-01-19 23:25 ` law at gcc dot gnu.org
  2024-01-20 17:22 ` pinskia at gcc dot gnu.org
  2024-02-18  9:43 ` aarnold.gcc at antonarnold dot de
  10 siblings, 0 replies; 12+ messages in thread
From: law at gcc dot gnu.org @ 2024-01-19 23:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |law at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #9 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Fixed on the trunk.  No plans to backport.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (8 preceding siblings ...)
  2024-01-19 23:25 ` law at gcc dot gnu.org
@ 2024-01-20 17:22 ` pinskia at gcc dot gnu.org
  2024-02-18  9:43 ` aarnold.gcc at antonarnold dot de
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283
  2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
                   ` (9 preceding siblings ...)
  2024-01-20 17:22 ` pinskia at gcc dot gnu.org
@ 2024-02-18  9:43 ` aarnold.gcc at antonarnold dot de
  10 siblings, 0 replies; 12+ messages in thread
From: aarnold.gcc at antonarnold dot de @ 2024-02-18  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Anton Arnold <aarnold.gcc at antonarnold dot de> ---
I applied the patch to a gcc 13.2 buildroot toolchain for a coldfire cpu with
ISA-A+ instruction set. Everything compiled fine and a linux 4.19 uclinux nommu
build with buildroot and several custom packages runs fine with no
abnormabilities. Great work, thank you for still contributing to this
architecture!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-02-18  9:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 14:51 [Bug c/108640] New: ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 aarnold.gcc at antonarnold dot de
2023-02-02 19:45 ` [Bug target/108640] " mikpelinux at gmail dot com
2023-02-02 20:59 ` mikpelinux at gmail dot com
2023-03-30 11:20 ` marxin at gcc dot gnu.org
2023-10-15 17:10 ` matthias.reis at posteo dot de
2023-12-30 17:37 ` mikpelinux at gmail dot com
2023-12-30 17:51 ` mikpelinux at gmail dot com
2024-01-18 16:42 ` mikpelinux at gmail dot com
2024-01-19 23:05 ` cvs-commit at gcc dot gnu.org
2024-01-19 23:25 ` law at gcc dot gnu.org
2024-01-20 17:22 ` pinskia at gcc dot gnu.org
2024-02-18  9:43 ` aarnold.gcc at antonarnold dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).