public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111529] New: ICE on bool conversion in an unrolled loop condition inside template lambda nested in another template scope
@ 2023-09-21 21:53 bugreport0 at proton dot me
  2023-09-21 22:00 ` [Bug c++/111529] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: bugreport0 at proton dot me @ 2023-09-21 21:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111529
           Summary: ICE on bool conversion in an unrolled loop condition
                    inside template lambda nested in another template
                    scope
           Product: gcc
           Version: 13.2.0
               URL: https://godbolt.org/z/q64oM6bre
            Status: UNCONFIRMED
          Keywords: c++-lambda, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugreport0 at proton dot me
  Target Milestone: ---

template <int x>
void f() {
  [](auto c) {
    #pragma GCC unroll 9
    for (int i = c; i; --i) {
    }
  };
}

int main() {
  f<0>();
}


compiles with -std=c++14 but with -std=c++17 generates


<source>: In instantiation of 'void f() [with int x = 0]':
<source>:11:7:   required from here
<source>:5:19: internal compiler error: unexpected expression '(bool)i' of kind
implicit_conv_expr
    5 |     for (int i = c; i; --i) {
      |                   ^
0x1ce7bde internal_error(char const*, ...)
        ???:0
0x8f1d4c finish_for_cond(tree_node*, tree_node*, bool, unsigned short)
        ???:0
0x8d0054 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x8beb17 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x8d993b instantiate_pending_templates(int)
        ???:0
0x7d9f35 c_parse_final_cleanups()
        ???:0
0x98c608 c_common_parse_file()
        ???:0


Making any explicit conversion on the counter inside the condition breaks
compilation with -std=c++14 too.

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

end of thread, other threads:[~2024-05-24 18:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21 21:53 [Bug c++/111529] New: ICE on bool conversion in an unrolled loop condition inside template lambda nested in another template scope bugreport0 at proton dot me
2023-09-21 22:00 ` [Bug c++/111529] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-09-21 22:09 ` bugreport0 at proton dot me
2023-09-21 22:12 ` pinskia at gcc dot gnu.org
2023-09-21 22:15 ` pinskia at gcc dot gnu.org
2023-09-22 13:01 ` cvs-commit at gcc dot gnu.org
2024-05-08 12:16 ` [Bug c++/111529] [11/12/13 " rguenth at gcc dot gnu.org
2024-05-24 13:25 ` cvs-commit at gcc dot gnu.org
2024-05-24 13:26 ` cvs-commit at gcc dot gnu.org
2024-05-24 18:38 ` cvs-commit at gcc dot gnu.org
2024-05-24 18:41 ` jason 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).