On Sunday 05 April 2009 18:56:20 Eric Botcazou wrote:
> > I'm not sure if it would work and I have idea where in trans*.c
> > you need to do this, but if you mark the tree as used with
> > something like
> >
> > TREE_USED (__result_f) = 1
> >
> > the middle-end may be silenced.
>
> I think that TREE_NO_WARNING would be more appropriate for this purpose.
I found that the warning doesn't show up if the testcase is changed:
FUNCTION f(n)
INTEGER, INTENT(in) :: n
REAL :: f
SELECT CASE (n)
CASE ( :-1); f = 0.0 ! was -1.0
CASE (0); f = 0.0
CASE (1: ); f = 0.0 ! was 1.0
END SELECT
END FUNCTION
Here, the optimizer removes the select-case completely, so it "knows" that the
full range is covered:
f (integer(kind=4) & n)
{
<bb 2>:
return 0.0;
}
Conclusion: the "default" clause in the generic case is wrong?
Daniel