public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/103047] Inconsistent arguments ordering for inlined subroutine
Date: Fri, 26 Jan 2024 14:07:57 +0000	[thread overview]
Message-ID: <bug-103047-4-tBOt3D1qZt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103047-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2024-01-26 14:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 14:13 [Bug debug/103047] New: Inconsist " liyd2021 at gmail dot com
2024-01-26 14:07 ` rguenth at gcc dot gnu.org [this message]
2024-01-29  7:47 ` [Bug debug/103047] Inconsistent " cvs-commit at gcc dot gnu.org
2024-01-29  7:47 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103047-4-tBOt3D1qZt@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).