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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-01-26
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
      Known to fail|                            |13.2.1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, still happens.  But maybe this is a also gdb issue as we have for
the similar case

static inline int foo (int a, int b)
{
  volatile int x = a + b;
  return x;
}

int main()
{
  int c = 1;
  int d = 2;
  int res = foo (c, d);
  return res;
}


 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2e>   DW_AT_external    : 1
    <2e>   DW_AT_name        : (indirect string, offset: 0x6f): main
...
 <2><79>: Abbrev Number: 5 (DW_TAG_inlined_subroutine)
    <7a>   DW_AT_abstract_origin: <0xca>
    <7e>   DW_AT_entry_pc    : 0
    <86>   DW_AT_GNU_entry_view: 4
    <87>   DW_AT_low_pc      : 0
    <8f>   DW_AT_high_pc     : 0xc
    <97>   DW_AT_call_file   : 1
    <98>   DW_AT_call_line   : 11
    <99>   DW_AT_call_column : 13
 <3><9a>: Abbrev Number: 6 (DW_TAG_formal_parameter)
    <9b>   DW_AT_abstract_origin: <0xe1>
    <9f>   DW_AT_location    : 0x27 (location list)
    <a3>   DW_AT_GNU_locviews: 0x25
 <3><a7>: Abbrev Number: 6 (DW_TAG_formal_parameter)
    <a8>   DW_AT_abstract_origin: <0xd7>
    <ac>   DW_AT_location    : 0x4d (location list)
    <b0>   DW_AT_GNU_locviews: 0x4b
...
 <1><ca>: Abbrev Number: 10 (DW_TAG_subprogram)
    <cb>   DW_AT_name        : foo
    <cf>   DW_AT_decl_file   : 1
    <d0>   DW_AT_decl_line   : 1
    <d1>   DW_AT_decl_column : 19
    <d2>   DW_AT_prototyped  : 1
    <d2>   DW_AT_type        : <0xbe>
    <d6>   DW_AT_inline      : 3        (declared as inline and inlined)
 <2><d7>: Abbrev Number: 11 (DW_TAG_formal_parameter)
    <d8>   DW_AT_name        : a
    <da>   DW_AT_decl_file   : 1
    <db>   DW_AT_decl_line   : 1
    <dc>   DW_AT_decl_column : 28
    <dd>   DW_AT_type        : <0xbe>
 <2><e1>: Abbrev Number: 11 (DW_TAG_formal_parameter)
    <e2>   DW_AT_name        : b
    <e4>   DW_AT_decl_file   : 1
    <e5>   DW_AT_decl_line   : 1
    <e6>   DW_AT_decl_column : 35
    <e7>   DW_AT_type        : <0xbe>

so it could look at the actual function for determining the order.

The order of the formal parameters are reversed because the fake
scope BLOCK the inliner adds has those as variables in that reverse order.
We output them via decls_for_scope.

static gimple *
setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
                     basic_block bb, tree *vars)
{ 
...
  /* Declare this new variable.  */
  DECL_CHAIN (var) = *vars;
  *vars = var;


I have a patch.

Reply via email to