From bf2cf6f3f1851054237ee7df99bdf60bf5a3e3ae Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 1 Feb 2023 14:49:36 +0100 Subject: Fortran: Extend align-clause checks of OpenMP's allocate directive gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Check also for power of two. libgomp/ChangeLog: * testsuite/libgomp.fortran/allocate-3.f90: Fix ALIGN usage, remove unused -fdump-tree-original. * testsuite/libgomp.fortran/allocate-4.f90: New. --- gcc/fortran/openmp.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index cc1eab9..1897e1d 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -7392,11 +7392,12 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, || n->u.align->ts.type != BT_INTEGER || n->u.align->rank != 0 || gfc_extract_int (n->u.align, &alignment) - || alignment <= 0) + || alignment <= 0 + || !pow2p_hwi (alignment)) { - gfc_error ("ALIGN modifier requires a scalar positive " - "constant integer alignment expression at %L", - &n->u.align->where); + gfc_error ("ALIGN modifier requires at %L a scalar positive " + "constant integer alignment expression that is a " + "power of two", &n->u.align->where); break; } } -- cgit v1.1