[clang] [Clang] fix crash due to incorrect argument position in merging deduced template arguments (PR #118041)

2024-11-29 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-aarch64-quick` 
running on `linaro-clang-aarch64-quick` while building `clang` at step 5 "ninja 
check 1".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/65/builds/8581


Here is the relevant piece of the build log for the reference

```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'lit :: googletest-timeout.py' FAILED 

Exit Code: 1

Command Output (stdout):
--
# RUN: at line 9
not env -u FILECHECK_OPTS "/usr/bin/python3.10" 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit.py -j1 
--order=lexical -v Inputs/googletest-timeout--param 
gtest_filter=InfiniteLoopSubTest --timeout=1 > 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/Output/googletest-timeout.py.tmp.cmd.out
# executed command: not env -u FILECHECK_OPTS /usr/bin/python3.10 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit.py -j1 
--order=lexical -v Inputs/googletest-timeout --param 
gtest_filter=InfiniteLoopSubTest --timeout=1
# .---command stderr
# | lit.py: 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit/main.py:72:
 note: The test suite configuration requested an individual test timeout of 0 
seconds but a timeout of 1 seconds was requested on the command line. Forcing 
timeout to be 1 seconds.
# `-
# RUN: at line 11
FileCheck --check-prefix=CHECK-INF < 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/Output/googletest-timeout.py.tmp.cmd.out
 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# executed command: FileCheck --check-prefix=CHECK-INF 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# .---command stderr
# | 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py:34:14:
 error: CHECK-INF: expected string not found in input
# | # CHECK-INF: Timed Out: 1
# |  ^
# | :13:29: note: scanning from here
# | Reached timeout of 1 seconds
# | ^
# | :37:2: note: possible intended match here
# |  Timed Out: 2 (100.00%)
# |  ^
# | 
# | Input file: 
# | Check file: 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<
# | .
# | .
# | .
# | 8:  
# | 9:  
# |10: -- 
# |11: exit: -9 
# |12: -- 
# |13: Reached timeout of 1 seconds 
# | check:34'0 X error: no match found
# |14:  
# | check:34'0 ~
# |15: TIMEOUT: googletest-timeout :: DummySubDir/OneTest.py/1/2 (2 
of 2) 
# | check:34'0 
~~~
# |16:  TEST 'googletest-timeout :: 
DummySubDir/OneTest.py/1/2' FAILED  
# | check:34'0 
~
# |17: Script(shard): 
# | check:34'0 ~~~
...

