[PATCH] D116633: Add -fsanitize-address-param-retval to clang.
Kevin Athey via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 5 11:33:27 PST 2022
kda updated this revision to Diff 397647.
kda marked an inline comment as done.
kda added a comment.
updated help text and dropped implementation
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116633/new/
https://reviews.llvm.org/D116633
Files:
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGen/attr-noundef.cpp
clang/test/CodeGen/indirect-noundef.cpp
Index: clang/test/CodeGen/indirect-noundef.cpp
===================================================================
--- clang/test/CodeGen/indirect-noundef.cpp
+++ clang/test/CodeGen/indirect-noundef.cpp
@@ -1,5 +1,4 @@
// RUN: %clang -cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -enable-noundef-analysis -o - %s | FileCheck %s
-// RUN: %clang -cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fsanitize-memory-param-retval -o - %s | FileCheck %s
union u1 {
int val;
Index: clang/test/CodeGen/attr-noundef.cpp
===================================================================
--- clang/test/CodeGen/attr-noundef.cpp
+++ clang/test/CodeGen/attr-noundef.cpp
@@ -1,7 +1,5 @@
// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL
// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -enable-noundef-analysis %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH
-// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -fsanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL
-// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -fsanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH
//************ Passing structs by value
// TODO: No structs may currently be marked noundef
Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2243,9 +2243,7 @@
getLangOpts().Sanitize.has(SanitizerKind::Return);
// Determine if the return type could be partially undef
- if ((CodeGenOpts.EnableNoundefAttrs ||
- CodeGenOpts.SanitizeMemoryParamRetval) &&
- HasStrictReturn) {
+ if (CodeGenOpts.EnableNoundefAttrs && HasStrictReturn) {
if (!RetTy->isVoidType() && RetAI.getKind() != ABIArgInfo::Indirect &&
DetermineNoUndef(RetTy, getTypes(), DL, RetAI))
RetAttrs.addAttribute(llvm::Attribute::NoUndef);
@@ -2380,9 +2378,7 @@
// Decide whether the argument we're handling could be partially undef
bool ArgNoUndef = DetermineNoUndef(ParamType, getTypes(), DL, AI);
- if ((CodeGenOpts.EnableNoundefAttrs ||
- CodeGenOpts.SanitizeMemoryParamRetval) &&
- ArgNoUndef)
+ if (CodeGenOpts.EnableNoundefAttrs && ArgNoUndef)
Attrs.addAttribute(llvm::Attribute::NoUndef);
// 'restrict' -> 'noalias' is done in EmitFunctionProlog when we
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1672,7 +1672,7 @@
CodeGenOpts<"SanitizeMemoryParamRetval">,
DefaultFalse,
PosFlag<SetTrue, [CC1Option], "Enable">, NegFlag<SetFalse, [], "Disable">,
- BothFlags<[], "eager param-retval uninitialized use detection in MemorySanitizer">>,
+ BothFlags<[], "Detect uninitialized parameters and return values.">>,
Group<f_clang_Group>;
// Note: This flag was introduced when it was necessary to distinguish between
// ABI for correct codegen. This is no longer needed, but the flag is
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116633.397647.patch
Type: text/x-patch
Size: 3352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220105/e35e61cd/attachment-0001.bin>
More information about the cfe-commits
mailing list