This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/66459] bogus warning 'w.offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Sep 2016 20:23:25 +0000
- Subject: [Bug fortran/66459] bogus warning 'w.offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
- Auto-submitted: auto-generated
- References: <bug-66459-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66459
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
If you do
gfortran -Wuninitialized test.f90 -fdump-tree-all-all-lineno -O1
and look at test.f90.162t.uninit1, we see:
# .MEM_24 = PHI <.MEM_15(D)(28), .MEM_68(37)>
# w$dim$1$stride_46 = PHI <w$dim$1$stride_85(D)(28), [test.f90:9:0]
w$dim$1$stride_22(37)>
# w$offset_26 = PHI <w$offset_16(D)(28), [test.f90:9:0] w$offset_56(37)>
but this code is transformed by optimization. The unoptimized SSA contains:
[test.f90:9:0] # VUSE <.MEM_18>
_22 = [test.f90:9:0] *m_21(D);
[test.f90:9:0] _23 = MAX_EXPR <_22, 0>;
[test.f90:9:0] _24 = (integer(kind=8)D.9) _23;
...
[test.f90:9:0] _39 = _24;
...
[test.f90:9:0] _68 = ~_39;
...
[test.f90:9:0] wD.3400.offsetD.3387 = _68;
and the gimple generated by Fortran contains something similar:
[test.f90:9:0] D.3429 = [test.f90:9:0] *mD.3381;
[test.f90:9:0] D.3430 = MAX_EXPR <D.3429, 0>;
[test.f90:9:0] D.3402 = (integer(kind=8)D.9) D.3430;
It seems that *mD.3381 is not initialized.
(It is very strange that gfortran converts user-defined variables to lowercase.
It makes reading the dumps more difficult. It also does many unnecessary
copies, making the code harder to analyze.)