[PATCH] D116633: Add -fsanitize-address-param-retval to clang.

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 4 21:56:36 PST 2022


vitalybuka added a subscriber: eugenis.
vitalybuka added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:1675
+      PosFlag<SetTrue, [CC1Option], "Enable">, NegFlag<SetFalse, [], "Disable">,
+      BothFlags<[], "eager param-retval uninitialized use detection in MemorySanitizer">>,
+    Group<f_clang_Group>;
----------------
Maybe "Detect initialized parameters and return values."? and above


================
Comment at: clang/lib/CodeGen/CGCall.cpp:2384
+    if ((CodeGenOpts.EnableNoundefAttrs ||
+         CodeGenOpts.SanitizeMemoryParamRetval) &&
+        ArgNoUndef)
----------------
@eugenis Would be better to force CodeGenOpts.EnableNoundefAttrs if SanitizeMemoryParamRetval is provided?


================
Comment at: clang/lib/CodeGen/CGCall.cpp:2386
+        ArgNoUndef)
       Attrs.addAttribute(llvm::Attribute::NoUndef);
 
----------------
Without this change "-enable-noundef-analysis with -fsanitize-memory-param-retval" can be used.
So no matter what we decide about EnableNoundefAttrs, let's move this change and tests below into a separate incremental patch.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116633



More information about the cfe-commits mailing list