[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#473167: gdc-4.1: gdc array concatenation patch



Package: gdc-4.1
Followup-For: Bug #473167

I think the attached patch should fix this. This hasn't actually been
tested on powerpc yet, as I don't have access to such a machine and my
qemu instance isn't stable enough to compile gdc. But it works fine on
amd64 :)
#! /bin/sh -e

# gdc-array-concat.dpatch by Peter De Wachter <pdewacht@gmail.com>
# DP: Fixes generation of D array concatenation calls.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        #cd ${dir}gcc && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        #rm ${dir}gcc/configure
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

--- gcc/d/d-glue.cc.orig	2008-08-01 14:09:36.000000000 +0200
+++ gcc/d/d-glue.cc	2008-08-01 14:15:57.000000000 +0200
@@ -650,7 +650,7 @@
     }
 
     n_args = 1 + (n_operands > 2 ? 1 : 0) +
-	(n_operands * (irs->splitDynArrayVarArgs ? 2 : 1));
+	n_operands * (n_operands > 2 && irs->splitDynArrayVarArgs ? 2 : 1);
     args = new tree[n_args];
     args[0] = irs->typeinfoReference(type);
     if (n_operands > 2)
@@ -673,7 +673,7 @@
 	    }
 	    else
 		array_exp = irs->toDArray(oe);
-	    if (irs->splitDynArrayVarArgs)
+	    if (n_operands > 2 && irs->splitDynArrayVarArgs)
 	    {
 		array_exp = irs->maybeMakeTemp(array_exp);
 		args[ai--] = irs->darrayPtrRef(array_exp); // note: filling array


Reply to: