public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bugreport0 at proton dot me" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/111529] New: ICE on bool conversion in an unrolled loop condition inside template lambda nested in another template scope
Date: Thu, 21 Sep 2023 21:53:33 +0000	[thread overview]
Message-ID: <bug-111529-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-09-21 21:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 21:53 bugreport0 at proton dot me [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111529-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).