[LLVMbugs] [Bug 13264] New: False positive warning: "Function call argument is an uninitialized value"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 3 15:53:23 PDT 2012


             Bug #: 13264
           Summary: False positive warning: "Function call argument is an
                    uninitialized value"
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: curt.clifton at mac.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 8824
  --> http://llvm.org/bugs/attachment.cgi?id=8824
Sample file for which clang-sa produces the false positive

Summary: Running clang-sa on the attached sample code results in a false
positive warning that a member of a structure is uninitialized.

Steps to Reproduce: Invoke `clang --analyze OOHandleLayer.m` on the attached
file using the version of clang that ships with Xcode 4.4 DP6 or Xcode 4.5 DP2
(Apple clang version 4.0 (tags/Apple/clang-421.0.48) (based on LLVM 3.1svn)).

Expected Results: No errors or warnings.

Actual Results: 

curt at curt%
--analyze OOHandleLayer.m
OOHandleLayer.m:96:5: warning: Function call argument is an uninitialized value
    CGContextRotateCTM(ctx, geometry->rotation);
    ^                       ~~~~~~~~~~~~~~~~~~
1 warning generated.

Regression: Yes. The false positive is not reported with Apple clang version
3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn).


The rotation field of the struct to which the geometry variable points is
initialized. To see this we can follow the backtrace output by the static

line 92: The geometry variable is set to the value of the context parameter to
line 131: The OOHandleDrawGeometry function is invoked, using the drawer
parameter passed to OOHandleLayerCreateImageUsingDrawer. The context argument
in the function invocation is the unchanged context parameter that was passed
to OOHandleLayerCreateImageUsingDrawer.
line 160: The only call to OOHandleLayerCreateImageUsingDrawer is here. We see
that this call passes the OOHandleDrawGeometry function and a reference to the
geometry struct that was stored in line 159.
line 159: The geometry struct is initialized by calling _geometryForState.
line 40: The rotation field of the geometry struct is initialized.

Note that commenting out the if-else statement in lines 41-85 suppresses the
false warning.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list