[PATCH] D104424: [Sema] Fix for PR50741
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 16 16:46:39 PDT 2021
erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.
Two small changes to the test that you can do as a part of committing. Thanks!
================
Comment at: clang/test/Sema/unbounded-array-bounds.c:17
++s[7073650413200313099].b;
- // CHECK-X86-ADDR64: :[[@LINE-1]]:5: warning: array index 7073650413200313099 refers past the last possible element for an array in 64-bit address space containing 256-bit (32-byte) elements (max possible 576460752303423488 elements)
- // CHECK-I386-ADDR32: :[[@LINE-2]]:5: warning: {{.*}} past the last possible element {{.*}} in 32-bit {{.*}} (max possible 178956970 elements)
- // CHECK-AVR-ADDR16: :[[@LINE-3]]:5: warning: {{.*}} past the last possible element {{.*}} in 16-bit {{.*}} (max possible 3276 elements)
+ // addr16-warning at 16 {{array index 7073650413200313099 refers past the last possible element for an array in 16-bit address space containing 160-bit (20-byte) elements (max possible 3276 elements)}}
+ // addr32-warning at 16 {{array index 7073650413200313099 refers past the last possible element for an array in 32-bit address space containing 192-bit (24-byte) elements (max possible 178956970 elements)}}
----------------
Rather than actual line numbers, do @-1 here instead (you can do relative values). That way all of these are easy to read when going back through these.
================
Comment at: clang/test/Sema/unbounded-array-bounds.c:80
+void pr50741() {
+ (void *)0 + 0xdead000000000000UL; // expected-warning {{expression result unused}}
+ // no array-bounds warning, and no crash
----------------
As this warning is unrelated here, I'd suggest either casting this entire thing to (void) to suppress this, or just doing -Wno-unused on the command line flags.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104424/new/
https://reviews.llvm.org/D104424
More information about the cfe-commits
mailing list