public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107024] New: ICE in finish_expr_stmt, at cp/semantics.cc:872
@ 2022-09-24  4:06 alex at clmbng dot com
  2022-09-26 11:45 ` [Bug c++/107024] " marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: alex at clmbng dot com @ 2022-09-24  4:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107024

            Bug ID: 107024
           Summary: ICE in finish_expr_stmt, at cp/semantics.cc:872
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alex at clmbng dot com
  Target Milestone: ---

Full code here: https://godbolt.org/z/6nnTonMjq

GCC seems to fail in certain situations involving lambdas in unevaluated
contexts. Here's a minimal example that triggers an ICE at the same spot:
https://godbolt.org/z/99jnqeeoG.

This is similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10569, but
triggers in a different location.

Using: GCC 12.2.0
Target: x86_64-linux-gnu
CL: -std=c++20

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/107024] ICE in finish_expr_stmt, at cp/semantics.cc:872
  2022-09-24  4:06 [Bug c++/107024] New: ICE in finish_expr_stmt, at cp/semantics.cc:872 alex at clmbng dot com
@ 2022-09-26 11:45 ` marxin at gcc dot gnu.org
  2022-09-26 12:27 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-26 11:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107024

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2022-09-26

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Please always include a test-case here and not via godbolt.

Confirmed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/107024] ICE in finish_expr_stmt, at cp/semantics.cc:872
  2022-09-24  4:06 [Bug c++/107024] New: ICE in finish_expr_stmt, at cp/semantics.cc:872 alex at clmbng dot com
  2022-09-26 11:45 ` [Bug c++/107024] " marxin at gcc dot gnu.org
@ 2022-09-26 12:27 ` marxin at gcc dot gnu.org
  2022-09-27  0:57 ` alex at clmbng dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-26 12:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107024

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---

Test-case:

#include <iostream>
#include <utility>
#include <vector>

template <size_t...NN>
struct Integral_pack
{
    static constexpr size_t data[sizeof...(NN)] = { NN... };
    std::vector<size_t> vec { NN... };
};

template <size_t N, auto Exp, size_t...NN>
consteval auto apply_fold_impl(std::index_sequence<NN...>)
{
    return Integral_pack<Exp(N, NN)...>{};
};

template <size_t N, auto Exp, size_t C>
consteval auto apply_fold()
{
    return apply_fold_impl<N, Exp>(std::make_index_sequence<C>{});
}

template <size_t N, size_t C>
using left_shift 
    = decltype(apply_fold<N, [](size_t L, size_t R) { return (L << R); },
C>());

template <size_t N, size_t C>
auto ls_vec = left_shift<N, C>{}.vec;

template <size_t N, size_t C>
using right_shift 
    = decltype(apply_fold<N, [](size_t L, size_t R) { return (L >> R); },
C>());

template <size_t N, size_t C>
std::vector<size_t> rs_vec = right_shift<N, C>{}.vec;

int main() 
{
    for(auto& i : ls_vec<12351, 15>) std::cout << i << " ";
    std::cout << "\n";
    for(auto& i : rs_vec<12351, 15>) std::cout << i << " ";
    std::cout << "\n";
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/107024] ICE in finish_expr_stmt, at cp/semantics.cc:872
  2022-09-24  4:06 [Bug c++/107024] New: ICE in finish_expr_stmt, at cp/semantics.cc:872 alex at clmbng dot com
  2022-09-26 11:45 ` [Bug c++/107024] " marxin at gcc dot gnu.org
  2022-09-26 12:27 ` marxin at gcc dot gnu.org
@ 2022-09-27  0:57 ` alex at clmbng dot com
  2022-09-27  8:15 ` marxin at gcc dot gnu.org
  2024-04-13 20:44 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: alex at clmbng dot com @ 2022-09-27  0:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107024

--- Comment #3 from alex at clmbng dot com ---
Minimal test-case:

struct A { int fun(); };

template <auto> 
consteval auto aaa() { return A{}; }

template <int> 
using aa = decltype(aaa<[]{}>());

template <int N> 
A a = aa<N>{};

int main() 
{
    return a<42>.fun();
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/107024] ICE in finish_expr_stmt, at cp/semantics.cc:872
  2022-09-24  4:06 [Bug c++/107024] New: ICE in finish_expr_stmt, at cp/semantics.cc:872 alex at clmbng dot com
                   ` (2 preceding siblings ...)
  2022-09-27  0:57 ` alex at clmbng dot com
@ 2022-09-27  8:15 ` marxin at gcc dot gnu.org
  2024-04-13 20:44 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-27  8:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107024

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-reduction             |
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-4303-gf968ef9b8df2bc22, was rejected before the revision.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/107024] ICE in finish_expr_stmt, at cp/semantics.cc:872
  2022-09-24  4:06 [Bug c++/107024] New: ICE in finish_expr_stmt, at cp/semantics.cc:872 alex at clmbng dot com
                   ` (3 preceding siblings ...)
  2022-09-27  8:15 ` marxin at gcc dot gnu.org
@ 2024-04-13 20:44 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13 20:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107024

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
             Blocks|                            |107430
           Keywords|                            |c++-lambda
   Target Milestone|---                         |14.0

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the trunk for GCC 14 by the recent lambda template patches.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107430
[Bug 107430] [meta-bug] lambda in decltype

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-13 20:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-24  4:06 [Bug c++/107024] New: ICE in finish_expr_stmt, at cp/semantics.cc:872 alex at clmbng dot com
2022-09-26 11:45 ` [Bug c++/107024] " marxin at gcc dot gnu.org
2022-09-26 12:27 ` marxin at gcc dot gnu.org
2022-09-27  0:57 ` alex at clmbng dot com
2022-09-27  8:15 ` marxin at gcc dot gnu.org
2024-04-13 20:44 ` 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).