]> gcc.gnu.org Git - gcc.git/commitdiff
re PR target/18300 (Infinite loop when passing object with 3+ base classes by value)
authorZak Kipling <zak@transversal.com>
Sat, 13 Nov 2004 23:09:08 +0000 (15:09 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 13 Nov 2004 23:09:08 +0000 (15:09 -0800)
        PR target/18300
        * config/i386/i386.c (classify_argument): Fix infinite loop when
        passing object with 3 or more base classes by value.

From-SVN: r90600

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/g++.dg/other/infloop-1.C [new file with mode: 0644]

index 3630a10d72018527bf6cf519591c17645b4d1645..ba8cdf2bff0ad97a6c375a3f56be3907f0c40aae 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-13  Zak Kipling  <zak@transversal.com>
+
+       PR target/18300
+       * config/i386/i386.c (classify_argument): Fix infinite loop when
+       passing object with 3 or more base classes by value.
+
 2004-11-13  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * doc/md.texi (constraints) <% modifier>: Mention that it is
@@ -79,7 +85,7 @@
        * doc/rtl.texi (INSN_DEAD_CODE_P, REG_LOOP_TEST_P): Remove.
 
 2004-11-13  James A. Morrison  <phython@gcc.gnu.org>
-            Eric Botcazou  <ebotcazou@libertysurf.fr>
+           Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR target/18230
        * config/sparc/sparc.c (sparc_rtx_costs): Handle the NAND vector
index 5f45e4295e88f9cb44c049b8cc0b98204abbc1f0..089957e830b921f109e7947ffdf1772a5984de55 100644 (file)
@@ -2117,10 +2117,10 @@ classify_argument (enum machine_mode mode, tree type,
          if (TYPE_BINFO (type))
            {
              tree binfo, base_binfo;
-             int i;
+             int basenum;
 
-             for (binfo = TYPE_BINFO (type), i = 0;
-                  BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
+             for (binfo = TYPE_BINFO (type), basenum = 0;
+                  BINFO_BASE_ITERATE (binfo, basenum, base_binfo); basenum++)
                {
                   int num;
                   int offset = tree_low_cst (BINFO_OFFSET (base_binfo), 0) * 8;
@@ -2204,10 +2204,10 @@ classify_argument (enum machine_mode mode, tree type,
          if (TYPE_BINFO (type))
            {
              tree binfo, base_binfo;
-             int i;
+             int basenum;
 
-             for (binfo = TYPE_BINFO (type), i = 0;
-                  BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
+             for (binfo = TYPE_BINFO (type), basenum = 0;
+                  BINFO_BASE_ITERATE (binfo, basenum, base_binfo); basenum++)
                {
                   int num;
                   int offset = tree_low_cst (BINFO_OFFSET (base_binfo), 0) * 8;
diff --git a/gcc/testsuite/g++.dg/other/infloop-1.C b/gcc/testsuite/g++.dg/other/infloop-1.C
new file mode 100644 (file)
index 0000000..6c851c7
--- /dev/null
@@ -0,0 +1,16 @@
+// PR 18300: This sends old compilers into an infinite loop on x86_64
+// Testcase and patch contributed by Zak Kipling <zak@transversal.com>
+
+struct base1 { };
+struct base2 { };
+struct base3 { };
+
+struct derived : base1, base2, base3 { };
+
+void foo(derived);
+
+int main()
+{
+  foo(derived());
+}
+
This page took 0.1079 seconds and 5 git commands to generate.