On Sun, Apr 05, 2009 at 05:48:44PM +0200, Daniel Franke wrote: > Hi all. > > Here's another spurious(?) uninitialized warning. As the full range is > implied, the question is, if this a fortran or a middle-end problem: > > $> cat range.f90 > FUNCTION f(n) > INTEGER, INTENT(in) :: n > REAL :: f > > SELECT CASE (n) > CASE ( :-1); f = -1.0 > CASE (0); f = 0.0 > CASE (1: ); f = 1.0 > END SELECT > END FUNCTION > > $> gfortran-svn -c -O -Wall -fdump-tree-... range.f90 > range.f90: In function 'f': > range.f90:1: warning: '__result_f' may be used uninitialized in this function > > After optimization, the dump shows: > <bb 2>: > switch (*n;) <default: <L6>, case -2147483648 ... -1: <L7>, case 0: L.3, > case 1 ... 2147483647: L.4> > > Is there any way that 'default' may be reached? > Any pointers how to silence this? >
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. -- Steve