================
@@ -410,3 +409,13 @@ int *nothingIsCertain(int x, int y) {
 
   return mem;
 }
+
+struct Empty {};
+struct Empty ZeroSizeElements[10];
+
+struct Empty zeroSizeElements(void) {
+  // FIXME: We probably shouldn't report this access.
+  return ZeroSizeElements[5];
+  // expected-warning@-1 {{Out of bound access to memory after the end of 
'ZeroSizeElements'}}
+  // expected-note@-2 {{Access of 'ZeroSizeElements' at byte offset 0, while 
it holds only 0 byte}}
+}
----------------
steakhal wrote:

I'm not 100% sure, but I think `_MSC_VER` might do the trick.
```suggestion
#ifndef _MSC_VER
struct Empty {};
struct Empty ZeroSizeElements[10];

struct Empty zeroSizeElements(void) {
  // FIXME: We probably shouldn't report this access.
  return ZeroSizeElements[5];
  // expected-warning@-1 {{Out of bound access to memory after the end of 
'ZeroSizeElements'}}
  // expected-note@-2 {{Access of 'ZeroSizeElements' at byte offset 0, while it 
holds only 0 byte}}
}
#endif
```

https://github.com/llvm/llvm-project/pull/210774
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to