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

            Bug ID: 122570
           Summary: [16 Regression] With metadirectives, ICE in
                    gfc_trans_omp_set_selector, at
                    fortran/trans-openmp.cc:9602
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: parras at gcc dot gnu.org
  Target Milestone: ---

Created attachment 62714
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62714&action=edit
Testcase, compile with 'gfortran -fopenmp'

Reduced testcase from SPECaccel's 463.swim.

Compiles with GCC 15.

    9 | !$omp&        distribute parallel do)
      |                                      1
internal compiler error: Segmentation fault
0x27aeebf internal_error(char const*, ...)
        gcc/diagnostic-global-context.cc:787
0x12b5def crash_signal
        gcc/toplev.cc:323
0xc2d2ea gfc_trans_omp_set_selector
        gcc/fortran/trans-openmp.cc:9550
0xc2ee7b gfc_trans_omp_metadirective(gfc_code*)
        gcc/fortran/trans-openmp.cc:10172

* * *

9435          return gfc_trans_omp_metadirective (code);
(gdb) p gfc_debug_code(code)

!$OMP METADIRECTIVE
    WHEN ()

!$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO

DO inital:j=1 inital:n 1
END DO
      !$OMP END TARGET TEAMS DISTRIBUTE PARALLEL DO
    WHEN ()

!$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO

DO inital:j=1 inital:n 1
END DO
      !$OMP END TARGET TEAMS DISTRIBUTE PARALLEL DO
    DEFAULT ()

  !$OMP END METADIRECTIVE

$3 = void


* * *


10170     while (variant)
(gdb) p *variant
$5 = {next = 0x376e800, where = {nextc = 0x375aa78, u = {lb = 0x375aa30,
location = 58042928}}, selectors = 0x3773670, stmt =
ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, code = 0x3773ba0}

(gdb) p *variant->next
$6 = {next = 0x377720e, where = {nextc = 0x6cb34dd6d02e9c7b, u = {lb =
0x375acd0, location = 58043600}}, selectors = 0x3773c90, stmt =
ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, code = 0x37740b0}

(gdb) p *variant->next->next
$7 = {next = 0x0, where = {nextc = 0x0, u = {lb = 0x0, location = 0}},
selectors = 0x0, stmt = ST_ARITHMETIC_IF, code = 0x0}

(gdb) p variant->next->next
$8 = (gfc_omp_variant *) 0x377720e

I think the last entry should be NULL and not point to a NULLified gfc_code.

Reply via email to