[compiler-rt] r302788 - [msan] add a regression test for PR32842
Alexander Potapenko via llvm-commits
llvm-commits at lists.llvm.org
Thu May 11 04:12:26 PDT 2017
Author: glider
Date: Thu May 11 06:12:26 2017
New Revision: 302788
URL: http://llvm.org/viewvc/llvm-project?rev=302788&view=rev
Log:
[msan] add a regression test for PR32842
Make sure MSan doesn't miss a bug comparing two integers with defined low bits.
Added:
compiler-rt/trunk/test/msan/pr32842.c
Added: compiler-rt/trunk/test/msan/pr32842.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/pr32842.c?rev=302788&view=auto
==============================================================================
--- compiler-rt/trunk/test/msan/pr32842.c (added)
+++ compiler-rt/trunk/test/msan/pr32842.c Thu May 11 06:12:26 2017
@@ -0,0 +1,22 @@
+// Regression test for https://bugs.llvm.org/show_bug.cgi?id=32842
+//
+// RUN: %clang_msan -g %s -o %t
+// RUN: not %run %t 2>&1 | FileCheck %s
+
+struct iphdr {
+ unsigned char pad1: 2, ihl:4, pad2: 2;
+};
+
+int raw_send_hdrinc(unsigned long int length) {
+ struct iphdr iph;
+ if (iph.ihl * 4 > length) {
+ return 1;
+ }
+ return 0;
+}
+
+int main(int argc, char *argv[]) {
+ return raw_send_hdrinc(12);
+}
+
+// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
More information about the llvm-commits
mailing list