Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Tom de Vries (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: Change in binutils-gdb[master]: [gdb/tdep] Fix inferior call arg passing for amd64
Date: Tue, 15 Oct 2019 09:11:00 -0000	[thread overview]
Message-ID: <20191015091117.4489629ECF@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1571043259000.Id55c74755f0a431ce31223acc86865718ae0c123@gnutoolchain-gerrit.osci.io>

Tom de Vries has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/31
......................................................................


Patch Set 1:

(1 comment)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/31/1/gdb/amd64-tdep.c 
File gdb/amd64-tdep.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/31/1/gdb/amd64-tdep.c@645 
PS1, Line 645:     theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
> If we reach here, isn't subclass[1] always NO_CLASS?  So this if would be unnecessary?
Doing:
...
   if (pos == 0)
-    theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
+    {
+      gdb_assert (subclass[1] == AMD64_NO_CLASS);
+      theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
+    }
...
gives 180 failure in gdb.base/infcall-nested-structs.exp.

The assert is triggered for the cases where amd64_classify sets theclass[1], in this test-case:
- long double
- double _Complex.

Structurewise, we have (leaving out the massive comment that makes it hard to read):
...
  theclass[pos] = amd64_merge_classes (theclass[pos], subclass[0]);
  if (bitsize <= 64 && pos == 0 && endpos == 1)
    theclass[1] = amd64_merge_classes (theclass[1], subclass[0]);
  if (pos == 0)
    theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
...
so 'reach here' means just pos == 0.

This would actually be more precise:
...
-  if (pos == 0)
+  if (pos == 0 && endpos == 1)
     theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
...
and therefore we could restructure to:
...
  theclass[pos] = amd64_merge_classes (theclass[pos], subclass[0]);
  if (pos == 0 && endpos == 1)
    {
      theclass[1] = amd64_merge_classes (theclass[1], subclass[1]);
      if (bitsize <= 64)
        theclass[1] = amd64_merge_classes (theclass[1], subclass[0]);
    }
...
But I don't think we want to do refactoring like this in this commit.



-- 
To view, visit https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/31
To unsubscribe, or for help writing mail filters, visit https://gnutoolchain-gerrit.osci.io/r/settings


  parent reply	other threads:[~2019-10-15  9:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <gerrit.1571043259000.Id55c74755f0a431ce31223acc86865718ae0c123@gnutoolchain-gerrit.osci.io>
2019-10-15  4:54 ` Simon Marchi (Code Review)
2019-10-15  9:11 ` Tom de Vries (Code Review) [this message]
2019-10-15 12:46 ` Simon Marchi (Code Review)
2019-10-15 13:05 ` Andrew Burgess (Code Review)
2019-10-15 13:52 ` Tom de Vries (Code Review)
2019-10-15 16:02 ` Simon Marchi (Code Review)

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=20191015091117.4489629ECF@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tdevries@suse.de \
    /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