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

            Bug ID: 128192
           Summary: wrong code with --param=openacc-kernels=decompose when
                    an OpenACC kernels region contains try/catch
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kyuwoncho18 at gmail dot com
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

int main()
{
#pragma acc kernels
  {
    try {
      throw 7;
    } catch (...) {
    }
  }
}

godbolt: https://godbolt.org/z/dToaM7asK

The exception is caught within the kernels region, so the program should exit
normally with status 0. With -x c++ -g0 -O0 -fopenacc -foffload=disable
--param=openacc-kernels=decompose -lstdc++, it instead terminates with
"terminate called after throwing an instance of 'int'" (SIGABRT); -O1, -O2, -O3
and -Os give the same result. Removing --param=openacc-kernels=decompose makes
the program exit normally.

Reply via email to