This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/22197] invalid "is" used uninitialized, should be "may be"


------- Additional Comments From matz at suse dot de  2005-06-27 13:50 -------
Hmm, sort of.  The call of g(i) also warns with "is used", although I 
think it might deserve only a "may be used".  But anyway I think that 
this nevertheless has different causes.  It's not the call creating 
the problem, but the copy itself.  On could for instance delete the 
call and instead make 'testarray' volatile (so that the copy is not 
optimized away).  This would still warn, IMHO incorrectly. 
 
What's even stranger is, that if I add a call "forget(testvar)" then 
the warning vanishes.  I.e. like so: 
------------------------------------- 
int main() { 
    struct testme volatile testarray[1]; 
    struct testme testvar; 
    testvar.testval = 0; 
    testarray[0] = testvar; 
    forget (testvar); 
    return 0; 
} 
------------------------------------- 
 
So this shows that not the call on a partly initialized struct is the 
problem (because that is still the case with the above), but something 
in SRA dealing with the copy.  If one removes the call to forget above 
the warning will return (note the added volatile) on the copy. 

-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]