This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Complex overlaping expressions.
- From: Paul Brook <paul at nowt dot org>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 20 Oct 2003 15:16:56 +0100
- Subject: [tree-ssa] Complex overlaping expressions.
I'm currently seeing failures in certain fortran 95 programs which use
complex numbers. GCC doesn't seem to be correctly handling complex
expressions with overlapping source and destination.
Ie. expressions of the form A = A * B, where A and B are complex.
What seems to be happening is that the real component of A is overwritten
before the complex component of A*B is calculated.
When I write an equivalent C program, the .t05.gimple tree dump shows a
temporary has been inserted. I.e. the above has been transformed to
tmp = A; A = tmp * B;
With gfortran this doesn't seem to be happening. Am I missing something, or
is this a bug in the gimplifier/optimizers? I remember seeing various bits
of code in g77 to deal with this, so maybe it's not a new thing.
Simple cases (like the one above) seem to work ok, probably by chance.
However we sometimes generate code of the form
complex z, a;
for (i = 1; i < n; i++)
z = z * a;
Where both z and a are compiler generated temporary variables. This results
in broken code as described above.
Paul