OpenMP: Reject non-const 'condition' trait in Fortran
OpenMP 5.0 only permits constant expressions for the 'condition' trait in context selectors; this is relaxed in 5.2 but not implemented. In order to avoid wrong code, it is now rejected. Additionally, in Fortran, 'condition' should not accept an integer expression, which is now ensured. Additionally, as 'device_num' should be a conforming device number, there is now a check on the value. PR middle-end/113904 gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_context_selector): Handle splitting of OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_context_selector): Handle splitting of OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_trans_omp_declare_variant): Handle splitting of OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. * openmp.cc (gfc_match_omp_context_selector): Likewise; rejects non-const device_num/condition; improve diagnostic. gcc/ChangeLog: * omp-general.cc (struct omp_ts_info): Update for splitting of OMP_TRAIT_PROPERTY_EXPR into OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. * omp-selectors.h (enum omp_tp_type): Replace OMP_TRAIT_PROPERTY_EXPR by OMP_TRAIT_PROPERTY_{DEV_NUM,BOOL}_EXPR. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/declare-variant-1.f90: Change 'condition' trait's argument from integer to a logical expression. * gfortran.dg/gomp/declare-variant-11.f90: Likewise. * gfortran.dg/gomp/declare-variant-12.f90: Likewise. * gfortran.dg/gomp/declare-variant-13.f90: Likewise. * gfortran.dg/gomp/declare-variant-2.f90: Likewise. * gfortran.dg/gomp/declare-variant-2a.f90: Likewise. * gfortran.dg/gomp/declare-variant-3.f90: Likewise. * gfortran.dg/gomp/declare-variant-4.f90: Likewise. * gfortran.dg/gomp/declare-variant-6.f90: Likewise. * gfortran.dg/gomp/declare-variant-8.f90: Likewise. * gfortran.dg/gomp/declare-variant-20.f90: New test.
Showing
- gcc/c/c-parser.cc 2 additions, 1 deletiongcc/c/c-parser.cc
- gcc/cp/parser.cc 2 additions, 1 deletiongcc/cp/parser.cc
- gcc/fortran/openmp.cc 25 additions, 5 deletionsgcc/fortran/openmp.cc
- gcc/fortran/trans-openmp.cc 2 additions, 1 deletiongcc/fortran/trans-openmp.cc
- gcc/omp-general.cc 2 additions, 2 deletionsgcc/omp-general.cc
- gcc/omp-selectors.h 2 additions, 1 deletiongcc/omp-selectors.h
- gcc/testsuite/gfortran.dg/gomp/declare-variant-1.f90 2 additions, 2 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-1.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-11.f90 2 additions, 2 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-11.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-12.f90 6 additions, 6 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-12.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-13.f90 1 addition, 1 deletiongcc/testsuite/gfortran.dg/gomp/declare-variant-13.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-2.f90 4 additions, 4 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-2.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-20.f90 51 additions, 0 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-20.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-2a.f90 2 additions, 2 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-2a.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-3.f90 4 additions, 4 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-3.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-4.f90 4 additions, 4 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-4.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-6.f90 7 additions, 7 deletionsgcc/testsuite/gfortran.dg/gomp/declare-variant-6.f90
- gcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90 1 addition, 1 deletiongcc/testsuite/gfortran.dg/gomp/declare-variant-8.f90
Loading
Please register or sign in to comment