Bug 42290

Summary: strange 'warning: "ISRA.2" may be used uninitialized in this function'
Product: gcc Reporter: Zdenek Sojka <zsojka>
Component: middle-endAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, manu, pinskia
Priority: P3 Keywords: diagnostic
Version: 4.5.0   
Target Milestone: ---   
Host: x86_64-pc-linux-gnu Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Bug Depends on: 42508    
Bug Blocks: 24639    
Attachments: reduced testcase
even more reduced testcase

Description Zdenek Sojka 2009-12-04 23:52:22 UTC
Command line:
g++ -std=c++0x -O2 -Wall -o tmp.o testcase-manual.ii -c
or
g++ -std=c++0x -O2 -Wall -o tmp.o testcase-manual.ii -c


Gives:
testcase-manual.ii: In function &#8216;A::~A(A**, char*)&#8217;:
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function


Tested versions:
r154953 - warns
r154886 - warns
r154830 - silent
r153685 - silent




Full output:
$ /mnt/svn/gcc-trunk/binary-154953-lto/bin/g++ -std=c++0x -O2 -Wall -o tmp.o testcase-manual.ii -c -v
Using built-in specs.
COLLECT_GCC=/mnt/svn/gcc-trunk/binary-154953-lto/bin/g++
COLLECT_LTO_WRAPPER=/mnt/svn/gcc-trunk/binary-154953-lto/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-languages=c,c++,lto --prefix=/mnt/svn/gcc-trunk/binary-154953-lto
Thread model: posix
gcc version 4.5.0 20091203 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-std=c++0x' '-O2' '-Wall' '-o' 'tmp.o' '-c' '-v' '-shared-libgcc' '-mtune=generic'
 /mnt/svn/gcc-trunk/binary-154953-lto/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus -fpreprocessed testcase-manual.ii -quiet -dumpbase testcase-manual.ii -mtune=generic -auxbase-strip tmp.o -O2 -Wall -std=c++0x -version -o /tmp/ccF5BU5B.s
GNU C++ (GCC) version 4.5.0 20091203 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.0 20091203 (experimental), GMP version 4.3.1, MPFR version 2.4.1-p5, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.5.0 20091203 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.0 20091203 (experimental), GMP version 4.3.1, MPFR version 2.4.1-p5, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 4b09d9924550b4f9676aafda3b16134c
testcase-manual.ii: In function &#8216;A::~A(A**, char*)&#8217;:
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
testcase-manual.ii:10:17: warning: &#8216;ISRA.2&#8217; may be used uninitialized in this function
COLLECT_GCC_OPTIONS='-std=c++0x' '-O2' '-Wall' '-o' 'tmp.o' '-c' '-v' '-shared-libgcc' '-mtune=generic'
 as -V -Qy -o tmp.o /tmp/ccF5BU5B.s
GNU assembler version 2.20.51.0.3 (x86_64-pc-linux-gnu) using BFD version (Linux/GNU Binutils) 2.20.51.0.3.20091109
COMPILER_PATH=/mnt/svn/gcc-trunk/binary-154953-lto/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/:/mnt/svn/gcc-trunk/binary-154953-lto/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/:/mnt/svn/gcc-trunk/binary-154953-lto/libexec/gcc/x86_64-unknown-linux-gnu/:/mnt/svn/gcc-trunk/binary-154953-lto/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/:/mnt/svn/gcc-trunk/binary-154953-lto/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/mnt/svn/gcc-trunk/binary-154953-lto/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/:/mnt/svn/gcc-trunk/binary-154953-lto/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/intel/Compiler/11.1/056/lib/intel64/:/mnt/svn/gcc-trunk/binary-154953-lto/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-std=c++0x' '-O2' '-Wall' '-o' 'tmp.o' '-c' '-v' '-shared-libgcc' '-mtune=generic'
Comment 1 Zdenek Sojka 2009-12-04 23:53:17 UTC
Created attachment 19231 [details]
reduced testcase
Comment 2 Andrew Pinski 2009-12-04 23:54:17 UTC
ISRA is the name of the variable that gets created by IPA SRA ...
Comment 3 Zdenek Sojka 2009-12-05 00:16:21 UTC
C++ mode doesn't seem to be mandatory (it was for the testcase before reduction), the following command is enough:

g++ -O2 -Wall -o tmp.o testcase-manual.ii -c
Comment 4 Zdenek Sojka 2009-12-26 10:50:50 UTC
Created attachment 19393 [details]
even more reduced testcase

I have a suspicion this warning is valid. There is an app that (sometimes) crashes when code construction like this one is called. valgrind warns about using uninitialized variable. Also, it started crashing when compiled with gcc r154886 (r154830 was fine).
Comment 5 Zdenek Sojka 2009-12-26 11:23:12 UTC
I opened the wrong code bug as pr42508
Comment 6 Manuel López-Ibáñez 2009-12-30 16:29:23 UTC
Once PR42508 is fixed, this should be reevaluated and probably won't warn anymore or can be closed as INVALID, since the warning was valid.
Comment 7 Zdenek Sojka 2010-02-04 03:01:17 UTC
I can't reproduce this issue in current trunk (r156468)
Comment 8 Manuel López-Ibáñez 2010-02-04 11:26:08 UTC
(In reply to comment #7)
> I can't reproduce this issue in current trunk (r156468)

Closing then as FIXED, the warning was caused by bug 42508.