aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/arith.c
AgeCommit message (Collapse)AuthorFilesLines
2005-06-01intrinsic.c (add_conv): No longer take a "simplify" argument as its always ↵Roger Sayle1-0/+23
gfc_convert_constant... * intrinsic.c (add_conv): No longer take a "simplify" argument as its always gfc_convert_constant, instead take a "standard" argument. (add_conversions): Change all existing calls of add_conv to pass GFC_STD_F77 as appropriate. Additionally, if we're allowing GNU extensions support integer-logical and logical-integer conversions. (gfc_convert_type_warn): Warn about use the use of these conversions as a extension when appropriate, i.e. with -pedantic. * simplify.c (gfc_convert_constant): Add support for integer to logical and logical to integer conversions, using gfc_int2log and gfc_log2int. * arith.c (gfc_log2int, gfc_int2log): New functions. * arith.h (gfc_log2int, gfc_int2log): Prototype here. * gfortran.texi: Document this new GNU extension. * gfortran.dg/logint-1.f: New test case. * gfortran.dg/logint-2.f: Likewise. * gfortran.dg/logint-3.f: Likewise. From-SVN: r100461
2005-05-28arith.c (gfc_arith_init_1): Fix off by one problem;Steven G. Kargl1-3/+36
* arith.c (gfc_arith_init_1): Fix off by one problem; (gfc_check_integer_range): Chop extra bits in subnormal numbers. From-SVN: r100299
2005-04-14gfortran.h (gfc_real_info): Add subnormal struct member.Steven G. Kargl1-1/+9
* gfortran.h (gfc_real_info): Add subnormal struct member. * arith.c (gfc_arith_init_1): Set it. (gfc_check_real_range): Use it. * simplify.c (gfc_simplify_nearest): Fix nearest(0.,1.). From-SVN: r98141
2005-03-26Fix illogical logic.Steven G. Kargl1-11/+17
From-SVN: r97082
2005-03-19gfortran.h (arith): Remove ARITH_0TO0.Tobias Schlüter1-21/+8
* gfortran.h (arith): Remove ARITH_0TO0. * arith.c (gfc_arith_error): Remove handling of ARITH_0TO0. (gfc_arith_power): Remove special casing of zero to integral power zero. From-SVN: r96737
2005-02-27arith.c (gfc_check_real_range): Remove multiple returnsSteven G. Kargl1-124/+35
* arith.c (gfc_check_real_range): Remove multiple returns (check_result): New function. (gfc_arith_uminus,gfc_arith_plus,gfc_arith_times, gfc_arith_divide,gfc_arith_power,gfc_arith_minus): Use it. From-SVN: r95624
2005-02-23gfortran.h (gfc_expr): Move 'operator'...Tobias Schlüter1-6/+6
* gfortran.h (gfc_expr): Move 'operator', 'op1', 'op2', and 'uop' fields into new struct 'op' inside the 'value' union. * arith.c (eval_intrinsic): Adapt all users. * dependency.c (gfc_check_dependency): Likewise. * dump-parse-tree.c (gfc_show_expr): Likewise. * expr.c (gfc_get_expr): Don't clear removed fields. (free_expr0, gfc_copy_expr, gfc_type_convert_binary, gfc_is_constant_expr, simplify_intrinsic_op, check_init_expr, check_intrinsic_op): Adapt to new field names. * interface.c (gfc_extend_expr): Likewise. Also explicitly nullify 'esym' and 'isym' fields of new function call. * iresolve.c (gfc_resolve_dot_product, gfc_resolve_matmul): Adapt to renamed structure fields. * matchexp.c (build_node, match_level_1, match_expr): Likewise. * module.c (mio_expr): Likewise. * resolve.c (resolve_operator): Likewise. (gfc_find_forall_index): Likewise. Only look through operands if dealing with EXPR_OP * trans-array.c (gfc_walk_op_expr): Adapt to renamed fields. * trans-expr.c (gfc_conv_unary_op, gfc_conv_power_op, gfc_conv_concat_op, gfc_conv_expr_op): Likewise. From-SVN: r95471
2005-01-23re PR fortran/17941 (gfortran: parser chokes on complex literal constant)Paul Brook1-7/+1
2004-01-23 Paul Brook <paul@codesourcery.com> Steven G. Kargl <kargls@comcast.net> PR fortran/17941 * arith.c (gfc_convert_real): Remove sign handling. * primary.c (match_digits): Allow whitespace after initial sign. (match_real_const): Handle signs here. Allow whitespace after initial sign. Remove dead code. (match_const_complex_part): Remove. (match_complex_part): Use match_{real,integer}_const. (match_complex_constant): Cross-promote integer types. testsuite/ * gfortran.dg/real_const_1.f: New test. * gfortran.dg/real_const_2.f90: New test. * gfortran.dg/complex_int_1.f90: New test. From-SVN: r94127
2005-01-18arith.c, [...]: Update copyright.Kazu Hirata1-1/+1
* arith.c, array.c, check.c, decl.c, expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c, io.c, iresolve.c, match.c, matchexp.c, misc.c, module.c, options.c, parse.c, scanner.c, simplify.c, symbol.c, trans-array.c, trans-expr.c, trans-io.c, trans-stmt.c, trans.c: Update copyright. From-SVN: r93830
2005-01-08arith.c (arctangent2, [...]): Fix whitespace issues.Tobias Schlüter1-19/+19
* arith.c (arctangent2, gfc_arith_init_1, gfc_arith_done_1, gfc_constant_result, gfc_range_check, gfc_arith_power, eval_type_intrinsic0, eval_intrinsic_f2, gfc_real2real, gfc_real2complex, gfc_complex2int, gfc_complex2real, gfc_complex2complex): Fix whitespace issues. check.c (must_be, type_check, numeric_check, int_or_real_check, logical_array_check, array_check, scalar_check, nonoptional_check, variable_check, dim_check, check_a_kind, gfc_check_a_ikind, gfc_check_a_xkind, gfc_check_abs, gfc_check_all_any, gfc_check_allocated, gfc_check_a_p, gfc_check_besn, gfc_check_btest, gfc_check_char, gfc_check_cmplx, gfc_check_count, gfc_check_cshift, gfc_check_dcmplx, gfc_check_dble, gfc_check_digits, gfc_check_dot_product, gfc_check_eoshift, gfc_check_fnum, gfc_check_g77_math1, gfc_check_huge, gfc_check_i, gfc_check_iand, gfc_check_ibclr, gfc_check_ibits, gfc_check_ibset, gfc_check_idnint, gfc_check_ieor, gfc_check_index, gfc_check_int, gfc_check_ior, gfc_check_ishft, gfc_check_ishftc, gfc_check_kind, gfc_check_lbound, gfc_check_logical, min_max_args, gfc_check_min_max_integer, gfc_check_min_max_real, gfc_check_min_max_double, gfc_check_matmul, gfc_check_minval_maxval, gfc_check_merge, gfc_check_nearest, gfc_check_pack, gfc_check_precision, gfc_check_radix, gfc_check_range, gfc_check_real, gfc_check_repeat, gfc_check_scale, gfc_check_scan, gfc_check_selected_real_kind, gfc_check_set_exponent): Fix formatting issues. (gfc_check_size, gfc_check_sign): Alphabetize function order, remove whitespace-only line. (gfc_check_fstat, gfc_check_fstat_sub, gfc_check_stat, gfc_check_stat_sub, gfc_check_transfer, gfc_check_transpose, gfc_check_ubound, gfc_check_unpack, gfc_check_verify, gfc_check_x, gfc_check_cpu_time, gfc_check_date_and_time, gfc_check_mvbits, gfc_check_random_number, gfc_check_random_seed, gfc_check_second_sub, gfc_check_system_clock, gfc_check_getcwd_sub, gfc_check_exit, gfc_check_flush, gfc_check_umask, gfc_check_umask_sub, gfc_check_unlink, gfc_check_unlink_sub): Fix formatting issues. From-SVN: r93093
2004-11-08arith.c, [...]: Fix comment formatting.Kazu Hirata1-1/+1
* arith.c, array.c, decl.c, expr.c, f95-lang.c, gfortran.h, gfortranspec.c, interface.c, intrinsic.c, iresolve.c, match.c, module.c, parse.c, parse.h, primary.c, resolve.c, scanner.c, trans-array.c, trans-array.h, trans-expr.c, trans-intrinsic.c, trans-io.c, trans-stmt.c, trans.h: Fix comment formatting. From-SVN: r90266
2004-10-28Added pedantic_min_int to gfc_integer_info Added ARITH_ASYMMETRIC to arith...Scott Robert Ladd1-9/+72
Added pedantic_min_int to gfc_integer_info Added ARITH_ASYMMETRIC to arith Added support for an "asymmetric integer" warning when compiling with pedantic Set minimum integer values to reflect realities of two's complement signed integers From-SVN: r89785
2004-10-08* arith.c: Fix formatting issues.Tobias Schlüter1-9/+3
From-SVN: r88779
2004-08-27gfortran.h (gfc_default_*_kind): Remove prototypes, add extern variable ↵Tobias Schlüter1-14/+14
declaration of same name. * gfortran.h (gfc_default_*_kind): Remove prototypes, add extern variable declaration of same name. * arith.c, check.c, decl.c, dump_parse_tree.c, expr.c, intrinsic.c, io.c, iresolve.c, match.c, options.c, primary.c, resolve.c, simplify.c, symbol.c, trans-const.c, trans-io.c: Replace all calls to gfc_default_*_kind with variable accesses. * trans-types.c: Same as above. (gfc_default_*_kind_1): Rename to gfc_default_*_kind, remove static qualifier. Replace all occurences. (gfc_default_*_kind): Remove functions. From-SVN: r86662
2004-08-26arith.c: Include system.h, not real system headers.Richard Henderson1-251/+10
* arith.c: Include system.h, not real system headers. (MPZ_NULL, MPF_NULL, DEF_GFC_INTEGER_KIND, DEF_GFC_LOGICAL_KIND, DEF_GFC_REAL_KIND, GFC_SP_KIND, GFC_SP_PREC, GFC_SP_EMIN, GFC_SP_EMAX, GFC_DP_KIND, GFC_DP_PREC, GFC_DP_EMIN, GFC_DP_EMAX, GFC_QP_KIND, GFC_QP_PREC, GFC_QP_EMIN, GFC_QP_EMAX): Remove. (gfc_integer_kinds, gfc_logical_kinds, gfc_real_kinds, gfc_index_integer_kind, gfc_default_integer_kind, gfc_default_real_kind,gfc_default_double_kind, gfc_default_character_kind, gfc_default_logical_kind, gfc_default_complex_kind, validate_integer, validate_real, validate_logical, validate_character, gfc_validate_kind): Move to trans-types.c. (gfc_set_model_kind): Use gfc_validate_kind. (gfc_set_model): Just copy the current precision to default. (gfc_arith_init_1): Use mpfr precision 128 for integer setup. * f95-lang.c (gfc_init_decl_processing): Invoke gfc_init_kinds. * gfortran.h: Update file commentary. * trans-types.c (MAX_INT_KINDS, MAX_REAL_KINDS): New. (gfc_default_integer_kind_1, gfc_default_real_kind_1, gfc_default_double_kind_1, gfc_default_character_kind_1, gfc_default_logical_kind_1, gfc_default_complex_kind_1): New. (gfc_init_kinds): New. (gfc_init_types): Don't set gfc_index_integer_kind here. * trans-types.h (gfc_init_kinds): Declare. * doc/invoke.texi: Clarify DOUBLE PRECISION behaviour wrt -r8. From-SVN: r86637
2004-08-25arith.c (gfc_validate_kind): Add may_fail argument; abort if false and we ↵Richard Henderson1-8/+6
don't validate the kind. * arith.c (gfc_validate_kind): Add may_fail argument; abort if false and we don't validate the kind. (gfc_check_integer_range, gfc_check_real_range): Update to match. * check.c (kind_check): Likewise. * decl.c (gfc_match_old_kind_spec, gfc_match_kind_spec): Likewise. (match_char_spec, match_logical_spec): Likewise. * gfortran.h (gfc_validate_kind): Likewise. * options.c (gfc_handle_option): Likewise. * primary.c (match_integer_constant, match_real_constant, match_string_constant, match_logical_constant, match_const_complex_part): Likewise. * simplify.c (get_kind, gfc_simplify_bit_size, gfc_simplify_digits, gfc_simplify_epsilon, gfc_simplify_huge, gfc_simplify_ibclr, gfc_simplify_ibset, gfc_simplify_ishft, gfc_simplify_ishftc, gfc_simplify_maxexponent, gfc_simplify_minexponent, gfc_simplify_nearest, gfc_simplify_not, gfc_simplify_precision, gfc_simplify_radix, gfc_simplify_range, gfc_simplify_rrspacing, gfc_simplify_scale, gfc_simplify_spacing, gfc_simplify_tan, gfc_simplify_tiny): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_aint, gfc_conv_intrinsic_mod, gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_minmaxval, prepare_arg_info): Likewise. From-SVN: r86608
2004-08-25re PR fortran/17190 (MPFR semantics for mpfr_get_z_exp changed)Paul Brook1-3/+6
PR fortran/17190 * arith.c (gfc_mpfr_to_mpz): Workaround mpfr bug. From-SVN: r86581
2004-08-06arith.c: Add #define for model numbers.Steven G. Kargl1-744/+320
2004-08-06 Steven G. Kargl <kargls@comcast.net> * arith.c: Add #define for model numbers. Remove global GMP variables. (natural_logarithm,common_logarithm,exponential,sine, cosine,arctangent,hypercos,hypersine ): Remove. (gfc_mpfr_to_mpz,gfc_set_model_kind,gfc_set_model): New functions. (arctangent2,gfc_arith_init_1,gfc_arith_done_1 gfc_check_real_range, gfc_constant_result, gfc_range_check, gfc_arith_uminus,gfc_arith_plus, gfc_arith_minus, gfc_arith_times, gfc_arith_divide,complex_reciprocal,complex_pow_ui, gfc_arith_power,gfc_compare_expr,compare_complex,gfc_convert_real, gfc_convert_complex,gfc_int2real,gfc_int2complex, gfc_real2int,gfc_real2real,gfc_real2complex, gfc_complex2int,gfc_complex2real,gfc_complex2complex): Convert GMP to MPFR, use new functions. * arith.h: Remove extern global variables. (natural_logarithm,common_logarithm,exponential, sine, cosine, arctangent,hypercos,hypersine): Remove prototypes. (arctangent2): Update prototype from GMP to MPFR. (gfc_mpfr_to_mpz, gfc_set_model_kind,gfc_set_model): Add prototypes. * dump-parse-tree.c (gfc_show_expr): Convert GMP to MPFR. * expr.c (free_expr0,gfc_copy_expr): Convert GMP to MPFR. * gfortran.h (GFC_REAL_BITS): Remove. (arith): Add ARITH_NAN. Include mpfr.h. Define GFC_RND_MODE. Rename GCC_GFORTRAN_H GFC_GFC_H. (gfc_expr): Convert GMP to MPFR. * module.c: Add arith.h, correct type in comment. (mio_gmp_real): Convert GMP to MPFR. (mio_expr): Use gfc_set_model_kind(). * primary.c: Update copyright date with 2004. (match_real_constant,match_const_complex_part): Convert GMP to MPFR. * simplify.c: Remove global GMP variables (gfc_simplify_abs,gfc_simplify_acos,gfc_simplify_aimag, gfc_simplify_aint,gfc_simplify_dint,gfc_simplify_anint, gfc_simplify_dnint,gfc_simplify_asin,gfc_simplify_atan, gfc_simplify_atan2,gfc_simplify_ceiling,simplify_cmplx, gfc_simplify_conjg,gfc_simplify_cos,gfc_simplify_cosh, gfc_simplify_dim,gfc_simplify_dprod,gfc_simplify_epsilon, gfc_simplify_exp,gfc_simplify_exponent,gfc_simplify_floor, gfc_simplify_fraction,gfc_simplify_huge,gfc_simplify_int, gfc_simplify_ifix,gfc_simplify_idint,gfc_simplify_log, gfc_simplify_log10,simplify_min_max,gfc_simplify_mod, gfc_simplify_modulo,gfc_simplify_nearest,simplify_nint, gfc_simplify_rrspacing,gfc_simplify_scale, gfc_simplify_set_exponent,gfc_simplify_sign,gfc_simplify_sin, gfc_simplify_sinh,gfc_simplify_spacing,gfc_simplify_sqrt, gfc_simplify_tan,gfc_simplify_tanh,gfc_simplify_tiny, gfc_simplify_init_1,gfc_simplify_done_1): Convert GMP to MPFR. Use new functions. * trans-const.c (gfc_conv_mpfr_to_tree): Rename from gfc_conv_mpf_to_tree. Convert it to use MPFR (gfc_conv_constant_to_tree): Use it. * trans-const.h: Update prototype for gfc_conv_mpfr_to_tree(). * trans-intrinsic.c: Add arith.h, remove gmp.h (gfc_conv_intrinsic_aint,gfc_conv_intrinsic_mod): Convert GMP to MPFR. From-SVN: r85652
2004-06-20arith.c (gfc_range_check): correct complex underflow.Steven G. Kargl1-2/+2
2004-06-20 Steven G. Kargl <kargls@comcast.net> * arith.c (gfc_range_check): correct complex underflow. From-SVN: r83417
2004-05-22invoke.texi: Document -Wunderflow and spell check.Steven G. Kargl1-18/+115
* invoke.texi: Document -Wunderflow and spell check. * lang.opt: Add Wunderflow. * gfortran.h (gfc_option_t): Add warn_underflow option. * options.c (gfc_init_options, set_Wall): Use it. * primary.c (match_real_constant): Explicitly handle UNDERFLOW. * arith.c (gfc_arith_uminus, gfc_arith_plus, gfc_arith_minus, gfc_arith_times, gfc_arith_divide, gfc_arith_power, gfc_real2real, gfc_real2complex, gfc_complex2real, gfc_complex2complex): Ditto. * arith.c (common_logarithm): Fix typo in comment. From-SVN: r82130
2004-05-18arith.c (gfc_int2complex): Fix incorrect range checking.Steve Kargl1-1/+1
2004-05-17 Steve Kargl <kargls@comcast.net> * arith.c (gfc_int2complex): Fix incorrect range checking. From-SVN: r81985
2004-05-18arith.c (gfc_arith_power): Complex number raised to 0 power is 1.Steve Kargl1-1/+1
2004-05-17 Steve Kargl <kargls@comcast.net> * arith.c (gfc_arith_power): Complex number raised to 0 power is 1. From-SVN: r81959
2004-05-18arith.c (gfc_real2complex): Range checking wrong part of complex number.Steve Kargl1-1/+1
2004-05-17 Steve Kargl <kargls@comcast.net> * arith.c (gfc_real2complex): Range checking wrong part of complex number. From-SVN: r81957
2004-05-16* arith.c (gfc_range_check): Fix logic error.Paul Brook1-1/+1
From-SVN: r81918
2004-05-16* arith.c: Fix comment typos.Steve Kargl1-4/+4
From-SVN: r81912
2004-05-14Make-lang.in, [...]: Update copyright years and boilerplate.Tobias Schlüter1-13/+14
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c, decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c, expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c, intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h, matchexp.c, misc.c, module.c, options.c, parse.c, parse.h, primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c, trans-array.c, trans-array.h, trans-common.c, trans-const.c, trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c, trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c, trans-types.h, trans.c, trans.h: Update copyright years and boilerplate. * data.c: Likewise, also removed two whitespace-only lines. * gfortranspec.c, lang.opt: Update copyright years. From-SVN: r81839
2004-05-13Merge tree-ssa-20020619-branch into mainline.Diego Novillo1-0/+2763
From-SVN: r81764