Skip to content

Incorrectly reports "The left operand of '!=' is a garbage value" #9827

@llvmbot

Description

@llvmbot
Bugzilla Link 9455
Resolution FIXED
Resolved on Mar 16, 2011 22:52
Version 2.9
OS MacOS X
Attachments A bare-bone c-file that shows the problem.
Reporter LLVM Bugzilla Contributor
CC @tkremenek

Extended Description

In the attached source, the analyzer incorrectly reports a potential garbage value.

It seems that the analyzer gets confused by the combination of static initialization of the char string:
char pattern[4] = "000";

and by the subsequent modification by the if statements:
if (fun(t-1)) {
pattern[0] = '1';
}
if (fun(t)) {
pattern[1] = '1';
}
if (fun(t+1)) {
pattern[2] = '1';
}

when the code reaches a loop that make simple checks over the string:

int i;
for( i=0; i<3; ++i ) {
	if(pattern[i]!=fun2(i))            
        return 0;
}

the analyzer incorrectly thinks that pattern[i] is gargbage value. This cannot be the case since all indices in 0..2 have been initialized to the character '0'.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions