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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i?86-*-*
   Last reconfirmed|                            |2024-01-24
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
   Target Milestone|---                         |14.0
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
With -m32 only.  Code generated is

Dump of assembler code for function foo:
   0x080483ef <+0>:     push   %ebp
   0x080483f0 <+1>:     mov    %esp,%ebp
   0x080483f2 <+3>:     push   %ebx
   0x080483f3 <+4>:     sub    $0x4,%esp
   0x080483f6 <+7>:     mov    0xc(%ebp),%eax
   0x080483f9 <+10>:    add    $0xf,%eax
   0x080483fc <+13>:    and    $0xfffffff0,%eax
   0x080483ff <+16>:    sub    %eax,%esp
   0x08048401 <+18>:    mov    %esp,%ebx
   0x08048403 <+20>:    sub    $0x8,%esp
   0x08048406 <+23>:    push   $0x2
   0x08048408 <+25>:    push   %ebx
   0x08048409 <+26>:    call   0x80483e6 <bar>
=> 0x0804840e <+31>:    add    $0x8,%esp
   0x08048411 <+34>:    push   $0x4
   0x08048413 <+36>:    push   %ebx
   0x08048414 <+37>:    call   0x80483e6 <bar>
   0x08048419 <+42>:    add    $0x10,%esp
   0x0804841c <+45>:    mov    -0x4(%ebp),%ebx
   0x0804841f <+48>:    leave  
   0x08048420 <+49>:    ret    

the PC is where the function arguments and the 'c' stack local are no
longer visible to gdb.  Code generation without the changes is the same
so it's very likely var-tracking that is affected by the alias analysis
changes possibly no longer disambiguating stack operations.  In fact
after the

   push $0x2

the variables are gone (I would have expected the call here).  The
pushes are

(insn 22 21 23 2 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [2  S4 A32])
        (const_int 2 [0x2]))
"/space/rguenther/src/gcc/gcc/testsuite/gcc.dg/guality/pr54796.c":16:3 60
{*pushsi2}
     (expr_list:REG_ARGS_SIZE (const_int 12 [0xc])
        (nil)))
(insn 23 22 24 2 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [1  S4 A32])
        (reg/f:SI 3 bx [108]))
"/space/rguenther/src/gcc/gcc/testsuite/gcc.dg/guality/pr54796.c":16:3 60
{*pushsi2}
     (expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
        (nil)))

but the SP operation that's likely problematical is the feeding

(insn 16 15 17 2 (parallel [
            (set (reg/f:SI 7 sp)
                (minus:SI (reg/f:SI 7 sp)
                    (reg:SI 0 ax [107])))
            (clobber (reg:CC 17 flags))
        ])
"/space/rguenther/src/gcc/gcc/testsuite/gcc.dg/guality/pr54796.c":15:8 361
{*subsi_1}
     (expr_list:REG_DEAD (reg:SI 0 ax [107])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

but we must come here via VALUE and

      if (cselib_sp_based_value_p (val))
        return static_reg_base_value[STACK_POINTER_REGNUM];

should still deal with this then (var-tracking sets this flag).

Reply via email to