[cfe-commits] r148375 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Nick Lewycky nlewycky at google.com
Tue Jan 17 19:49:23 PST 2012


The testcase for this would be:

#include <stdio.h>

void testcase(void) {
  vprintf(0, 0);
}

except that I will not introduce a test that isn't hermetic. It appears to
be impossible to fake this by declaring my own function, or even using #
lines to mark it. If I preprocess that testcase, the result no longer
triggers the memory error.

Any suggestions for refactoring clang to make testing this possible would
be greatly appreciated.

Nick

On 17 January 2012 19:41, Nick Lewycky <nicholas at mxc.ca> wrote:

> Author: nicholas
> Date: Tue Jan 17 21:41:19 2012
> New Revision: 148375
>
> URL: http://llvm.org/viewvc/llvm-project?rev=148375&view=rev
> Log:
> Fix a string over-run detected by ASAN.
>
> Modified:
>    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=148375&r1=148374&r2=148375&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Jan 17 21:41:19 2012
> @@ -883,8 +883,9 @@
>       unsigned BuiltinID = FD->getBuiltinID();
>       if (!BuiltinID)
>         return true;
> -      const char *BuiltinName = BI.GetName(BuiltinID) +
> strlen("__builtin_");
> -      if (Name == BuiltinName) {
> +      StringRef BuiltinName = BI.GetName(BuiltinID);
> +      if (BuiltinName.startswith("__builtin_") &&
> +          Name == BuiltinName.slice(strlen("__builtin_"),
> StringRef::npos)) {
>         Result = true;
>         return false;
>       }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120117/07fb5345/attachment.html>


More information about the cfe-commits mailing list