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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, ra
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
          Component|c                           |rtl-optimization
      Known to work|                            |4.8.5
   Target Milestone|---                         |7.3
            Summary|x86-64 -Wclobbered issuing  |[6/7/8 Regression] x86-64
                   |more false alarms           |-Wclobbered issuing more
                   |(regression)                |false alarms (regression)

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hm, so the warning just does

static void
setjmp_args_warning (bitmap setjmp_crosses)
{
  tree decl;
  for (decl = DECL_ARGUMENTS (current_function_decl);
       decl; decl = DECL_CHAIN (decl))
    if (DECL_RTL (decl) != 0
        && REG_P (DECL_RTL (decl))
        && regno_clobbered_at_setjmp (setjmp_crosses, REGNO (DECL_RTL (decl))))
      warning (OPT_Wclobbered,
               "argument %q+D might be clobbered by %<longjmp%> or %<vfork%>",
               decl);

and thus looks whether the PARM_DECL is expanded as a register and is
regno_clobbered_at_setjmp.  But it seems to fail to exclude call clobbered
registers as we can see we spill those regs:

module_vec_set:
.LFB0:
        .cfi_startproc
        subq    $40, %rsp
        .cfi_def_cfa_offset 48
        movq    %rdi, 8(%rsp)
        movl    $jb, %edi
        movq    %rsi, 16(%rsp)
        movq    %rdx, 24(%rsp)
        call    _setjmp
        testl   %eax, %eax
        jne     .L1
        xorl    %eax, %eax
        cmpb    $0, module_assertions(%rip)
        movq    24(%rsp), %rcx
        movq    16(%rsp), %rsi
...

/* True if register REGNO was alive at a place where `setjmp' was
   called and was set more than once or is an argument.  Such regs may
   be clobbered by `longjmp'.  */

static bool
regno_clobbered_at_setjmp (bitmap setjmp_crosses, int regno)

I don't really understand what this is about.  At least call clobbered
regs should get spilled so this should be about callee saved ones only?

Reply via email to