By compiling the attached files I get a warning like this: ./some_package-some_seperate_package.adb: In function 'SOME_PACKAGE.SOME_SEPERATE_PACKAGE.GET_STATE': ./some_package-some_seperate_package.adb:22: warning: 'state_infos.current_state' is used uninitialized in this function
but I think there should be no warning at all. It seems it takes several conditions to trigger this warning: - a record variable as a out parameter - the code most be in a seperate package - The flags -Wuninitialized and -fPIC need to be set I can reproduce this on 4.3.3 and 4.3.0 (and probably more versions). $ gcc -v -save-temps -c -I./ -Wuninitialized -fPIC -O2 ./some_package.adb Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-I./' '-Wuninitialized' '-fPIC' '-O2' '-mtune=generic' /usr/lib/gcc/x86_64-linux-gnu/4.3.3/gnat1 -I./ -quiet -dumpbase some_package.adb -O2 -Wuninitialized -fPIC -mtune=generic ./some_package.adb -o some_package.s ./some_package-some_seperate_package.adb: In function 'SOME_PACKAGE.SOME_SEPERATE_PACKAGE.GET_STATE': ./some_package-some_seperate_package.adb:22: warning: 'state_infos.current_state' is used uninitialized in this function COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-I./' '-Wuninitialized' '-fPIC' '-O2' '-mtune=generic' as -V -Qy -o some_package.o some_package.s GNU assembler version 2.19.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.19.1 COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:/usr/lib/gcc/x86_64-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-I./' '-Wuninitialized' '-fPIC' '-O2' '-mtune=generic' Regards Alexander Elbs. -- Summary: Unexpected uninitialized warning Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: alex at segv dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39502