```



https://github.com/llvm/llvm-project/pull/118041
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] fix crash due to incorrect argument position in merging deduced template arguments (PR #118041)

2024-11-29 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk closed 
https://github.com/llvm/llvm-project/pull/118041
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] fix crash due to incorrect argument position in merging deduced template arguments (PR #118041)

2024-11-28 Thread Younan Zhang via cfe-commits

https://github.com/zyn0217 approved this pull request.


https://github.com/llvm/llvm-project/pull/118041
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] fix crash due to incorrect argument position in merging deduced template arguments (PR #118041)

2024-11-28 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Oleksandr T. (a-tarasyuk)


Changes

Fixes #113659 

---
Full diff: https://github.com/llvm/llvm-project/pull/118041.diff


3 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+1) 
- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+2-1) 
- (added) clang/test/SemaTemplate/template-args-deduction-aggregates.cpp (+12) 


``diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 2ecd19bdc39448..7e78e7eb9ec0a3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -760,6 +760,7 @@ Bug Fixes to C++ Support
   missing placeholder return type. (#GH78694)
 - Fixed a bug where bounds of partially expanded pack indexing expressions 
were checked too early. (#GH116105)
 - Fixed an assertion failure caused by using ``consteval`` in condition in 
consumed analyses. (#GH117385)
+- Fix a crash caused by incorrect argument position in merging deduced 
template arguments. (#GH113659)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 62a0c30d995020..fad20b37a7d9a2 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -376,7 +376,7 @@ checkDeducedTemplateArguments(ASTContext &Context,
 for (TemplateArgument::pack_iterator
  XA = X.pack_begin(),
  XAEnd = X.pack_end(), YA = Y.pack_begin(), YAEnd = Y.pack_end();
- XA != XAEnd; ++XA, ++YA) {
+ XA != XAEnd; ++XA) {
   if (YA != YAEnd) {
 TemplateArgument Merged = checkDeducedTemplateArguments(
 Context, DeducedTemplateArgument(*XA, 
X.wasDeducedFromArrayBound()),
@@ -384,6 +384,7 @@ checkDeducedTemplateArguments(ASTContext &Context,
 if (Merged.isNull() && !(XA->isNull() && YA->isNull()))
   return DeducedTemplateArgument();
 NewPack.push_back(Merged);
+++YA;
   } else {
 NewPack.push_back(*XA);
   }
diff --git a/clang/test/SemaTemplate/template-args-deduction-aggregates.cpp 
b/clang/test/SemaTemplate/template-args-deduction-aggregates.cpp
new file mode 100644
index 00..afe78d0873bb33
--- /dev/null
+++ b/clang/test/SemaTemplate/template-args-deduction-aggregates.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20
+
+// expected-no-diagnostics
+
+namespace GH113659 {
+template  struct S {};
+struct T {};
+struct U {};
+
+template  struct B : S, Args... {};
+B b{S{}};
+}

``




https://github.com/llvm/llvm-project/pull/118041
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] fix crash due to incorrect argument position in merging deduced template arguments (PR #118041)

2024-11-28 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk created 
https://github.com/llvm/llvm-project/pull/118041

Fixes #113659 

>From 59fa1de4e6638f1c8bba39e2e55c43cb3991fc3c Mon Sep 17 00:00:00 2001
From: Oleksandr T 
Date: Fri, 29 Nov 2024 02:54:53 +0200
Subject: [PATCH] [Clang] fix crash due to incorrect argument position in
 merging deduced template arguments

---
 clang/docs/ReleaseNotes.rst  |  1 +
 clang/lib/Sema/SemaTemplateDeduction.cpp |  3 ++-
 .../template-args-deduction-aggregates.cpp   | 12 
 3 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 
clang/test/SemaTemplate/template-args-deduction-aggregates.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 2ecd19bdc39448..7e78e7eb9ec0a3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -760,6 +760,7 @@ Bug Fixes to C++ Support
   missing placeholder return type. (#GH78694)
 - Fixed a bug where bounds of partially expanded pack indexing expressions 
were checked too early. (#GH116105)
 - Fixed an assertion failure caused by using ``consteval`` in condition in 
consumed analyses. (#GH117385)
+- Fix a crash caused by incorrect argument position in merging deduced 
template arguments. (#GH113659)
 
 Bug Fixes to AST Handling
 ^
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 62a0c30d995020..fad20b37a7d9a2 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -376,7 +376,7 @@ checkDeducedTemplateArguments(ASTContext &Context,
 for (TemplateArgument::pack_iterator
  XA = X.pack_begin(),
  XAEnd = X.pack_end(), YA = Y.pack_begin(), YAEnd = Y.pack_end();
- XA != XAEnd; ++XA, ++YA) {
+ XA != XAEnd; ++XA) {
   if (YA != YAEnd) {
 TemplateArgument Merged = checkDeducedTemplateArguments(
 Context, DeducedTemplateArgument(*XA, 
X.wasDeducedFromArrayBound()),
@@ -384,6 +384,7 @@ checkDeducedTemplateArguments(ASTContext &Context,
 if (Merged.isNull() && !(XA->isNull() && YA->isNull()))
   return DeducedTemplateArgument();
 NewPack.push_back(Merged);
+++YA;
   } else {
 NewPack.push_back(*XA);
   }
diff --git a/clang/test/SemaTemplate/template-args-deduction-aggregates.cpp 
b/clang/test/SemaTemplate/template-args-deduction-aggregates.cpp
new file mode 100644
index 00..afe78d0873bb33
--- /dev/null
+++ b/clang/test/SemaTemplate/template-args-deduction-aggregates.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20
+
+// expected-no-diagnostics
+
+namespace GH113659 {
+template  struct S {};
+struct T {};
+struct U {};
+
+template  struct B : S, Args... {};
+B b{S{}};
+}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits