public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mikpelinux at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108640] ICE compiling busybox for m68k in change_address_1, at emit-rtl.cc:2283 Date: Sat, 30 Dec 2023 17:37:36 +0000 [thread overview] Message-ID: <bug-108640-4-z4C1vYmxyU@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108640-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2023-12-30 17:37 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-02 14:51 [Bug c/108640] New: " 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 [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108640-4-z4C1vYmxyU@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).