================
@@ -40,7 +42,19 @@ void testInlineAsmMemcpyUninit(void)
{
int a[10], b[10] = {}, c;
MyMemcpy(&a[1], &b[1], sizeof(b) - sizeof(b[1]));
- c = a[0]; // expected-warning{{Assigned value is garbage or undefined}}
+ c = a[0]; // FIXME: should be warning about uninitialized value, but
invalidateRegions() also
+ // invalidates super region.
+}
+
+void testInlineAsmMemcpyUninitLoop(const void *src, unsigned long len)
+{
+ int a[10], c;
+ unsigned long toCopy = sizeof(a) < len ? sizeof(a) : len;
+
+ MyMemcpy(a, src, toCopy);
+
+ for (unsigned long i = 0; i < toCopy; ++i)
+ c = a[i]; // no-warning
----------------
steakhal wrote:
I'd suggest avoiding loops because we may decide to change how and how many
times the loop body will be checked.
You could change the test to explicitly have two guarded blocks: 1) where
"toCopy" is "len", and 2) "toCopy" is "sizeof(a)" (aka. 40). Then you could
explicitly subscript `a` with the relevant indicies.
https://github.com/llvm/llvm-project/pull/109838
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits