aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZak Kipling <zak@transversal.com>2004-11-13 15:09:08 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-11-13 15:09:08 -0800
commite8112eacf708ba210c298d2419266ddc3c632aad (patch)
treed9b60808275c4fd178560f0cf55bf07c7f2c3795 /gcc
parent595163db430ae9e2d23ee5214dda68fb06e8b5bb (diff)
downloadgcc-e8112eacf708ba210c298d2419266ddc3c632aad.zip
gcc-e8112eacf708ba210c298d2419266ddc3c632aad.tar.gz
gcc-e8112eacf708ba210c298d2419266ddc3c632aad.tar.bz2
re PR target/18300 (Infinite loop when passing object with 3+ base classes by value)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/i386.c12
-rw-r--r--gcc/testsuite/g++.dg/other/infloop-1.C16
3 files changed, 29 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3630a10..ba8cdf2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5f45e42..089957e 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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
index 0000000..6c851c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/infloop-1.C
@@ -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());
+}
+