This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/77343] New: ICE in dwarf2out_frame_debug_expr, at dwarf2cfi.c:1596


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

            Bug ID: 77343
           Summary: ICE in dwarf2out_frame_debug_expr, at dwarf2cfi.c:1596
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-*-*

Reduced from some kernel crypto code.

static int 
crypto_cbc_decrypt_inplace(int bsize)
{
  unsigned char last_iv[bsize];
}

when compiled with -mno-sse -mpreferred-stack-boundary=3 -ffixed-rbp:

> gcc-6 -ffixed-rbp cbc.3.i -S   -mno-sse  -mpreferred-stack-boundary=3
cbc.3.i: In function 'crypto_cbc_decrypt_inplace':
cbc.3.i:5:1: internal compiler error: in dwarf2out_frame_debug_expr, at
dwarf2cfi.c:1596
 }
 ^
0x9ccaff dwarf2out_frame_debug_expr
        /space/rguenther/src/svn/trunk/gcc/dwarf2cfi.c:1594
0x9cdc39 dwarf2out_frame_debug
        /space/rguenther/src/svn/trunk/gcc/dwarf2cfi.c:2089
0x9ce79f scan_insn_after
        /space/rguenther/src/svn/trunk/gcc/dwarf2cfi.c:2415
0x9ced75 scan_trace
        /space/rguenther/src/svn/trunk/gcc/dwarf2cfi.c:2572
0x9cee8c create_cfi_notes
        /space/rguenther/src/svn/trunk/gcc/dwarf2cfi.c:2611
0x9cf9ad execute_dwarf2_frame
        /space/rguenther/src/svn/trunk/gcc/dwarf2cfi.c:2974

The assert is

              /* Saving a register in a register.  */
              gcc_assert (!fixed_regs [REGNO (dest)]
                          /* For the SPARC and its register window.  */
                          || (dwf_regno (src) == DWARF_FRAME_RETURN_COLUMN));

not sure why it is present.  When removing it we generate the following code
which makes this wrong-code(?) because we use %rbp even though the user
specified it as fixed.  OTOH docs for -ffixed- say "except perhaps as a stack
pointer, frame pointer or in some other fixed role" which means the assert
above is over-zealous?

crypto_cbc_decrypt_inplace:
.LFB0:
        .cfi_startproc
        leaq    8(%rsp), %r10
        .cfi_def_cfa 10, 0
        andq    $-16, %rsp
        pushq   -8(%r10)
        pushq   %rbp
        .cfi_escape 0x10,0x6,0x2,0x76,0
        movq    %rsp, %rbp
        pushq   %r10
        .cfi_escape 0xf,0x3,0x76,0x78,0x6
        subq    $40, %rsp
        movl    %edi, -36(%rbp)
        movq    %rsp, %rax
        movq    %rax, %rcx
        movl    -36(%rbp), %eax
        movslq  %eax, %rdx
        subq    $1, %rdx
        movq    %rdx, -24(%rbp)
        movslq  %eax, %rdx
        movq    %rdx, %r10
        movl    $0, %r11d
        movslq  %eax, %rdx
        movq    %rdx, %r8
        movl    $0, %r9d
        cltq
        movl    $8, %edx
        subq    $1, %rdx
        addq    %rdx, %rax
        movl    $8, %esi
        movl    $0, %edx
        divq    %rsi
        imulq   $8, %rax, %rax
        subq    %rax, %rsp
        movq    %rsp, %rax
        addq    $0, %rax
        movq    %rax, -32(%rbp)
        movq    %rcx, %rsp
        nop
        movq    -8(%rbp), %r10
        .cfi_def_cfa 10, 0
        leave
        leaq    -8(%r10), %rsp
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]