public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/80786] m68k: internal compiler error: in change_address_1
       [not found] <bug-80786-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-18 15:35 ` mikpelinux at gmail dot com
  2023-08-06 21:06 ` giulio.benetti at benettiengineering dot com
  2024-01-01 15:30 ` mikpelinux at gmail dot com
  2 siblings, 0 replies; 3+ messages in thread
From: mikpelinux at gmail dot com @ 2021-07-18 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Still ICEs gcc-12. m68k_legitimate_address_p () returns false for

(const:SI (plus:SI (symbol_ref:SI ("G") [flags 0x40] <var_decl 0x7f80af24f120
G>)
        (const_int 6 [0x6])))
mode 4 (QI is 4)

which triggers the assert failure in change_address_1 ().

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

* [Bug target/80786] m68k: internal compiler error: in change_address_1
       [not found] <bug-80786-4@http.gcc.gnu.org/bugzilla/>
  2021-07-18 15:35 ` [Bug target/80786] m68k: internal compiler error: in change_address_1 mikpelinux at gmail dot com
@ 2023-08-06 21:06 ` giulio.benetti at benettiengineering dot com
  2024-01-01 15:30 ` mikpelinux at gmail dot com
  2 siblings, 0 replies; 3+ messages in thread
From: giulio.benetti at benettiengineering dot com @ 2023-08-06 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

Giulio Benetti <giulio.benetti at benettiengineering dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giulio.benetti@benettiengin
                   |                            |eering.com

--- Comment #3 from Giulio Benetti <giulio.benetti at benettiengineering dot com> ---
This bug still shows up on Gcc 13.2.0

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

* [Bug target/80786] m68k: internal compiler error: in change_address_1
       [not found] <bug-80786-4@http.gcc.gnu.org/bugzilla/>
  2021-07-18 15:35 ` [Bug target/80786] m68k: internal compiler error: in change_address_1 mikpelinux at gmail dot com
  2023-08-06 21:06 ` giulio.benetti at benettiengineering dot com
@ 2024-01-01 15:30 ` mikpelinux at gmail dot com
  2 siblings, 0 replies; 3+ messages in thread
From: mikpelinux at gmail dot com @ 2024-01-01 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpelinux at gmail dot com> changed:

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

--- Comment #4 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Reduced test case:

> cat /tmp/pr80786.c
extern long G[];

void dir_op(short op, short *dirs)
{
    if (!op)
        *dirs = G[1];
}
> gcc/xgcc -Bgcc -O2 -mpcrel -S /tmp/pr80786.c
during RTL pass: final
/tmp/pr80786.c: In function 'dir_op':
/tmp/pr80786.c:7:1: internal compiler error: in change_address_1, at
emit-rtl.cc:2299
    7 | }
      | ^
0x40dc15 change_address_1
        /mnt/scratch/other/mikpe-gcc.git/gcc/emit-rtl.cc:2299
0x668fc9 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
0x10c2ea2 output_80
        /mnt/scratch/other/mikpe-gcc.git/gcc/config/m68k/m68k.md:1678
...

This is gcc-14 from 2023-12-30, and output_80 is m68k.md's truncsihi2 insn.

The source operand is

(mem:SI (const:SI (plus:SI (symbol_ref:SI ("G") [flags 0x40] <var_decl
0x7f3eb88f1000 G>)
            (const_int 4 [0x4]))) [1 G[1]+0 S4 A16])

which truncsihi2 wants to adjust by adding 2 to the offset, but

(const:SI (plus:SI (symbol_ref:SI ("G") [flags 0x40] <var_decl 0x7f3eb88f1000
G>)
        (const_int 6 [0x6])))

is rejected by m68k_legitimate_constant_address_p, causing
m68k_decompose_address to fail, and the assert in change_address_1 to fire.

Disabling this insn for TARGET_PCREL seems to work, but I don't know what
negative side-effects that might have.

gcc-4.9 and older were ok, gcc-5 and above ICE, starting with

aea3d681ec784b1a44ee3b37b0df2b71bdfadfc3 is the first new commit
commit aea3d681ec784b1a44ee3b37b0df2b71bdfadfc3
Author: DJ Delorie <dj@redhat.com>
Date:   Fri Aug 29 19:19:42 2014 -0400

    expr.c (convert_move): If the target has an explicit converter, use it.

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

end of thread, other threads:[~2024-01-01 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-80786-4@http.gcc.gnu.org/bugzilla/>
2021-07-18 15:35 ` [Bug target/80786] m68k: internal compiler error: in change_address_1 mikpelinux at gmail dot com
2023-08-06 21:06 ` giulio.benetti at benettiengineering dot com
2024-01-01 15:30 ` mikpelinux at gmail dot com

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).