[LLVMbugs] [Bug 14675] clang doesn't warn (where gcc does) when reading too far in a C array

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 20 14:57:59 PST 2012


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|                            |WONTFIX

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> 2012-12-20 16:57:59 CST ---
gcc is discovering this uninitialized value after inlining Set4. Clang
deliberately doesn't do this, since it results in optimization-dependent
diagnostics. Instead, the clang static analyzer should be used if you want
interprocedural analysis, and it catches this bug:

<stdin>:2:28: warning: Function call argument is an uninitialized value
static void f(double *a) { printf("%f", a[3]); } int main() { double arr[3] =
{1, 2, 3}; f(arr); return 0; }
                           ^            ~~~~

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