[clang] [-Wunsafe-buffer-usage] Suppress warning for multi-dimensional constant arrays (PR #118249)
Malavika Samak via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 5 21:48:45 PST 2024
================
@@ -52,3 +52,37 @@ void constant_id_string(unsigned idx) {
unsafe_char = ""[1]; //expected-warning{{unsafe buffer access}}
unsafe_char = ""[idx]; //expected-warning{{unsafe buffer access}}
}
+
+typedef float Float4x4[4][4];
+
+// expected-warning at +1 {{'matrix' is an unsafe buffer that does not perform bounds checks}}
+float two_dimension_array(Float4x4& matrix) {
+ // expected-note at +1{{used in buffer access here}}
+ float a = matrix[0][4];
----------------
malavikasamak wrote:
Sure. I will add a test case that uses a variable.
https://github.com/llvm/llvm-project/pull/118249
More information about the cfe-commits
mailing list