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

           Summary: uninitialized warning present when compiled with O1
                    but not with O0
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: pascal...@parois.net


Created attachment 24593
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24593
file showing the issue

There are many other similar bugs so it might be related to an existing one.
Sorry about that.

I have a different behaviour depending of level optimisation. A warning is
issued using O1, O2, O3, Os but not with O0.

Compilation with -O1 gives a warning 
gfortran  -O1 -xf95-cpp-input -Wuninitialized  -c modules/matfile.f90 -o
modules/matfile.o
modules/matfile.f90: In function ‘solveconstraintmatrix’:
modules/matfile.f90:76:0: attention : ‘constraintsv.offset’ may be used
uninitialized in this function [-Wuninitialized]
modules/matfile.f90:76:0: attention : ‘constraintsv.dim[1].stride’ may be used
uninitialized in this function [-Wuninitialized]
modules/matfile.f90:341:0: attention : ‘constraintsv.dim[0].ubound’ may be used
uninitialized in this function [-Wuninitialized]
modules/matfile.f90:76:0: attention : ‘constraints.offset’ may be used
uninitialized in this function [-Wuninitialized]
modules/matfile.f90:405:0: attention : ‘constraints.dim[1].stride’ may be used
uninitialized in this function [-Wuninitialized]
modules/matfile.f90:405:0: attention : ‘constraints.dim[1].ubound’ may be used
uninitialized in this function [-Wuninitialized]
modules/matfile.f90:360:0: attention : ‘constraints.dim[0].ubound’ may be used
uninitialized in this function [-Wuninitialized]

whereas no warning with O0
gfortran  -O0 -xf95-cpp-input -Wuninitialized  -c modules/matfile.f90 -o
modules/matfile.o

gcc -v
Utilisation des specs internes.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configuré avec: /build/src/gcc-4.6-20110603/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --enable-gnu-unique-object
--enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto
--enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold
--disable-multilib --disable-libstdcxx-pch --enable-checking=release
Modèle de thread: posix
gcc version 4.6.0 20110603 (prerelease) (GCC) 


The source code is attached, however it is not minimal.

Reply via email to