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

            Bug ID: 124253
           Summary: ICE: crash at cp/parser.cc:1662 with #pragma omp task
                    depend(inout: this) in C++23 explicit object member
                    function
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: attackerj1113 at gmail dot com
  Target Milestone: ---

The following code causes ICE on x86-64 gcc since version 14.1 and still
reproducible on trunk with "-std=c++23 -fopenmp" or "-fopenmp" flag:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct S
{
    template<class Self>
    void bar(this Self&& self) 
    {
        #pragma omp task depend(inout: this);
    }
};

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please check https://godbolt.org/z/ox8vnshE6 for more info

Compiler Output:

<source>: In explicit object member function 'void S::bar(this Self&&)':
<source>:6:38: error: 'this' is unavailable for explicit object member
functions [-Wtemplate-body]
    6 |         #pragma omp task depend(inout: this);
      |                                      ^
<source>:4:26: note: use explicit object parameter 'self' instead
    4 |     void bar(this Self&& self)
      |              ~~~~~~~~~~~~^~~~
<source>:6:46: internal compiler error: in ~saved_token_sentinel, at
cp/parser.cc:1662
    6 |         #pragma omp task depend(inout: this);
      |                                              ^
0x2963338 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x295807b internal_error(char const*, ...)
        ???:0
0xb21a12 fancy_abort(char const*, int, char const*)
        ???:0
0xd6d023 c_parse_file()
        ???:0
0xef6ef9 c_common_parse_file()
        ???:0
/cefs/5b/5b7473000a337cbbdec6c161_gcc-trunk-20260226/bin/../libexec/gcc/x86_64-linux-gnu/16.0.1/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/5b/5b7473000a337cbbdec6c161_gcc-trunk-20260226/bin/../lib/gcc/x86_64-linux-gnu/16.0.1/
-D_GNU_SOURCE -D_REENTRANT <source> -quiet -dumpdir /app/ -dumpbase output.cpp
-dumpbase-ext .cpp -masm=intel -mtune=generic -march=x86-64 -g -std=c++23
-fdiagnostics-color=always -fno-verbose-asm -fopenmp -o /app/output.s
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
  • [Bug c++/124253] New: ICE: cra... attackerj1113 at gmail dot com via Gcc-bugs

Reply via email to