public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/82420] ICE with -malign-int and -m68000
       [not found] <bug-82420-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-18 14:34 ` mikpelinux at gmail dot com
  2024-01-03 16:01 ` mikpelinux at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: mikpelinux at gmail dot com @ 2021-07-18 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Still ICEs in gcc-12:

> gcc/xgcc -Bgcc -march=68000 -malign-int -S /tmp/pr82420.c
during RTL pass: expand
/tmp/pr82420.c: In function 'f':
/tmp/pr82420.c:3:4: internal compiler error: Segmentation fault
    3 |  a /= 3;
      |    ^~
0x95fe3f crash_signal
        /tmp/gcc-12-20210711/gcc/toplev.c:328
0x6c30a2 assign_temp(tree_node*, int, int)
        /tmp/gcc-12-20210711/gcc/function.c:976
0x67e321 emit_push_insn(rtx_def*, machine_mode, tree_node*, rtx_def*, unsigned
int, int, rtx_def*, poly_int<1u, long>, rtx_def*, rtx_def*, int, rtx_def*,
bool)
        /tmp/gcc-12-20210711/gcc/expr.c:4621
0x559c98 emit_library_call_value_1(int, rtx_def*, rtx_def*, libcall_type,
machine_mode, int, std::pair<rtx_def*, machine_mode>*)
        /tmp/gcc-12-20210711/gcc/calls.c:5595
0x86de22 emit_library_call_value(rtx_def*, rtx_def*, libcall_type,
machine_mode, rtx_def*, machine_mode, rtx_def*, machine_mode)
        /tmp/gcc-12-20210711/gcc/rtl.h:4390
0x86de22 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*,
int, optab_methods)
        /tmp/gcc-12-20210711/gcc/optabs.c:2172
0x86f9e6 sign_expand_binop(machine_mode, optab_tag, optab_tag, rtx_def*,
rtx_def*, rtx_def*, int, optab_methods)
        /tmp/gcc-12-20210711/gcc/optabs.c:2304
0x665e44 expand_divmod(int, tree_code, machine_mode, rtx_def*, rtx_def*,
rtx_def*, int, optab_methods)
        /tmp/gcc-12-20210711/gcc/expmed.c:5271
0x66fdad expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        /tmp/gcc-12-20210711/gcc/expr.c:9473
0x57296a expand_gimple_stmt_1
        /tmp/gcc-12-20210711/gcc/cfgexpand.c:3980
0x57296a expand_gimple_stmt
        /tmp/gcc-12-20210711/gcc/cfgexpand.c:4041
0x577392 expand_gimple_basic_block
        /tmp/gcc-12-20210711/gcc/cfgexpand.c:6083
0x579196 execute
        /tmp/gcc-12-20210711/gcc/cfgexpand.c:6809
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 SEGV occurs because emit_library_call_value_1 () [calls.c line 5595] calls
emit_push_insn () with NULL_TREE for TYPE, emit_push_insn () in this test case
needs to call assign_temp () [expr.c line 4621] with the given TYPE, but
assign_temp () fundamentally requires a non-NULL_TREE TYPE.

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

* [Bug target/82420] ICE with -malign-int and -m68000
       [not found] <bug-82420-4@http.gcc.gnu.org/bugzilla/>
  2021-07-18 14:34 ` [Bug target/82420] ICE with -malign-int and -m68000 mikpelinux at gmail dot com
@ 2024-01-03 16:01 ` mikpelinux at gmail dot com
  2024-01-04  9:28 ` mikpelinux at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: mikpelinux at gmail dot com @ 2024-01-03 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Created attachment 56985
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56985&action=edit
proposed fix

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

* [Bug target/82420] ICE with -malign-int and -m68000
       [not found] <bug-82420-4@http.gcc.gnu.org/bugzilla/>
  2021-07-18 14:34 ` [Bug target/82420] ICE with -malign-int and -m68000 mikpelinux at gmail dot com
  2024-01-03 16:01 ` mikpelinux at gmail dot com
@ 2024-01-04  9:28 ` mikpelinux at gmail dot com
  2024-01-18 16:44 ` mikpelinux at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: mikpelinux at gmail dot com @ 2024-01-04  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

* [Bug target/82420] ICE with -malign-int and -m68000
       [not found] <bug-82420-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2024-01-04  9:28 ` mikpelinux at gmail dot com
@ 2024-01-18 16:44 ` mikpelinux at gmail dot com
  2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
  2024-01-21 23:02 ` law at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: mikpelinux at gmail dot com @ 2024-01-18 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Updated patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643139.html

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

* [Bug target/82420] ICE with -malign-int and -m68000
       [not found] <bug-82420-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2024-01-18 16:44 ` mikpelinux at gmail dot com
@ 2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
  2024-01-21 23:02 ` law at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-21 22:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:bdcf7226c9fe87352466eb9a6bfc58fa24b3e5e1

commit r14-8324-gbdcf7226c9fe87352466eb9a6bfc58fa24b3e5e1
Author: Mikael Pettersson <mikpelinux@gmail.com>
Date:   Sun Jan 21 15:55:49 2024 -0700

    Re: [PATCH] Avoid ICE with m68k-elf -malign-int and libcalls

    >> emit_library_call_value_1 calls emit_push_insn with NULL_TREE
    >> for TYPE.  Sometimes emit_push_insn needs to assign a temp with
    >> that TYPE, which causes a segfault.
    >>
    >> Fixed by computing the TYPE from MODE when needed.
    >>
    >> Original patch by Thorsten Otto.
    >>
    [ ... ]
    > This really needs to happen in the two call paths which pass in
    > NULL_TREE for the type.  Note how the type is used to determine padding
    > earlier in emit_push_insn.  That would also make the code more
    > consistent with the comment before emit_push_insn which implies that
    > both MODE and TYPE are valid.
    >
    >
    > Additionally you should bootstrap and regression test this patch on at
    > least one target.

    Updated as requested, and bootstrapped and tested on
    {x86_64,aarch64,m68k}-linux-gnu without regressions.

    gcc/

            PR target/82420
            PR target/111279
            * calls.cc (emit_library_call_value_1): Pass valid TYPE
            to emit_push_insn.
            * expr.cc (emit_push_insn): Likewise.

    gcc/testsuite/

            PR target/82420
            * gcc.target/m68k/pr82420.c: New test.

                Co-authored-by: Thorsten Otto  <admin@tho-otto.de>

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

* [Bug target/82420] ICE with -malign-int and -m68000
       [not found] <bug-82420-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
@ 2024-01-21 23:02 ` law at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu.org @ 2024-01-21 23:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.0
                 CC|                            |law at gcc dot gnu.org

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

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

end of thread, other threads:[~2024-01-21 23:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-82420-4@http.gcc.gnu.org/bugzilla/>
2021-07-18 14:34 ` [Bug target/82420] ICE with -malign-int and -m68000 mikpelinux at gmail dot com
2024-01-03 16:01 ` mikpelinux at gmail dot com
2024-01-04  9:28 ` mikpelinux at gmail dot com
2024-01-18 16:44 ` mikpelinux at gmail dot com
2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
2024-01-21 23:02 ` law at gcc dot gnu.org

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