http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56748



Tobias Burnus <burnus at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

           Keywords|                            |diagnostic

                 CC|                            |burnus at gcc dot gnu.org

          Component|fortran                     |middle-end

            Summary|STOP statement + array      |Bogus uninitialized warning

                   |optional variable causes    |with nested if condition

                   |bogus uninitialized warning |



--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-27 
08:26:31 UTC ---

First remark: Bogus uninitialized warnings can not always be prevented. - It is

a extremely complex problem, where a few false warnings (and many missed

warnings) are unavoidable. Still, one should do better.







If one looks at the dump (-fdump-tree-original, i.e. a C-like output of the

internal representation), one sees:





mysub (struct array1_integer(kind=4) & restrict a,

       struct array1_integer(kind=4) * b)

{

...



  if (b != 0B && (integer(kind=4)[0:] * restrict) b->data != 0B)

        b.0 = (integer(kind=4)[0:D.1925] * restrict) b->data;

...

  if (b != 0B && (integer(kind=4)[0:] * restrict) b->data != 0B)

...

              if (b != 0B && (integer(kind=4)[0:] * restrict) b->data != 0B)

                {

                  // Here are some run-time checks, enabled by -fcheck=all

                }

...

          parm.10.data = (void *) &(*b.0)[0];

          _gfortran_transfer_array_write (&dt_parm.9, &parm.10, 4, 0);







As all "if" conditions are the same, b.0 is never uninitialized. However,

nesting the same "b != NULL" seems to confuse the uninitialized diagnostic.

Reply via email to