public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/108317] New: g++ is unable to capture vector-extended variables @ 2023-01-06 14:11 janezz55 at gmail dot com 2023-01-06 14:11 ` [Bug c++/108317] " janezz55 at gmail dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: janezz55 at gmail dot com @ 2023-01-06 14:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108317 Bug ID: 108317 Summary: g++ is unable to capture vector-extended variables Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Target Milestone: --- Created attachment 54204 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54204&action=edit sample file demonstrating the bug g++ will be unable to capture v_ in the code sample below, but clang++ will do so just fine. template <std::size_t M> auto operator+(pint<T, M> const& o) const noexcept { pint r; [&]<auto ...I>(std::index_sequence<I...>) noexcept { bool c; ( [&]() noexcept { if constexpr(I) { r.v_[I] = c + v_[I] + (I < M ? o.v_[I] : T{}); c = c ? r.v_[I] <= v_[I] : r.v_[I] < v_[I]; } else { c = (r.v_[I] = v_[I] + o.v_[I]) < v_[I]; } }(), ... ); }(std::make_index_sequence<N>()); return r; } error: 'v_' was not declared in this scope ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108317] g++ is unable to capture vector-extended variables 2023-01-06 14:11 [Bug c++/108317] New: g++ is unable to capture vector-extended variables janezz55 at gmail dot com @ 2023-01-06 14:11 ` janezz55 at gmail dot com 2023-01-06 18:04 ` [Bug c++/108317] dependent vector field is not causing this to be captured for fold expression inside a if constexpr block pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: janezz55 at gmail dot com @ 2023-01-06 14:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108317 --- Comment #1 from Janez Zemva <janezz55 at gmail dot com> --- Created attachment 54205 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54205&action=edit sample file demonstrating the bug ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108317] dependent vector field is not causing this to be captured for fold expression inside a if constexpr block 2023-01-06 14:11 [Bug c++/108317] New: g++ is unable to capture vector-extended variables janezz55 at gmail dot com 2023-01-06 14:11 ` [Bug c++/108317] " janezz55 at gmail dot com @ 2023-01-06 18:04 ` pinskia at gcc dot gnu.org 2023-01-06 18:07 ` [Bug c++/108317] dependent vector field is not causing field of this not to be found " pinskia at gcc dot gnu.org 2023-01-06 18:10 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-01-06 18:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108317 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target|#1 SMP PREEMPT_DYNAMIC Sat, | |31 Dec 2022 17:40:35 +0000 | Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-01-06 Summary|g++ is unable to capture |dependent vector field is |vector-extended variables |not causing this to be | |captured for fold | |expression inside a if | |constexpr block Host|#1 SMP PREEMPT_DYNAMIC Sat, | |31 Dec 2022 17:40:35 +0000 | --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Reduced testcase: template <typename T> struct pint { T __attribute__ ((vector_size (2 * sizeof(T)))) v_; void f(pint const& o) { [&]<int ...I>() { ( [&]() noexcept { if constexpr(I) { v_[I]; } }(), ... ); }.template operator()<0, 1>(); } }; int main() { using D = pint<int>; D a; D b; a.f(b); return 0; } ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108317] dependent vector field is not causing field of this not to be found for fold expression inside a if constexpr block 2023-01-06 14:11 [Bug c++/108317] New: g++ is unable to capture vector-extended variables janezz55 at gmail dot com 2023-01-06 14:11 ` [Bug c++/108317] " janezz55 at gmail dot com 2023-01-06 18:04 ` [Bug c++/108317] dependent vector field is not causing this to be captured for fold expression inside a if constexpr block pinskia at gcc dot gnu.org @ 2023-01-06 18:07 ` pinskia at gcc dot gnu.org 2023-01-06 18:10 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-01-06 18:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108317 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|dependent vector field is |dependent vector field is |not causing this to be |not causing field of this |captured for fold |not to be found for fold |expression inside a if |expression inside a if |constexpr block |constexpr block --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Simple workaround is to do: if constexpr(I) { r.v_[I] = c + this->v_[I] + (I < M ? o.v_[I] : T{}); c = c ? r.v_[I] <= this->v_[I] : r.v_[I] < this->v_[I]; } else { c = (r.v_[I] = this->v_[I] + o.v_[I]) < this->v_[I]; } ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/108317] dependent vector field is not causing field of this not to be found for fold expression inside a if constexpr block 2023-01-06 14:11 [Bug c++/108317] New: g++ is unable to capture vector-extended variables janezz55 at gmail dot com ` (2 preceding siblings ...) 2023-01-06 18:07 ` [Bug c++/108317] dependent vector field is not causing field of this not to be found " pinskia at gcc dot gnu.org @ 2023-01-06 18:10 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-01-06 18:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108317 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I should mention that <0> works but <0,1> fails. That might get a hint to a person fixing the issue of what is going wrong inside the compiler. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-06 18:10 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-01-06 14:11 [Bug c++/108317] New: g++ is unable to capture vector-extended variables janezz55 at gmail dot com 2023-01-06 14:11 ` [Bug c++/108317] " janezz55 at gmail dot com 2023-01-06 18:04 ` [Bug c++/108317] dependent vector field is not causing this to be captured for fold expression inside a if constexpr block pinskia at gcc dot gnu.org 2023-01-06 18:07 ` [Bug c++/108317] dependent vector field is not causing field of this not to be found " pinskia at gcc dot gnu.org 2023-01-06 18:10 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).