https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120589
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by H.J. Lu <h...@gcc.gnu.org>: https://gcc.gnu.org/g:11059b4a4e8d4a19e7b554817f7cf0f68e3d54bb commit r16-1493-g11059b4a4e8d4a19e7b554817f7cf0f68e3d54bb Author: H.J. Lu <hjl.to...@gmail.com> Date: Sun Jun 8 14:23:09 2025 +0800 mcore: Don't use gen_rtx_MEM on __attribute__((dllimport)) On mcore-elf, mcore_mark_dllimport generated (gdb) call debug_tree (decl) <function_decl 0x7fffe9941200 f1 type <function_type 0x7fffe981f000 type <void_type 0x7fffe98180a8 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe98180a8 pointer_to_this <pointer_type 0x7fffe9818150>> HI size <integer_cst 0x7fffe9802738 constant 16> unit-size <integer_cst 0x7fffe9802750 constant 2> align:16 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe981f000 arg-types <tree_list 0x7fffe980b988 value <void_type 0x7fffe98180a8 void>> pointer_to_this <pointer_type 0x7fffe991b0a8>> addressable used public external decl_5 SI /tmp/x.c:1:40 align:16 warn_if_not_align:0 context <translation_unit_decl 0x7fffe9955080 /tmp/x.c> attributes <tree_list 0x7fffe9932708 purpose <identifier_node 0x7fffe9954000 dllimport>> (mem:SI (mem:SI (symbol_ref:SI ("@i.__imp_f1")) [0 S4 A32]) [0 S4 A32]) chain <function_decl 0x7fffe9941300 f2>> which caused: (gdb) bt file=0x2c0f1c8 "/export/gnu/import/git/sources/gcc-test/gcc/calls.cc", line=3746, function=0x2c0f747 "expand_call") at /export/gnu/import/git/sources/gcc-test/gcc/diagnostic.cc:1780 target=0x0, ignore=1) at /export/gnu/import/git/sources/gcc-test/gcc/calls.cc:3746 ... (gdb) call debug_rtx (datum) (mem:SI (symbol_ref:SI ("@i.__imp_f1")) [0 S4 A32]) (gdb) Don't use gen_rtx_MEM in mcore_mark_dllimport to generate (gdb) call debug_tree (fndecl) <function_decl 0x7fffe9941200 f1 type <function_type 0x7fffe981f000 type <void_type 0x7fffe98180a8 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe98180a8 pointer_to_this <pointer_type 0x7fffe9818150>> HI size <integer_cst 0x7fffe9802738 constant 16> unit-size <integer_cst 0x7fffe9802750 constant 2> align:16 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe981f000 arg-types <tree_list 0x7fffe980b988 value <void_type 0x7fffe98180a8 void>> pointer_to_this <pointer_type 0x7fffe991b0a8>> addressable used public external decl_5 SI /tmp/x.c:1:40 align:16 warn_if_not_align:0 context <translation_unit_decl 0x7fffe9955080 /tmp/x.c> attributes <tree_list 0x7fffe9932708 purpose <identifier_node 0x7fffe9954000 dllimport>> (mem:SI (symbol_ref:SI ("@i.__imp_f1")) [0 S4 A32]) chain <function_decl 0x7fffe9941300 f2>> (gdb) instead. This fixes: gcc.c-torture/compile/dll.c -O0 (internal compiler error: in assemble_variable, at varasm.cc:2544) gcc.dg/visibility-12.c (internal compiler error: in expand_call, at calls.cc:3744) for more-elf. PR target/120589 * config/mcore/mcore.cc (mcore_mark_dllimport): Don't use gen_rtx_MEM. Signed-off-by: H.J. Lu <hjl.to...@gmail.com>