From 990bab89fff75b9afb98762f6e90eb634afc6d42 Mon Sep 17 00:00:00 2001 From: Sander de Smalen Date: Thu, 20 Jan 2022 15:13:32 +0000 Subject: [PATCH] [ScalableVectors] Warn instead of error for invalid size requests. This was intended to be fixed by D98856, but that only seemed to have the desired behaviour when compiling to assembly using `-S`, not when compiling into an object file or executable. Given that this was not the intention of D98856, this patch fixes the behaviour. --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- clang/test/Driver/fsanitize-coverage.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 96d949b..c48c6fd 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5318,7 +5318,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // as errors, but until then, we can live with a warning being emitted by the // compiler. This way, Clang can be used to compile code with scalable vectors // and identify possible issues. - if (isa(JA)) { + if (isa(JA) || isa(JA) || + isa(JA)) { CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-treat-scalable-fixed-error-as-warning"); } diff --git a/clang/test/Driver/fsanitize-coverage.c b/clang/test/Driver/fsanitize-coverage.c index ab8a887..23953af 100644 --- a/clang/test/Driver/fsanitize-coverage.c +++ b/clang/test/Driver/fsanitize-coverage.c @@ -106,7 +106,7 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=bb,inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT -// CHECK_INLINE8BIT-NOT: warning +// CHECK_INLINE8BIT-NOT: warning: // CHECK_INLINE8BIT: -fsanitize-coverage-inline-8bit-counters // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINE8BIT @@ -115,7 +115,7 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=bb,inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG -// CHECK_INLINE_BOOL_FLAG-NOT: warning +// CHECK_INLINE_BOOL_FLAG-NOT: warning: // CHECK_INLINE_BOOL_FLAG: -fsanitize-coverage-inline-bool-flag // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINEBOOL -- 2.7.4