public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value
@ 2004-11-04 18:34 zak at transversal dot com
  2004-11-04 18:35 ` [Bug target/18300] " zak at transversal dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zak at transversal dot com @ 2004-11-04 18:34 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/18300] Infinite loop when passing object with 3+ base classes by value
  2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
@ 2004-11-04 18:35 ` zak at transversal dot com
  2004-11-04 18:53 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: zak at transversal dot com @ 2004-11-04 18:35 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |compile-time-hog
      Known to fail|                            |3.2.3 3.3.3 3.3.4 3.3.5


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/18300] Infinite loop when passing object with 3+ base classes by value
  2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-04 18:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-04 18:53 -------
*** Bug 14591 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kong at ece dot ucdavis dot
                   |                            |edu


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/18300] Infinite loop when passing object with 3+ base classes by value
  2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-04 18:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-04 18:54 -------
Confimred via PR 14591.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-04 18:54:36
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/18300] Infinite loop when passing object with 3+ base classes by value
  2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: zak at transversal dot com @ 2004-11-10 12:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zak at transversal dot com  2004-11-10 12:36 -------
I've submitted a patch which fixes this:

http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00811.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
      Known to fail|3.2.3 3.3.3 3.3.4 3.3.5     |3.2.3 3.3.3 3.3.4 3.3.5
                   |                            |3.4.2 4.0.0


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/18300] Infinite loop when passing object with 3+ base classes by value
  2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: zak at transversal dot com @ 2004-11-12 16:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zak at transversal dot com  2004-11-12 16:33 -------
Amended patch:

http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00948.html

-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/18300] Infinite loop when passing object with 3+ base classes by value
  2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-13 23:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-13 23:09 -------
Subject: Bug 18300

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-11-13 23:09:08

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386.c 
Added files:
	gcc/testsuite/g++.dg/other: infloop-1.C 

Log message:
	PR target/18300
	* config/i386/i386.c (classify_argument): Fix infinite loop when
	passing object with 3 or more base classes by value.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6322&r2=2.6323
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.736&r2=1.737
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/infloop-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/18300] Infinite loop when passing object with 3+ base classes by value
  2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
                   ` (5 preceding siblings ...)
  2004-11-13 23:09 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-13 23:31 ` giovannibajo at libero dot it
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-11-13 23:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-11-13 23:31 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-11-13 23:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-04 18:34 [Bug target/18300] New: Infinite loop when passing object with 3+ base classes by value zak at transversal dot com
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

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).