public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zak at transversal dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value
Date: Thu, 04 Nov 2004 18:34:00 -0000	[thread overview]
Message-ID: <20041104183401.18300.zak@transversal.com> (raw)

On x86_64 (but not on i686) the following legal code sends gcc 3.2.3, 3.3.4 and
current 3.3-branch CVS into an infinite loop.

/////////////////////////////////////////

struct Base1 { };
struct Base2 { };
struct Base3 { };

struct Derived : Base1, Base2, Base3 { };

void foo(Derived);

int main()
{
  foo(Derived());
}

//////////////////////////////////////////


The problem appears to be in classify_argument in gcc/config/i386.c: in both the
 RECORD_TYPE and UNION_TYPE branches, the same loop variable (i) is used in two
nested loops. I'm not sure I fully understand this code, but it seems unlikely
that this is the intention. I'm also not sure if it's possible for this to
result in other failure modes besides the infinite loop, although it certainly
seems possible.

Using two distinct loop variables appears to fix the problem -- a patch will
follow after I've done testsuite runs on current CVS. (Looking at the source,
the above problem appears to still be present on the 3.4 branch and CVS HEAD,
although I've not tested there yet.)

-- 
           Summary: Infinite loop when passing object with 3+ base classes
                    by value
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zak at transversal dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18300


             reply	other threads:[~2004-11-04 18:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-04 18:34 zak at transversal dot com [this message]
2004-11-04 18:35 ` [Bug target/18300] " zak at transversal dot com
2004-11-04 18:53 ` pinskia at gcc dot gnu dot org
2004-11-04 18:54 ` pinskia at gcc dot gnu dot org
2004-11-10 12:36 ` zak at transversal dot com
2004-11-12 16:33 ` zak at transversal dot com
2004-11-13 23:09 ` cvs-commit at gcc dot gnu dot org
2004-11-13 23:31 ` giovannibajo at libero dot it

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=20041104183401.18300.zak@transversal.com \
    --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).