Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[IPA] Clang does not warn about uninitialized variable #6325

Open Quuxplusone opened 14 years ago

Quuxplusone commented 14 years ago
Bugzilla Link PR5842
Status NEW
Importance P normal
Reported by Oliver McFadden (omcfadde@gmail.com)
Reported on 2009-12-20 20:30:56 -0800
Last modified on 2011-06-01 15:28:44 -0700
Version trunk
Hardware PC Linux
CC ali.2006.amin@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments unused.c (599 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 3966
Testcase

I've attached a testcase showing this problem. Clang correctly detects that the
return value from PlaneGetDist() is unused, but the normal vector (N) from
PlaneGetNormal is also unused, and Clang doesn't warn about this.

I suspect this might require IPA functionality, so feel free to mark it as a
duplicate of another bug - I don't feel I have enough experience with Clang to
know for sure whether this is a duplicate.

Compile as: scan-build gcc unused.c -Wunused-parameter -Wall

ANALYZE: unused.c PlaneGetNormal
ANALYZE: unused.c PlaneGetDist
ANALYZE: unused.c main
unused.c:34:3: warning: Value stored to 'd' is never read
  d = PlaneGetDist (P);
  ^   ~~~~~~~~~~~~~~~~
1 diagnostic generated.
scan-build: 1 bugs found.
scan-build: Run 'scan-view /tmp/scan-build-2009-12-21-16' to examine bug
reports.
Quuxplusone commented 14 years ago

Attached unused.c (599 bytes, text/plain): Testcase