diff options
author | Tobias Burnus <burnus@net-b.de> | 2010-08-27 21:17:45 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-08-27 21:17:45 +0200 |
commit | 0cd0559e8ceb1764a41c8964f30a7de025956e8a (patch) | |
tree | def889db72c25844667547e301395013df023b00 /gcc/fortran/check.c | |
parent | cbadd64af4764fe75658a20c229050453379841d (diff) | |
download | gcc-0cd0559e8ceb1764a41c8964f30a7de025956e8a.zip gcc-0cd0559e8ceb1764a41c8964f30a7de025956e8a.tar.gz gcc-0cd0559e8ceb1764a41c8964f30a7de025956e8a.tar.bz2 |
re PR fortran/33197 (Fortran 2008: math functions)
gcc/fortran/
2010-08-27 Tobias Burnus <burnus@net-b.de>
PR fortran/33197
* gcc/fortran/intrinsic.c (add_functions): Add norm2 and parity.
* gcc/fortran/intrinsic.h (gfc_check_norm2, gfc_check_parity):
gfc_simplify_norm2, gfc_simplify_parity, gfc_resolve_norm2,
gfc_resolve_parity): New prototypes.
* gcc/fortran/gfortran.h (gfc_isym_id): New enum items
GFC_ISYM_NORM2 and GFC_ISYM_PARITY.
* gcc/fortran/iresolve.c (gfc_resolve_norm2,
gfc_resolve_parity): New functions.
* gcc/fortran/check.c (gfc_check_norm2, gfc_check_parity):
New functions.
* gcc/fortran/trans-intrinsic.c (gfc_conv_intrinsic_arith,
gfc_conv_intrinsic_function): Handle NORM2 and PARITY.
* gcc/fortran/intrinsic.texi (NORM2, PARITY): Add.
* gcc/fortran/simplify.c (simplify_transformation_to_array):
Add post-processing opterator.
(gfc_simplify_all, gfc_simplify_any, gfc_simplify_count,
gfc_simplify_product, gfc_simplify_sum): Update call.
(add_squared, do_sqrt, gfc_simplify_norm2, do_xor,
gfc_simplify_parity): New functions.
gcc/testsuite/
2010-08-27 Tobias Burnus <burnus@net-b.de>
PR fortran/33197
* gcc/testsuite/gfortran.dg/norm2_1.f90: New.
* gcc/testsuite/gfortran.dg/norm2_2.f90: New.
* gcc/testsuite/gfortran.dg/norm2_3.f90: New.
* gcc/testsuite/gfortran.dg/norm2_4.f90: New.
* gcc/testsuite/gfortran.dg/parity_1.f90: New.
* gcc/testsuite/gfortran.dg/parity_2.f90: New.
* gcc/testsuite/gfortran.dg/parity_3.f90: New.
libgfortran/
2010-08-27 Tobias Burnus <burnus@net-b.de>
PR fortran/33197
* libgfortran/m4/ifunction.m4 (FINISH_ARRAY_FUNCTION,
ARRAY_FUNCTION): Allow expression after loop.
* libgfortran/m4/norm2.m4: New for _gfortran_norm2_r{4,8,10,16}.
* libgfortran/m4/parity.m4: New for
* _gfortran_parity_l{1,2,4,8,16}.
* libgfortran/gfortran.map: Add new functions.
* libgfortran/Makefile.am: Ditto.
* libgfortran/m4/minloc1.m4: Add empty argument for
* ARRAY_FUNCTION.
* libgfortran/m4/maxloc1.m4: Ditto.
* libgfortran/m4/all.m4: Ditto.
* libgfortran/m4/minval.m4: Ditto.
* libgfortran/m4/maxval.m4: Ditto.
* libgfortran/m4/count.m4: Ditto.
* libgfortran/m4/product.m4: Ditto.
* libgfortran/m4/any.m4: Ditto.
* Makefile.in: Regenerated.
* generated/minval_r8.c: Regenerated.
* generated/maxloc1_4_r8.c: Regenerated.
* generated/minloc1_16_r16.c: Regenerated.
* generated/norm2_r4.c: Regenerated.
* generated/sum_i8.c: Regenerated.
* generated/parity_l2.c: Regenerated.
* generated/any_l16.c: Regenerated.
* generated/maxval_i2.c: Regenerated.
* generated/any_l2.c: Regenerated.
* generated/product_r4.c: Regenerated.
* generated/maxloc1_8_i4.c: Regenerated.
* generated/parity_l16.c: Regenerated.
* generated/all_l1.c: Regenerated.
* generated/product_i2.c: Regenerated.
* generated/minloc1_8_r16.c: Regenerated.
* generated/maxloc1_8_r16.c: Regenerated.
* generated/sum_r16.c: Regenerated.
* generated/sum_i1.c: Regenerated.
* generated/minloc1_4_r8.c: Regenerated.
* generated/maxloc1_16_r16.c: Regenerated.
* generated/minloc1_16_i4.c: Regenerated.
* generated/maxloc1_16_i4.c: Regenerated.
* generated/maxval_r16.c: Regenerated.
* generated/product_c10.c: Regenerated.
* generated/minloc1_8_i4.c: Regenerated.
* generated/all_l2.c: Regenerated.
* generated/product_c4.c: Regenerated.
* generated/sum_r4.c: Regenerated.
* generated/all_l16.c: Regenerated.
* generated/minloc1_16_r10.c: Regenerated.
* generated/sum_i2.c: Regenerated.
* generated/maxloc1_8_r8.c: Regenerated.
* generated/minval_i16.c: Regenerated.
* generated/parity_l4.c: Regenerated.
* generated/maxval_i4.c: Regenerated.
* generated/any_l4.c: Regenerated.
* generated/minval_i8.c: Regenerated.
* generated/maxloc1_4_i8.c: Regenerated.
* generated/minloc1_4_i16.c: Regenerated.
* generated/maxloc1_4_i16.c: Regenerated.
* generated/minloc1_8_r10.c: Regenerated.
* generated/product_i4.c: Regenerated.
* generated/maxloc1_8_r10.c: Regenerated.
* generated/sum_c16.c: Regenerated.
* generated/minloc1_16_r8.c: Regenerated.
* generated/maxloc1_16_r8.c: Regenerated.
* generated/count_4_l.c: Regenerated.
* generated/sum_r10.c: Regenerated.
* generated/count_8_l.c: Regenerated.
* generated/sum_c4.c: Regenerated.
* generated/maxloc1_16_r10.c: Regenerated.
* generated/minloc1_8_r8.c: Regenerated.
* generated/maxval_r10.c: Regenerated.
* generated/minval_i1.c: Regenerated.
* generated/maxloc1_4_i1.c: Regenerated.
* generated/minloc1_4_i8.c: Regenerated.
* generated/product_i16.c: Regenerated.
* generated/all_l4.c: Regenerated.
* generated/norm2_r16.c: Regenerated.
* generated/minval_r4.c: Regenerated.
* generated/maxloc1_4_r4.c: Regenerated.
* generated/sum_i4.c: Regenerated.
* generated/maxval_r8.c: Regenerated.
* generated/norm2_r8.c: Regenerated.
* generated/minloc1_4_i1.c: Regenerated.
* generated/minval_r16.c: Regenerated.
* generated/minval_i2.c: Regenerated.
* generated/maxloc1_4_i2.c: Regenerated.
* generated/product_r8.c: Regenerated.
* generated/maxloc1_8_i8.c: Regenerated.
* generated/sum_c10.c: Regenerated.
* generated/minloc1_4_r16.c: Regenerated.
* generated/maxloc1_4_r16.c: Regenerated.
* generated/count_1_l.c: Regenerated.
* generated/minloc1_4_r4.c: Regenerated.
* generated/minloc1_16_i8.c: Regenerated.
* generated/maxloc1_16_i8.c: Regenerated.
* generated/minloc1_4_i2.c: Regenerated.
* generated/maxloc1_8_i1.c: Regenerated.
* generated/minloc1_8_i8.c: Regenerated.
* generated/product_r16.c: Regenerated.
* generated/product_c8.c: Regenerated.
* generated/sum_r8.c: Regenerated.
* generated/norm2_r10.c: Regenerated.
* generated/minloc1_16_i16.c: Regenerated.
* generated/maxloc1_8_r4.c: Regenerated.
* generated/minloc1_16_i1.c: Regenerated.
* generated/maxloc1_16_i1.c: Regenerated.
* generated/minval_r10.c: Regenerated.
* generated/count_16_l.c: Regenerated.
* generated/parity_l8.c: Regenerated.
* generated/minloc1_8_i1.c: Regenerated.
* generated/minval_i4.c: Regenerated.
* generated/maxloc1_4_i4.c: Regenerated.
* generated/maxloc1_8_i2.c: Regenerated.
* generated/maxval_i8.c: Regenerated.
* generated/any_l8.c: Regenerated.
* generated/minloc1_4_r10.c: Regenerated.
* generated/minloc1_8_i16.c: Regenerated.
* generated/maxloc1_4_r10.c: Regenerated.
* generated/maxloc1_8_i16.c: Regenerated.
* generated/minloc1_16_r4.c: Regenerated.
* generated/maxloc1_16_r4.c: Regenerated.
* generated/product_i8.c: Regenerated.
* generated/sum_i16.c: Regenerated.
* generated/count_2_l.c: Regenerated.
* generated/maxloc1_16_i16.c: Regenerated.
* generated/minloc1_8_r4.c: Regenerated.
* generated/sum_c8.c: Regenerated.
* generated/minloc1_16_i2.c: Regenerated.
* generated/maxloc1_16_i2.c: Regenerated.
* generated/parity_l1.c: Regenerated.
* generated/maxval_i16.c: Regenerated.
* generated/maxval_i1.c: Regenerated.
* generated/minloc1_4_i4.c: Regenerated.
* generated/any_l1.c: Regenerated.
* generated/minloc1_8_i2.c: Regenerated.
* generated/product_c16.c: Regenerated.
* generated/product_r10.c: Regenerated.
* generated/product_i1.c: Regenerated.
* generated/all_l8.c: Regenerated.
* generated/maxval_r4.c: Regenerated.
From-SVN: r163595
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r-- | gcc/fortran/check.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 36efffa..0ff6b6e 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -2432,6 +2432,21 @@ gfc_check_new_line (gfc_expr *a) gfc_try +gfc_check_norm2 (gfc_expr *array, gfc_expr *dim) +{ + if (type_check (array, 0, BT_REAL) == FAILURE) + return FAILURE; + + if (array_check (array, 0) == FAILURE) + return FAILURE; + + if (dim_rank_check (dim, array, false) == FAILURE) + return FAILURE; + + return SUCCESS; +} + +gfc_try gfc_check_null (gfc_expr *mold) { symbol_attribute attr; @@ -2540,6 +2555,22 @@ gfc_check_pack (gfc_expr *array, gfc_expr *mask, gfc_expr *vector) gfc_try +gfc_check_parity (gfc_expr *mask, gfc_expr *dim) +{ + if (type_check (mask, 0, BT_LOGICAL) == FAILURE) + return FAILURE; + + if (array_check (mask, 0) == FAILURE) + return FAILURE; + + if (dim_rank_check (dim, mask, false) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + +gfc_try gfc_check_precision (gfc_expr *x) { if (real_or_complex_check (x, 0) == FAILURE) |