[LLVMbugs] [Bug 9289] New: false positive: Assigned value is garbage or undefined

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 22 08:25:49 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9289

           Summary: false positive: Assigned value is garbage or undefined
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: mkbosmans at gmail.com
                CC: llvmbugs at cs.uiuc.edu


The following snippet illustrates what goes wrong:
e->is_float does not change, so both at line 479 and at line 501 the same
branch must be taken and the garbage assignment cannot occur.

472            float saved_f;
Variable 'saved_f' declared without an initial value
473            int32_t saved_i;
474            uint64_t saved_start_x;
...
479            if (e->is_float) {
Taking false branch
480                saved_f = i->start_y.f;
481                i->start_y.f = item_get_float(i, x);
482            } else {
483                saved_i = i->start_y.i;
484                i->start_y.i = item_get_int(i, x);
485            }
...
493            envelope_merge(e, v);
...
501            if (e->is_float)
Taking true branch
502                i->start_y.f = saved_f;
Assigned value is garbage or undefined
503            else
504                i->start_y.i = saved_i;

Full source code available at:
http://git.0pointer.de/?p=pulseaudio.git;a=blob;f=src/pulsecore/envelope.c;hb=HEAD
(e.g. in the pa_envelope_replace function)

-- 
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