Hello,
the uninit-13.c testcase fails on s390 and s390x:
1 /* { dg-do compile } */
2 /* { dg-options "-O -Wuninitialized" } */
3
4 typedef _Complex float C;
5 C foo()
6 {
7 C f;
8 __imag__ f = 0; /* { dg-warning "is used" "unconditional" } */
9 return f;
10 }
On s390 and s390x the reported line number in the warning is 7 which
is indeed a bit surprising. But anyway also the expected line number
of the warning does not look correct to me. The "uninitialized use"
of the real part of f is done in line 9 so I'm a bit surprised that we
expect the warning to be issued for line 8? I think the dg-warning
directive should be moved one line downwards.
But S/390 reveals another problem here since we do not return complex
numbers in registers. Therefore aggregate_value_p in
gimplify_return_expr returns true and an additional copy statement for
the result is generated:
foo ()
[uninit-13.c : 10] {
float D.1203;
C f;
[uninit-13.c : 8] D.1203 = REALPART_EXPR <f>;
[uninit-13.c : 8] f = COMPLEX_EXPR <D.1203, 0.0>;
[uninit-13.c : 9] <retval> = f;
[uninit-13.c : 9] return <retval>;
}
The <retval> = f; statement is then lowered by tree-complex to:
foo ()
{
float f$real;
C f;
float D.1203;
<bb 2>:
[uninit-13.c : 8] f$real_2 = f$real_6(D);
[uninit-13.c : 8] f_3 = COMPLEX_EXPR <f$real_2, 0.0>;
REALPART_EXPR <<retval>> = f$real_2;
[uninit-13.c : 9] IMAGPART_EXPR <<retval>> = 0.0;
return <retval>;
}
Note that the write to the imaginary part is assigned to a different
source code location. expand_complex_move in tree-complex.c issues the
real part move before the original statement but re-uses the original
statement for the move of the imaginary part.
Replacing __imag__ with __real__ in the testcase causes a warning to
be issued for line 9 instead of 7. So I can hit the two lines
surrounding the expected line :)
Should we do something about this for GCC 4.3 or just XFAIL the
testcases for s390 and s390x?
Bye,
-Andreas-