Dirk Laurie on Fri, 24 Aug 2012 11:17:34 +0200

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

In-place update of matrix row causes lvalue error in gp2c

When gp2c compiles the following GP code:

        X[1,] += [10,20]

the corresponding line of C generated is:

        rowcopy(X, 1) = gadd(rowcopy(X, 1), p2);

This causes the error message

        error: lvalue required as left operand of assignment

The problem can be worked around by changing that line to

        X[1,] = X[1,] + [10,20]

Version information (Ubuntu 12.04):
               GP/PARI CALCULATOR Version 2.5.0 (released)
           i686 running linux (ix86/GMP kernel) 32-bit version
     compiled: Nov 17 2011, gcc-4.6.2 (Ubuntu/Linaro 4.6.2-2ubuntu1)
              (readline v6.2 enabled, extended help enabled)