Skip to content

False positive: "Undefined or garbage value returned to caller" #18683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
llvmbot opened this issue Dec 22, 2013 · 2 comments
Closed

False positive: "Undefined or garbage value returned to caller" #18683

llvmbot opened this issue Dec 22, 2013 · 2 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:static analyzer duplicate Resolved as duplicate

Comments

@llvmbot
Copy link
Member

llvmbot commented Dec 22, 2013

Bugzilla Link 18309
Resolution DUPLICATE
Resolved on Dec 23, 2013 12:40
Version trunk
OS Linux
Attachments Simple test case
Reporter LLVM Bugzilla Contributor
CC @belkadan

Extended Description

Using:
clang version 3.5 (trunk 197863)
Target: x86_64-unknown-linux-gnu
Thread model: posix

I'm getting a false positive "Undefined or garbage value returned to caller" for a variable which is guaranteed to be written to in one of the 'case' entries of a 'switch' statement.

Test case attached. Note, that false positive is not given for a switch() on enum values, but it is given for switch() on an int where two bits are masked out.

Use: scan-build --use-analyzer <...>/bin/clang gcc -std=c99 -o test.o -c test.c

@llvmbot
Copy link
Member Author

llvmbot commented Dec 22, 2013

assigned to @tkremenek

@belkadan
Copy link
Contributor

I'm going to call this a duplicate of bug #13399 . We don't currently reason about bitwise constraints, but we could consider adding a special case if it's the low bits that are being masked, because that can be represented as an integral range.

*** This bug has been marked as a duplicate of bug #13399 ***

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:static analyzer duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

2 participants