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

            Bug ID: 122465
           Summary: ICE: segmentation fault in c_parse_file() instead of
                    normal exit when parsing malformed C++ for loop with
                    register size_t
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qingren2hxb at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/YKaeEKzd9
=====================================
#include <coroutine>
#include <cassert>

int main()
{    

 coroutines:
            constexpr size_t steps_to_resume_tested_coro{};
             threads:
                    for(register size_t i={i}:steps_to_resume_tested_coro){
                         asm("test $-1,%q[i]\t\n");
                          extern inline _Thread_local auto
some_thread_func->{return i;};
                        }


}
=====================================
# gcc -x c++ -fcoroutines

<source>: In function 'int main()':
<source>:8:23: error: 'size_t' does not name a type
    8 |             constexpr size_t steps_to_resume_tested_coro{};
      |                       ^~~~~~
<source>:3:1: note: 'size_t' is defined in header '<cstddef>'; this is probably
fixable by adding '#include <cstddef>'
    2 | #include <cassert>
  +++ |+#include <cstddef>
    3 | 
<source>:10:34: error: 'size_t' does not name a type
   10 |                     for(register size_t
i={i}:steps_to_resume_tested_coro){
      |                                  ^~~~~~
<source>:10:34: note: 'size_t' is defined in header '<cstddef>'; this is
probably fixable by adding '#include <cstddef>'
<source>:10:46: internal compiler error: Segmentation fault
   10 |                     for(register size_t
i={i}:steps_to_resume_tested_coro){
      |                                              ^
0x28fb988 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x28f077b internal_error(char const*, ...)
        ???:0
0xd44da3 c_parse_file()
        ???:0
0xeb5839 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Reply via email to