balazske created this revision.
Herald added subscribers: cfe-commits, gamesh411, Szelethus, dkrupp.
Herald added a project: clang.

New lines are added to test ctu-main.c to make code execute when a
function with invalid source range is encountered on bug path
with NoStoreFuncVisitor.


Repository:
  rC Clang

https://reviews.llvm.org/D64628

Files:
  test/Analysis/ctu-main.c


Index: test/Analysis/ctu-main.c
===================================================================
--- test/Analysis/ctu-main.c
+++ test/Analysis/ctu-main.c
@@ -45,11 +45,18 @@
   g(0); // expected-warning@Inputs/ctu-other.c:29 {{Access to field 'a' 
results in a dereference of a null pointer (loaded from variable 'ctx')}}
 }
 
+void h(int);
+
 // The external function prototype is incomplete.
 // warning:implicit functions are prohibited by c99
 void testImplicit() {
-  int res = identImplicit(6);   // external implicit functions are not inlined
+  int res = identImplicit(6);
   clang_analyzer_eval(res == 6); // expected-warning{{TRUE}}
+
+  // Call something with uninitialized from the same function in which the 
implicit was called.
+  // This is necessary to reproduce a special bug in NoStoreFuncVisitor.
+  int uninitialized;
+  h(uninitialized); // expected-warning@ctu-main.c:59 {{1st function call 
argument is an uninitialized value}}
 }
 
 // Tests the import of functions that have a struct parameter


Index: test/Analysis/ctu-main.c
===================================================================
--- test/Analysis/ctu-main.c
+++ test/Analysis/ctu-main.c
@@ -45,11 +45,18 @@
   g(0); // expected-warning@Inputs/ctu-other.c:29 {{Access to field 'a' results in a dereference of a null pointer (loaded from variable 'ctx')}}
 }
 
+void h(int);
+
 // The external function prototype is incomplete.
 // warning:implicit functions are prohibited by c99
 void testImplicit() {
-  int res = identImplicit(6);   // external implicit functions are not inlined
+  int res = identImplicit(6);
   clang_analyzer_eval(res == 6); // expected-warning{{TRUE}}
+
+  // Call something with uninitialized from the same function in which the implicit was called.
+  // This is necessary to reproduce a special bug in NoStoreFuncVisitor.
+  int uninitialized;
+  h(uninitialized); // expected-warning@ctu-main.c:59 {{1st function call argument is an uninitialized value}}
 }
 
 // Tests the import of functions that have a struct parameter
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to