[PATCH] D126864: [clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 27 17:08:09 PDT 2022


MaskRay added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:1143
   MarshallingInfoFlag<LangOpts<"AppleKext">>;
+def fstrict_flex_arrays_EQ : Joined<["-"], "fstrict-flex-arrays=">,Group<f_Group>,
+  MetaVarName<"<n>">, Values<"0,1,2,3">,
----------------



================
Comment at: clang/test/CodeGen/bounds-checking-fma.c:1
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fsanitize=array-bounds %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-0
----------------
I realized that I made a typo. It should be fam instead of fma....

I precomitted a test for the default case. You may add -fstrict-flex-arrays={1,2} lines on top of it.


================
Comment at: clang/test/CodeGen/object-size-flex-array.c:99
+
+// CHECK-LABEL: @babar2
+unsigned babar2(foofoo2_t *f) {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126864/new/

https://reviews.llvm.org/D126864



More information about the cfe-commits mailing list