[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-01-27 Thread Viktoriia Bakalova via cfe-commits
VitaNuo wrote: > If anyone wants to take over/help, feel free to do so. SGTM. I could reproduce the issue, but then ran out of capacity. I'm not sure I'll be able to prioritize this soon vs. the module-related work. https://github.com/llvm/llvm-project/pull/118480

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-01-27 Thread kadir çetinkaya via cfe-commits
kadircet wrote: > ping, is this still a problem? yes, this is still happening. but I am currently lacking cycles to dig deeper into expression evaluation to see if this is the right fix given the reproducer. @VitaNuo was to take a look with some limited capacity, but I think she's also in a s

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-01-24 Thread Shafik Yaghmour via cfe-commits
shafik wrote: ping, is this still a problem? https://github.com/llvm/llvm-project/pull/118480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-01-16 Thread Viktoriia Bakalova via cfe-commits
VitaNuo wrote: > need to pass -std=c++20. > passing -DLLVM_USE_SANITIZER=Address in your cmake configuration should be > enough for that. Makes sense, I could reproduce the example. https://github.com/llvm/llvm-project/pull/118480 ___ cfe-commits mai

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-01-15 Thread kadir çetinkaya via cfe-commits
kadircet wrote: sample in https://github.com/llvm/llvm-project/pull/118480#issuecomment-2538988006 still triggers the crash for me, need to pass `-std=c++20`. but note that it isn't the sample that should be built with ASAN, it's the clang itself that needs to be built with ASAN. passing `-DL

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2025-01-14 Thread Viktoriia Bakalova via cfe-commits
VitaNuo wrote: > Here's a small reprocase (thanks to cvise for getting it) The repro doesn't compile in this shape, I've changed it to ``` template constexpr InputIterator find_if(InputIterator first, Predicate pred) { if (pred(*first)) ; return first; } template struct basic_string_

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2024-12-12 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Here's a small reprocase (thanks for cvise for getting it): ```cpp // Run under ASAN: clang -fsyntax-only template constexpr _InputIterator find_if(_InputIterator __first, _Predicate __pred) { if (__pred(*__first)) ; } template struct basic_string_view { char __d

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2024-12-03 Thread kadir çetinkaya via cfe-commits
@@ -4515,6 +4515,8 @@ handleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv, QualType Type, } APValue Lit; + // Make sure we clean up the temporary created below. + FullExpressionRAII CleanupTemps(Info); kadircet wrote: > we c

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2024-12-03 Thread Ilya Biryukov via cfe-commits
@@ -4515,6 +4515,8 @@ handleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv, QualType Type, } APValue Lit; + // Make sure we clean up the temporary created below. + FullExpressionRAII CleanupTemps(Info); ilya-biryukov wrote: C

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2024-12-03 Thread kadir çetinkaya via cfe-commits
kadircet wrote: still trying to come up with a reproducer. i am also not sure if this is the best place to have the cleanup, but if i did that closer to [leaves](https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/ExprConstant.cpp#L16376-L16385) tests start failing. so open for sugge

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2024-12-03 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: kadir çetinkaya (kadircet) Changes following ASAN failure is fixed with this patch. We store cleanups in EvalInfo, which are usually run with certain ScopeRAII objects. We can have temporaries in the cleanup stack, backed by CallStackFrame.

[clang] [clang] Fix a use-after-free in expression evaluation (PR #118480)

2024-12-03 Thread kadir çetinkaya via cfe-commits
https://github.com/kadircet created https://github.com/llvm/llvm-project/pull/118480 following ASAN failure is fixed with this patch. We store cleanups in EvalInfo, which are usually run with certain ScopeRAII objects. We can have temporaries in the cleanup stack, backed by CallStackFrame. If su