[clang] [NFC][clang][test] Make `instantiation-depth-default.cpp` a valid test case under `asan` and `ubsan` configs (PR #75254)
https://github.com/wdunicornpro created https://github.com/llvm/llvm-project/pull/75254 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 ``` The test case was disabled for `asan` in 571a647 because of the extra stack usage. Since `ubsan` also increases stack usage, seems like the two configs should be treated uniformly. On the other hand, we might be able to re-enable this test case for `asan`. During some preliminary testing on Windows, Linux, and macOS with the host compiler being as old as clang-10, the test case exited successfully if the `stack-exhausted` warnings are suppressed, though I haven't done exhaustive testing across platforms and clang versions. Any insights into whether this change will introduce any risks to existing buildbots is appreciated. Enabling this test case for `asan` helps to improve our test coverage, but if it causes problems on any buildbot, marking it as unsupported for `ubsan` is also a viable solution. >From 410aaea22e1824c7f8ba27a8f538d0c039a5ab62 Mon Sep 17 00:00:00 2001 From: Duo Wang Date: Fri, 8 Dec 2023 15:38:08 -0800 Subject: [PATCH] add `-Wno-stack-exhausted` flag to support asan and ubsan --- .../SemaTemplate/instantiation-depth-default.cpp | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/clang/test/SemaTemplate/instantiation-depth-default.cpp b/clang/test/SemaTemplate/instantiation-depth-default.cpp index f5835b86b3a385..362cf2b34aef51 100644 --- a/clang/test/SemaTemplate/instantiation-depth-default.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-default.cpp @@ -1,18 +1,12 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %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 -// within our normal stack space allocation. -// UNSUPPORTED: asan -// +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 -Wno-stack-exhausted %s // The default stack size on NetBSD is too small for this test. // UNSUPPORTED: system-netbsd template struct X : X {}; -// expected-error-re@11 {{recursive template instantiation exceeded maximum depth of 1024{{$ -// expected-note@11 {{instantiation of template class}} -// expected-note@11 {{skipping 1023 contexts in backtrace}} -// expected-note@11 {{use -ftemplate-depth=N to increase recursive template instantiation depth}} +// expected-error-re@5 {{recursive template instantiation exceeded maximum depth of 1024{{$ +// expected-note@5 {{instantiation of template class}} +// expected-note@5 {{skipping 1023 contexts in backtrace}} +// expected-note@5 {{use -ftemplate-depth=N to increase recursive template instantiation depth}} X<0, int> x; // expected-note {{in instantiation of}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][clang][test][asan] Make `instantiation-depth-default.cpp` a valid test case under `asan` and `ubsan` configs (PR #75254)
https://github.com/wdunicornpro edited https://github.com/llvm/llvm-project/pull/75254 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][clang][test][asan] Make `instantiation-depth-default.cpp` a valid test case under `asan` and `ubsan` configs (PR #75254)
wdunicornpro wrote: ping: this helps to improve our test coverage under `asan` and `ubsan` configs. https://github.com/llvm/llvm-project/pull/75254 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][clang][test][asan] Make `instantiation-depth-default.cpp` a valid test case under `asan` and `ubsan` configs (PR #75254)
wdunicornpro wrote: @goussepi Do you have any thoughts on this? https://github.com/llvm/llvm-project/pull/75254 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][clang][test][asan] Make `instantiation-depth-default.cpp` a valid test case under `asan` and `ubsan` configs (PR #75254)
https://github.com/wdunicornpro updated https://github.com/llvm/llvm-project/pull/75254 >From 410aaea22e1824c7f8ba27a8f538d0c039a5ab62 Mon Sep 17 00:00:00 2001 From: Duo Wang Date: Fri, 8 Dec 2023 15:38:08 -0800 Subject: [PATCH 1/2] add `-Wno-stack-exhausted` flag to support asan and ubsan --- .../SemaTemplate/instantiation-depth-default.cpp | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/clang/test/SemaTemplate/instantiation-depth-default.cpp b/clang/test/SemaTemplate/instantiation-depth-default.cpp index f5835b86b3a385..362cf2b34aef51 100644 --- a/clang/test/SemaTemplate/instantiation-depth-default.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-default.cpp @@ -1,18 +1,12 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %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 -// within our normal stack space allocation. -// UNSUPPORTED: asan -// +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 -Wno-stack-exhausted %s // The default stack size on NetBSD is too small for this test. // UNSUPPORTED: system-netbsd template struct X : X {}; -// expected-error-re@11 {{recursive template instantiation exceeded maximum depth of 1024{{$ -// expected-note@11 {{instantiation of template class}} -// expected-note@11 {{skipping 1023 contexts in backtrace}} -// expected-note@11 {{use -ftemplate-depth=N to increase recursive template instantiation depth}} +// expected-error-re@5 {{recursive template instantiation exceeded maximum depth of 1024{{$ +// expected-note@5 {{instantiation of template class}} +// expected-note@5 {{skipping 1023 contexts in backtrace}} +// expected-note@5 {{use -ftemplate-depth=N to increase recursive template instantiation depth}} X<0, int> x; // expected-note {{in instantiation of}} >From 277939cd269d0d16fcf2f62debc7df0c2f1504f5 Mon Sep 17 00:00:00 2001 From: Duo Wang Date: Thu, 4 Jan 2024 09:46:34 -0800 Subject: [PATCH 2/2] -Wno-stack-exhausted under asan and ubsan only --- 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 362cf2b34aef51..430d042d7e0f49 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 -Wno-stack-exhausted %s +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %if {{asan|ubsan}} %{ -Wno-stack-exhausted %} %s // The default stack size on NetBSD is too small for this test. // UNSUPPORTED: system-netbsd ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][clang][test][asan] Make `instantiation-depth-default.cpp` a valid test case under `asan` and `ubsan` configs (PR #75254)
@@ -1,18 +1,12 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %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 -// within our normal stack space allocation. -// UNSUPPORTED: asan -// +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 -Wno-stack-exhausted %s wdunicornpro wrote: Great point. Just pushed an update. https://github.com/llvm/llvm-project/pull/75254 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][clang][test][asan] Make `instantiation-depth-default.cpp` a valid test case under `asan` and `ubsan` configs (PR #75254)
@@ -1,18 +1,12 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %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 -// within our normal stack space allocation. -// UNSUPPORTED: asan -// +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 -Wno-stack-exhausted %s wdunicornpro wrote: If the update looks good to you, could you help me commit it once the CI passes? Thanks! https://github.com/llvm/llvm-project/pull/75254 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add test for incompatible cv-qualified reference types in conversion function template (PR #81950)
https://github.com/wdunicornpro edited https://github.com/llvm/llvm-project/pull/81950 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add test for incompatible cv-qualified reference types in conversion function template (PR #81950)
wdunicornpro wrote: @zygoloid Sorry about the abrupt ping but I figured you might have the best knowledge about that part of code. Do you have any thoughts on this? https://github.com/llvm/llvm-project/pull/81950 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add test for incompatible cv-qualified reference types in conversion function template (PR #81950)
wdunicornpro wrote: ping https://github.com/llvm/llvm-project/pull/81950 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add test for incompatible cv-qualified reference types in conversion function template (PR #81950)
https://github.com/wdunicornpro created https://github.com/llvm/llvm-project/pull/81950 We currently lack test coverage for [SemaTemplateDeduction.cpp#L1619-L1620](https://github.com/llvm/llvm-project/blob/fe20a75/clang/lib/Sema/SemaTemplateDeduction.cpp#L1619-L1629), which handles the case where both the P type and the A type are reference types but A is more cv-qualified than P. This is deemed non-deduced unless both A and P are possibly cv-qualified forms of the template parameter T. This PR adds tests for that logic. >From ec34c9f2fe6713d0301a56fd28e4b94cc563c96a Mon Sep 17 00:00:00 2001 From: Duo Wang Date: Thu, 15 Feb 2024 14:36:10 -0800 Subject: [PATCH] [clang][test] Add test for incompatible cv-qualified reference types in conversion function template --- .../temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp| 9 + 1 file changed, 9 insertions(+) diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp index 085976b081332b..974240c514846c 100644 --- a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp +++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp @@ -130,6 +130,15 @@ namespace non_ptr_ref_cv_qual { int (&test_conv_to_arr_1)[3] = ConvToArr(); // ok const int (&test_conv_to_arr_2)[3] = ConvToArr(); // ok, with qualification conversion + struct ConvToConstArr { +template +operator const Arr &() { // expected-note {{candidate}} + static_assert(N == 3, ""); +} + }; + Arr &test_conv_to_const_arr_1 = ConvToConstArr(); // expected-error {{no viable}} + const Arr &test_conv_to_const_arr_2 = ConvToConstArr(); // ok + #if __cplusplus >= 201702L template using Function = T(U...) noexcept(Noexcept); template struct ConvToFunction { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Add test for incompatible cv-qualified reference types in conversion function template (PR #81950)
wdunicornpro wrote: Ping: This helps to improve test coverage. https://github.com/llvm/llvm-project/pull/81950 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][test] Fix instantiation-depth-default.cpp under ubsan config on Windows (PR #91021)
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 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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits