https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86582
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #0) > By modifying main to return i, I get in addition: > ... > .uleb128 0x7 # (DIE (0x77) DW_TAG_call_site_parameter) > .uleb128 0x1 # DW_AT_location > .byte 0x55 # DW_OP_reg5 > .uleb128 0x2 # DW_AT_call_value > .byte 0x73 # DW_OP_breg3 > .sleb128 0 > ... > and then gdb prints sizeof(a) as expected. > Which makes this test-case a duplicate of PR78685, and fkeep-vars-live would help here. > This seems to be cause DW_TAG_call_site_parameter is generated based on > REG_CALL_ARG_LOCATION, and in the case without call_site_parameter we have: > ... > (call_insn 15 39 44 2 (set (reg:SI 0 ax) > (call (mem:QI (symbol_ref:DI ("f1") [flags 0x3] <function_decl > 0x7f7bc3fc2700 f1>) \ > [0 f1 S1 A8]) > (const_int 0 [0]))) "vla-1.c":19 722 {*call_value} > (expr_list:REG_CALL_ARG_LOCATION (nil) > (expr_list:REG_DEAD (reg:SI 5 di) > (expr_list:REG_EH_REGION (const_int 0 [0]) > (nil)))) > (expr_list:SI (use (reg:SI 5 di)) > (nil))) > ... > and in the case with call_site_parameter we have: > ... > (call_insn 15 14 17 2 (set (reg:SI 0 ax) > (call (mem:QI (symbol_ref:DI ("f1") [flags 0x3] <function_decl > 0x7f701d65a700 f1>) \ > [0 f1 S1 A8]) > (const_int 0 [0]))) "vla-1.c":19 722 {*call_value} > (expr_list:REG_CALL_ARG_LOCATION (expr_list:REG_DEP_TRUE (concat:SI > (reg:SI 5 di) > (reg:SI 3 bx [orig:89 i ] [89])) > (nil)) > (expr_list:REG_DEAD (reg:SI 5 di) > (expr_list:REG_EH_REGION (const_int 0 [0]) > (nil)))) > (expr_list:SI (use (reg:SI 5 di)) > (nil))) > ... > > So, why doesn't var-tracking generate the REG_CALL_ARG_LOCATION that we need? Because the register containing the arg is not guaranteed to be live across the call: ... .LVL7: # DEBUG i => 0x5 # /home/vries/gcc_versions/devel/src/gcc/testsuite/gcc.dg/guality/vla-1.c:18:3 .loc 1 18 3 movl $5, %edi .LVL8: # DEBUG i RESET # DEBUG i => di # /home/vries/gcc_versions/devel/src/gcc/testsuite/gcc.dg/guality/vla-1.c:19:3 .loc 1 19 3 # /home/vries/gcc_versions/devel/src/gcc/testsuite/gcc.dg/guality/vla-1.c:19:7 .loc 1 19 7 is_stmt 0 call f1 .LVL9: # DEBUG i RESET ... If we modify main to return i, we have instead: ... .LVL7: # DEBUG i => 0x5 # /home/vries/gcc_versions/devel/src/gcc/testsuite/gcc.dg/guality/vla-1.c:18:3 .loc 1 18 3 movl $5, %ebx .LVL8: # DEBUG i RESET # DEBUG i => bx # /home/vries/gcc_versions/devel/src/gcc/testsuite/gcc.dg/guality/vla-1.c:19:3 .loc 1 19 3 # /home/vries/gcc_versions/devel/src/gcc/testsuite/gcc.dg/guality/vla-1.c:19:7 .loc 1 19 7 is_stmt 0 movl %ebx, %edi call f1 .LVL9: ...