[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs created https://github.com/llvm/llvm-project/pull/67722 For the following snippets clang performs the same steps: ``` S s[2][2]; auto [a1,a2] = s; ``` ``` void crash() { S s[2][2]; int arr[4]; arr[0] = [s] { return s[0][0].i; }(); } ``` >From the two h

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Changes For the following snippets clang performs the same steps: ``` S s[2][2]; auto [a1,a2] = s; ``` ``` void crash() { S s[2][2]; int arr[4]; arr[0] = [s] { return s[0][0].i; }(); } ``` >From the two however the latter crashes. The

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From 264c0fa73e48818cccf86d1f1d240fcebd099a96 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH] [clang] Fix a crash fr

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From fb0bf2fcc9d873ce9cf4269cfb6de8786ac6f343 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH] [clang] Fix a crash fr

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs edited https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 3231a365c185094abe8af5970ccdbcbcd2bc001a 5125de27700e5ba8535deaf6039d578890f9f96d --

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From fb0bf2fcc9d873ce9cf4269cfb6de8786ac6f343 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH 1/2] [clang] Fix a cras

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs edited https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
isuckatcs wrote: I decided to push the solution where the temporary is put inside a `FullExpressionRAII` instead of not letting clang keep going in case of an evaluation failure. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Shafik Yaghmour via cfe-commits
shafik wrote: Thank you for the fix! I don't think I understand the bug based on your description. You say >the reason is that after evaluating the first iteration, we note a failure and >would return, however during analyzing the second snippet You start saying *first iteration* and then r

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Richard Smith via cfe-commits
@@ -10950,6 +10950,9 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr( } bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { + + FullExpressionRAII Scope(Info); + zygoloid wrote: This should be done after we evaluate the

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Richard Smith via cfe-commits
https://github.com/zygoloid requested changes to this pull request. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
@@ -10950,6 +10950,9 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr( } bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { + + FullExpressionRAII Scope(Info); + isuckatcs wrote: > so that we destroy temporaries after e

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Richard Smith via cfe-commits
@@ -10950,6 +10950,9 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr( } bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { + + FullExpressionRAII Scope(Info); + zygoloid wrote: Here's a rejects-valid testcase: https://

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Richard Smith via cfe-commits
@@ -10950,6 +10950,9 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr( } bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { + + FullExpressionRAII Scope(Info); + zygoloid wrote: Better testcase, avoiding the use of muta

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
isuckatcs wrote: > I don't think I understand the bug based on your description. I'll try my best to explain it a bit better. So, this is the function that runs and triggers the assertion failure at one point. ```c++ bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) {

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From fb0bf2fcc9d873ce9cf4269cfb6de8786ac6f343 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH 1/3] [clang] Fix a cras

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
@@ -10950,6 +10950,9 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr( } bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { + + FullExpressionRAII Scope(Info); + isuckatcs wrote: I added your second testcase to the patc

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs resolved https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Richard Smith via cfe-commits
https://github.com/zygoloid commented: ExprConstant changes LGTM. I don't have state on the Interp changes; someone else should review that. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Timm Baeder via cfe-commits
tbaederr wrote: Remove the `Interp/` changes please, I'll have a look at that later. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From fb0bf2fcc9d873ce9cf4269cfb6de8786ac6f343 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH 1/3] [clang] Fix a cras

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread via cfe-commits
isuckatcs wrote: Removed `Interp/` changes. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-28 Thread Timm Baeder via cfe-commits
tbaederr wrote: I've pushed https://github.com/llvm/llvm-project/commit/38018ecf965fda81d15edfb904b5b28adb6051b0 since, so you could remove the `CUR_INTERP` stuff from there and get a new test case for free. https://github.com/llvm/llvm-project/pull/67722 _

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
cor3ntin wrote: Does this fixes #67317? #67688? If so, might as well add the test cases and mark these as being fixed too. You are going to need at add a release note in `clang/docs/ReleaseNotes.rst` https://github.com/llvm/llvm-project/pull/67722 ___

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From a6d3c27ea0b35e32198e1652fe3f6d647bc8cec4 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH 1/4] [clang] Fix a cras

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
isuckatcs wrote: It doesn't fix #67317 and #67688 is already marked as a duplicate of this and closed. I rebased and removed `CUR_INTERP` and documented the changes in `ReleaseNotes.rst`. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commit

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread Timm Baeder via cfe-commits
@@ -352,10 +352,6 @@ namespace ZeroInit { } namespace ArrayInitLoop { - /// FIXME: The ArrayInitLoop for the decomposition initializer in g() has - /// f(n) as its CommonExpr. We need to evaluate that exactly once and not - /// N times as we do right now. t

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
@@ -370,6 +372,9 @@ Bug Fixes to C++ Support argument. Fixes: (`#67395 `_) +- Fix a bug when destructors in a ``constexpr`` structured binding were + called at the wrong place. cor3ntin wrote: ```suggest

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
https://github.com/cor3ntin approved this pull request. LGTM except for a small nit in the changelog https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
@@ -352,10 +352,6 @@ namespace ZeroInit { } namespace ArrayInitLoop { - /// FIXME: The ArrayInitLoop for the decomposition initializer in g() has - /// f(n) as its CommonExpr. We need to evaluate that exactly once and not - /// N times as we do right now. i

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From a6d3c27ea0b35e32198e1652fe3f6d647bc8cec4 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH 1/5] [clang] Fix a cras

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
https://github.com/isuckatcs resolved https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
https://github.com/isuckatcs resolved https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/67722 >From a6d3c27ea0b35e32198e1652fe3f6d647bc8cec4 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:43:23 +0200 Subject: [PATCH 1/6] [clang] Fix a cras

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
https://github.com/isuckatcs closed https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
@@ -10977,6 +10987,9 @@ bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { return false; Success = false; } + +// Make sure we run the destructors too. +Scope.destroy(); shafik wrote: So we don't have to ch

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: Apologies for the post commit review, just have one question. https://github.com/llvm/llvm-project/pull/67722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [clang] Fix a crash from nested ArrayInitLoopExpr (PR #67722)

2023-09-29 Thread via cfe-commits
@@ -10977,6 +10987,9 @@ bool ArrayExprEvaluator::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) { return false; Success = false; } + +// Make sure we run the destructors too. +Scope.destroy(); isuckatcs wrote: The result of the i