public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113043] New: ICE: in emit_move_insn, at expr.cc:4246
@ 2023-12-16  4:33 iamanonymous.cs at gmail dot com
  2023-12-17 17:53 ` [Bug sanitizer/113043] ICE: in emit_move_insn, at expr.cc:4246 with interrupt attribute and x32 ubizjak at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: iamanonymous.cs at gmail dot com @ 2023-12-16  4:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113043
           Summary: ICE: in emit_move_insn, at expr.cc:4246
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/erY5Mrrso

*******************************************************************************
OS and Platform:
$ uname -a:
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
*******************************************************************************
Program:
$ cat mutant.c
struct a {
  long b
};
__attribute__((interrupt)) void c(struct a *d) { 1 != d->b; }

*******************************************************************************
Command Lines:
$ gcc -mx32 -mgeneral-regs-only -maddress-mode=long -fsanitize=undefined
mutant.c
mutant.c:3:1: warning: no semicolon at end of struct or union
    3 | };
      | ^
during RTL pass: expand
mutant.c: In function ‘c’:
mutant.c:4:56: internal compiler error: in emit_move_insn, at expr.cc:4246
    4 | __attribute__((interrupt)) void c(struct a *d) { 1 != d->b; }
      |                                                       ~^~~
0x774d50 emit_move_insn(rtx_def*, rtx_def*)
        ../../gcc/gcc/expr.cc:4246
0xaddfec expand_gimple_stmt_1
        ../../gcc/gcc/cfgexpand.cc:4011
0xaddfec expand_gimple_stmt
        ../../gcc/gcc/cfgexpand.cc:4045
0xadec97 expand_gimple_basic_block
        ../../gcc/gcc/cfgexpand.cc:6101
0xae08f6 execute
        ../../gcc/gcc/cfgexpand.cc:6836
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] 2+ messages in thread

* [Bug sanitizer/113043] ICE: in emit_move_insn, at expr.cc:4246 with interrupt attribute and x32
  2023-12-16  4:33 [Bug target/113043] New: ICE: in emit_move_insn, at expr.cc:4246 iamanonymous.cs at gmail dot com
@ 2023-12-17 17:53 ` ubizjak at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: ubizjak at gmail dot com @ 2023-12-17 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |sanitizer
   Last reconfirmed|                            |2023-12-17
     Ever confirmed|0                           |1
                 CC|                            |dodji at gcc dot gnu.org,
                   |                            |dvyukov at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org,
                   |                            |kcc at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Middle-end is calling emit_move_insn from:

(gdb) f 3
#3  0x0000000000aac95c in expand_gimple_stmt_1 (stmt=0x7fffe9fe70a0) at
../../git/gcc/gcc/cfgexpand.cc:4030
4030                      emit_move_insn (target, temp);
(gdb) list
4026                else
4027                  {
4028                    temp = force_operand (temp, target);
4029                    if (temp != target)
4030                      emit_move_insn (target, temp);
4031                  }

target = 
(reg:SI 99 [ _5 ])

temp = 
(mem/f/c:DI (plus:DI (reg/f:DI 93 virtual-stack-vars)
        (const_int -8 [0xfffffffffffffff8])) [8 d+0 S4 A32])

and triggeres gcc_assert in emit_move_insn due to mode mismatch.

This happens when expanding:

  unsigned int _5;

  __builtin___ubsan_handle_type_mismatch_v1 (&*.Lubsan_data0, _5);

where sanitizer builtin expects PTR.

DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
                      "__ubsan_handle_type_mismatch_v1",
                      BT_FN_VOID_PTR_PTR,
                      ATTR_COLD_NOTHROW_LEAF_LIST)

Confirmed as a sanitizer issue.

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

end of thread, other threads:[~2023-12-17 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-16  4:33 [Bug target/113043] New: ICE: in emit_move_insn, at expr.cc:4246 iamanonymous.cs at gmail dot com
2023-12-17 17:53 ` [Bug sanitizer/113043] ICE: in emit_move_insn, at expr.cc:4246 with interrupt attribute and x32 ubizjak 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).