[PATCH] D14497: [FunctionAttrs] Detect printf-like functions and propagate readnone+nocapture to variadic operands
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 13 21:12:45 PST 2015
eli.friedman added a subscriber: eli.friedman.
eli.friedman added a comment.
sprintf definitely isn't nocapture; simple testcase:
#include <stdio.h>
#include <assert.h>
int main() {
int a = 3;
// Serialize the address of `a`
char buf[32];
sprintf(buf, "%p", &a);
// Deserialize the address of `a`
int* aptr;
sscanf(buf, "%p", &aptr);
// Check value of `a`
assert(*aptr == 3);
}
sprintf can also write to its arguments: "%n" might not be particularly popular, but it's still legal.
Repository:
rL LLVM
http://reviews.llvm.org/D14497
More information about the llvm-commits
mailing list