[clang] [clang][test] Fix instantiation-depth-default.cpp under ubsan config on Windows (PR #91021)

Duo Wang via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 14:47:07 PDT 2024


https://github.com/wdunicornpro created https://github.com/llvm/llvm-project/pull/91021

Clang test `instantiation-depth-default.cpp` fails on Windows when built with `ubsan` due to extra warnings printed by the compiler:
```console
File instantiation-depth-default.cpp Line 11: stack nearly exhausted; compilation time may suffer, and crashes due to stack overflow are likely
```

Originally in https://github.com/llvm/llvm-project/pull/75254 this test was enabled for `asan` as well but later started to cause failures in Linux ASAN buildbots. I have excluded `asan` from this change.

>From 89d29ebbe3e51b01f612cb0295e00750b6789b11 Mon Sep 17 00:00:00 2001
From: Duo Wang <Duo.Wang at sony.com>
Date: Thu, 2 May 2024 16:44:19 -0700
Subject: [PATCH] add `-Wno-stack-exhausted` flag to fix test failure in ubsan
 config on windows

---
 clang/test/SemaTemplate/instantiation-depth-default.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaTemplate/instantiation-depth-default.cpp b/clang/test/SemaTemplate/instantiation-depth-default.cpp
index f5835b86b3a385..5934d4e542ee06 100644
--- a/clang/test/SemaTemplate/instantiation-depth-default.cpp
+++ b/clang/test/SemaTemplate/instantiation-depth-default.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %if {{ubsan}} %{ -Wno-stack-exhausted %} %s
 //
 // FIXME: Disable this test when Clang was built with ASan, because ASan
 // increases our per-frame stack usage enough that this test no longer fits



More information about the cfe-commits mailing list