aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
AgeCommit message (Collapse)AuthorFilesLines
2017-10-10re PR libfortran/82233 (execute_command_line causes program to stop when ↵Thomas Koenig2-8/+8
command fails (or does not exist)) 2017-10-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/82233 * intrinsics/execute_command_line.c (execute_command_line): No call to runtime_error if cmdstat is present. 2017-10-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/82233 * gfortran.dg/execute_command_line_3.f90: New test. From-SVN: r253593
2017-09-24+2017-09-24 Dominique d'Humieres <dominiq@lps.ens.fr>Dominique d'Humieres2-3/+7
PR libgfortran/79612 * runtime/bounds.c: Use GFC_ASSERT. From-SVN: r253124
2017-09-10re PR fortran/34640 (ICE when assigning item of a derived-component to a ↵Paul Thomas3-1/+8
pointer) 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 PR fortran/40737 PR fortran/55763 PR fortran/57019 PR fortran/57116 * expr.c (is_subref_array): Add class pointer array dummies to the list of expressions that return true. * trans-array.c: Add SPAN_FIELD and update indices for subsequent fields. (gfc_conv_descriptor_span, gfc_conv_descriptor_span_get, gfc_conv_descriptor_span_set, is_pointer_array, get_array_span): New functions. (gfc_get_descriptor_offsets_for_info): New function to preserve API for access to descriptor fields for trans-types.c. (gfc_conv_scalarized_array_ref): If the expression is a subref array, make sure that info->descriptor is a descriptor type. Otherwise, if info->descriptor is a pointer array, set 'decl' and fix it if it is a component reference. (build_array_ref): Simplify handling of class array refs by passing the vptr to gfc_build_array_ref rather than generating the pointer arithmetic in this function. (gfc_conv_array_ref): As in gfc_conv_scalarized_array_ref, set 'decl'. (gfc_array_allocate): Set the span field if this is a pointer array. Use the expr3 element size if it is available, so that the dynamic type element size is used. (gfc_conv_expr_descriptor): Set the span field for pointer assignments. * trans-array.h: Prototypes for gfc_conv_descriptor_span_get gfc_conv_descriptor_span_set and gfc_get_descriptor_offsets_for_info added. trans-decl.c (gfc_get_symbol_decl): If a non-class pointer array, mark the declaration as a GFC_DECL_PTR_ARRAY_P. Remove the setting of GFC_DECL_SPAN. (gfc_trans_deferred_vars): Set the span field to zero in thge originating scope. * trans-expr.c (gfc_conv_procedure_call): Do not use copy-in/ copy-out to pass subref expressions to a pointer dummy. (gfc_trans_pointer_assignment): Remove code for setting of GFC_DECL_SPAN. Set the 'span' field for non-class pointers to class function results. Likewise for rank remap. In the case that the target is not a whole array, use the target array ref for remap and, since the 'start' indices are missing, set the lbounds to one, as required by the standard. * trans-intrinsic.c (conv_expr_ref_to_caf_ref): Pick up the 'token' offset from the field decl in the descriptor. (conv_isocbinding_subroutine): Set the 'span' field. * trans-io.c (gfc_trans_transfer): Always scalarize pointer array io. * trans-stmt.c (trans_associate_var): Set the 'span' field. * trans-types.c (gfc_get_array_descriptor_base): Add the 'span' field to the array descriptor. (gfc_get_derived_type): Pointer array components are marked as GFC_DECL_PTR_ARRAY_P. (gfc_get_array_descr_info): Replaced API breaking code for descriptor offset calling gfc_get_descriptor_offsets_for_info. * trans.c (get_array_span): New function. (gfc_build_array_ref): Simplify by calling get_array_span and obtain 'span' if 'decl' or 'vptr' present. * trans.h : Rename DECL_LANG_FLAG_6, GFC_DECL_SUBREF_ARRAY_P, as GFC_DECL_PTR_ARRAY_P. 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 * gfortran.dg/associate_24.f90: New test. * gfortran.dg/assumed_type_2.f90: Adjust some of the tree dump checks. * gfortran.dg/no_arg_check_2.f90: Likewise. * gfortran.dg/pointer_array_1.f90: New test. * gfortran.dg/pointer_array_2.f90: New test. * gfortran.dg/pointer_array_7.f90: New test. * gfortran.dg/pointer_array_8.f90: New test. * gfortran.dg/pointer_array_component_1.f90: New test. * gfortran.dg/pointer_array_component_2.f90: New test. * gfortran.dg/goacc/kernels-alias-4.f95: Bump up both tree scan counts by 1. PR fortran/40737 * gfortran.dg/pointer_array_3.f90: New test. PR fortran/57116 * gfortran.dg/pointer_array_4.f90: New test. PR fortran/55763 * gfortran.dg/pointer_array_5.f90: New test. PR fortran/57019 * gfortran.dg/pointer_array_6.f90: New test. 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 * libgfortran/libgfortran.h: Add span field to descriptor. * libgfortran/libtool-version : Bump up version number to 5:0:0. From-SVN: r251949
2017-08-28re PR fortran/78387 (OpenMP segfault/stack size exceeded writing to internal ↵Jerry DeLisle5-95/+18
file) 2017-08-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/78387 * io/list_read.c (nml_read_obj): Remove use of stash. * io/transfer.c (st_read_done, st_write_done): Likewise. * io/unit.c (stash_internal_unit): Delete function. (get_unit): Remove use of stash. (init_units): Likewise. (close_units): Likewise. * io/write.c (nml_write_obj): Likewise: From-SVN: r251374
2017-07-31re PR fortran/81581 (runtime checks for DIM argument of intrinsic SUM missing)Thomas Koenig124-350/+3052
2017-07-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/81581 * m4/ifuntion.m4 (name`'rtype_qual`_'atype_code): Perform check for dim. (`m'name`'rtype_qual`_'atype_code): Likewise. Change type of rank and tim to index_type. (`s'name`'rtype_qual`_'atype_code): Perform check for dim. * generated/iall_i16.c: Regenerated. * generated/iall_i1.c: Regenerated. * generated/iall_i2.c: Regenerated. * generated/iall_i4.c: Regenerated. * generated/iall_i8.c: Regenerated. * generated/iany_i16.c: Regenerated. * generated/iany_i1.c: Regenerated. * generated/iany_i2.c: Regenerated. * generated/iany_i4.c: Regenerated. * generated/iany_i8.c: Regenerated. * generated/iparity_i16.c: Regenerated. * generated/iparity_i1.c: Regenerated. * generated/iparity_i2.c: Regenerated. * generated/iparity_i4.c: Regenerated. * generated/iparity_i8.c: Regenerated. * generated/maxloc1_16_i16.c: Regenerated. * generated/maxloc1_16_i1.c: Regenerated. * generated/maxloc1_16_i2.c: Regenerated. * generated/maxloc1_16_i4.c: Regenerated. * generated/maxloc1_16_i8.c: Regenerated. * generated/maxloc1_16_r10.c: Regenerated. * generated/maxloc1_16_r16.c: Regenerated. * generated/maxloc1_16_r4.c: Regenerated. * generated/maxloc1_16_r8.c: Regenerated. * generated/maxloc1_4_i16.c: Regenerated. * generated/maxloc1_4_i1.c: Regenerated. * generated/maxloc1_4_i2.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r10.c: Regenerated. * generated/maxloc1_4_r16.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_8_i16.c: Regenerated. * generated/maxloc1_8_i1.c: Regenerated. * generated/maxloc1_8_i2.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r10.c: Regenerated. * generated/maxloc1_8_r16.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxval_i16.c: Regenerated. * generated/maxval_i1.c: Regenerated. * generated/maxval_i2.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r10.c: Regenerated. * generated/maxval_r16.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc1_16_i16.c: Regenerated. * generated/minloc1_16_i1.c: Regenerated. * generated/minloc1_16_i2.c: Regenerated. * generated/minloc1_16_i4.c: Regenerated. * generated/minloc1_16_i8.c: Regenerated. * generated/minloc1_16_r10.c: Regenerated. * generated/minloc1_16_r16.c: Regenerated. * generated/minloc1_16_r4.c: Regenerated. * generated/minloc1_16_r8.c: Regenerated. * generated/minloc1_4_i16.c: Regenerated. * generated/minloc1_4_i1.c: Regenerated. * generated/minloc1_4_i2.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r10.c: Regenerated. * generated/minloc1_4_r16.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_8_i16.c: Regenerated. * generated/minloc1_8_i1.c: Regenerated. * generated/minloc1_8_i2.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r10.c: Regenerated. * generated/minloc1_8_r16.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minval_i16.c: Regenerated. * generated/minval_i1.c: Regenerated. * generated/minval_i2.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r10.c: Regenerated. * generated/minval_r16.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/norm2_r10.c: Regenerated. * generated/norm2_r16.c: Regenerated. * generated/norm2_r4.c: Regenerated. * generated/norm2_r8.c: Regenerated. * generated/parity_l16.c: Regenerated. * generated/parity_l1.c: Regenerated. * generated/parity_l2.c: Regenerated. * generated/parity_l4.c: Regenerated. * generated/parity_l8.c: Regenerated. * generated/product_c10.c: Regenerated. * generated/product_c16.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i16.c: Regenerated. * generated/product_i1.c: Regenerated. * generated/product_i2.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r10.c: Regenerated. * generated/product_r16.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c10.c: Regenerated. * generated/sum_c16.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i16.c: Regenerated. * generated/sum_i1.c: Regenerated. * generated/sum_i2.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r10.c: Regenerated. * generated/sum_r16.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. 2017-07-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/81581 * gfortran.dg/dim_sum_1.f90: New test case. * gfortran.dg/dim_sum_2.f90: New test case. * gfortran.dg/dim_sum_3.f90: New test case. From-SVN: r250735
2017-07-24ChangeLog: Fix typo in date and ommitted PR number.Thomas Koenig1-1/+2
2017-07-24 Thomas Koenig <tkoenig@gcc.gnu.org> * ChangeLog: Fix typo in date and ommitted PR number. From-SVN: r250474
2017-07-24unix.c (buf_write): Return early if there is nothing to write.Thomas Koenig2-0/+8
2017-07-24 Thomas Koenig <tkoenig@gcc.gnu.org> * io/unix.c (buf_write): Return early if there is nothing to write. From-SVN: r250473
2017-07-09eoshift2.c (eoshift2): Use memcpy for innermost copy where possible.Thomas Koenig10-54/+170
2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org> * intrinsics/eoshift2.c (eoshift2): Use memcpy for innermost copy where possible. * m4/eoshift1.m4 (eoshift1): Likewise. * m4/eoshift3.m4 (eoshift3): Likewise. * generated/eoshift1_16.c: Regenerated. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_16.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. 2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/eoshift_4.f90: New test. * gfortran.dg/eoshift_5.f90: New test. * gfortran.dg/eoshift_6.f90: New test. From-SVN: r250085
2017-07-02eoshift0.c: For contiguous arrays, use block algorithm.Thomas Koenig2-36/+113
2017-07-02 Thomas Koenig <tkoenig@gcc.gnu.org> * intrinsics/eoshift0.c: For contiguous arrays, use block algorithm. Use memcpy where possible. 2017-07-02 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran/eoshift_3.f90: New test. From-SVN: r249882
2017-06-26Fix for SPEC CPU2017 621.wrf_s failure, add missing locking code.Jim Wilson2-0/+12
libgfortran/ PR libfortran/81195 * io/unit.c (get_unit): Call __gthread_mutex_lock before newunit_stack and newunit_tos references. Call __gthread_mutex_unlock afterward. From-SVN: r249667
2017-06-24re PR fortran/52473 (CSHIFT slow - inline it?)Thomas Koenig48-69/+9026
2017-06-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/52473 * Makefile.am: Add i_cshift1a_c. Add rules to generate files from cshift1a.m4. * Makefile.in: Regenerated. * m4/cshift1a.m4: New file. * m4/cshift.m4 (cshift1): Split up inner loop by removing condition. Use memcpy where possible. Call helper functions based on dtype. * libgfortran.h: Add prototypes for cshift1_16_c10, cshift1_16_c16, cshift1_16_c4, cshift1_16_c8, cshift1_16_i1, cshift1_16_i16, cshift1_16_i2, cshift1_16_i4, cshift1_16_i8, cshift1_16_r10, cshift1_16_r16, cshift1_16_r4, cshift1_16_r8, cshift1_4_c10, cshift1_4_c16, cshift1_4_c4, cshift1_4_c8, cshift1_4_i1, cshift1_4_i16, cshift1_4_i2, cshift1_4_i4, cshift1_4_i8, cshift1_4_r10, cshift1_4_r16, cshift1_4_r4, cshift1_4_r8, cshift1_8_c10, cshift1_8_c16, cshift1_8_c4, cshift1_8_c8, cshift1_8_i1, cshift1_8_i16, cshift1_8_i2, cshift1_8_i4, cshift1_8_i8, cshift1_8_r10, cshift1_8_r16, cshift1_8_r4 and cshift1_8_r8. * generated/cshift1_16_c10.c: New file, generated from cshift1a.m4. * generated/cshift1_16_c16.c: New file, generated from cshift1a.m4. * generated/cshift1_16_c4.c: New file, generated from cshift1a.m4. * generated/cshift1_16_c8.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i1.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i16.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i2.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i4.c: New file, generated from cshift1a.m4. * generated/cshift1_16_i8.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r10.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r16.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r4.c: New file, generated from cshift1a.m4. * generated/cshift1_16_r8.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c10.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c16.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c4.c: New file, generated from cshift1a.m4. * generated/cshift1_4_c8.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i1.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i16.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i2.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i4.c: New file, generated from cshift1a.m4. * generated/cshift1_4_i8.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r10.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r16.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r4.c: New file, generated from cshift1a.m4. * generated/cshift1_4_r8.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c10.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c16.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c4.c: New file, generated from cshift1a.m4. * generated/cshift1_8_c8.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i1.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i16.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i2.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i4.c: New file, generated from cshift1a.m4. * generated/cshift1_8_i8.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r10.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r16.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r4.c: New file, generated from cshift1a.m4. * generated/cshift1_8_r8.c: New file, generated from cshift1a.m4. 2017-06-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/52473 * gfortran.dg/cshift_2.f90: New test. From-SVN: r249620
2017-06-18re PR fortran/52473 (CSHIFT slow - inline it?)Thomas Koenig15-336/+1321
2017-06-18 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/52473 * m4/cshift0.m4: For arrays that are contiguous up to shift, implement blocked algorighm for cshift. * generated/cshift0_c10.c: Regenerated. * generated/cshift0_c16.c: Regenerated. * generated/cshift0_c4.c: Regenerated. * generated/cshift0_c8.c: Regenerated. * generated/cshift0_i1.c: Regenerated. * generated/cshift0_i16.c: Regenerated. * generated/cshift0_i2.c: Regenerated. * generated/cshift0_i4.c: Regenerated. * generated/cshift0_i8.c: Regenerated. * generated/cshift0_r10.c: Regenerated. * generated/cshift0_r16.c: Regenerated. * generated/cshift0_r4.c: Regenerated. * generated/cshift0_r8.c: Regenerated. 2017-06-18 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/52473 * gfortran.dg/cshift_1.f90: New test. From-SVN: r249350
2017-06-06re PR fortran/80975 (matmul for zero-length arrays)Thomas Koenig28-460/+491
2017-06-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80975 * m4/matmul_internal.m4: Move zeroing before early return. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. * generated/matmulavx128_c10.c: Regenerated. * generated/matmulavx128_c16.c: Regenerated. * generated/matmulavx128_c4.c: Regenerated. * generated/matmulavx128_c8.c: Regenerated. * generated/matmulavx128_i1.c: Regenerated. * generated/matmulavx128_i16.c: Regenerated. * generated/matmulavx128_i2.c: Regenerated. * generated/matmulavx128_i4.c: Regenerated. * generated/matmulavx128_i8.c: Regenerated. * generated/matmulavx128_r10.c: Regenerated. * generated/matmulavx128_r16.c: Regenerated. * generated/matmulavx128_r4.c: Regenerated. * generated/matmulavx128_r8.c: Regenerated. 2017-06-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80975 * gfortran.dg/matmul_16.f90: New test. * gfortran.dg/inline_matmul_18.f90: New test. From-SVN: r248932
2017-05-29re PR fortran/53029 (missed optimization in internal read (without ↵Jerry DeLisle2-0/+11
implied-do-loop)) 2017-05-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/53029 * list_read.c (list_formatted_read_scala): Set the err return value to the common.flags error values. * gfortran.dg/read_5.f90: New test. From-SVN: r248577
2017-05-28Fix libgfortran FMA3/FMA4 testsRainer Orth3-12/+31
* acinclude.m4 (LIBGFOR_CHECK_FMA3): Use test from check_effective_target_fma in gcc.target/i386/i386.exp. (LIBGFOR_CHECK_FMA4): Use test from check_effective_target_fma4. * configure: Regenerate. From-SVN: r248547
2017-05-26re PR fortran/80889 (Bootstrap broken on all targets due to rev 248472)Thomas Koenig3-1/+21
2017-05-26 Thomas Koenig <tkoenig@gcc.gnu.org> PR boostrap/80889 * acinclude.m4: Also set HAVE_AVX128 on the false branch of LIBGFOR_CHECK_AVX128. * configure: Regenerated. From-SVN: r248519
2017-05-25re PR libfortran/78379 (Processor-specific versions for matmul)Thomas Koenig35-27/+15964
2017-05-25 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/78379 * Makefile.am: Add generated/matmulavx128_*.c files. Handle them for compiling and setting the right flags. * acinclude.m4: Add tests for FMA3, FMA4 and AVX128. * configure.ac: Call them. * Makefile.in: Regenerated. * config.h.in: Regenerated. * configure: Regenerated. * m4/matmul.m4: Handle AMD chips by calling 128-bit AVX versions which use FMA3 or FMA4. * m4/matmulavx128.m4: New file. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. * generated/matmulavx128_c10.c: New file. * generated/matmulavx128_c16.c: New file. * generated/matmulavx128_c4.c: New file. * generated/matmulavx128_c8.c: New file. * generated/matmulavx128_i1.c: New file. * generated/matmulavx128_i16.c: New file. * generated/matmulavx128_i2.c: New file. * generated/matmulavx128_i4.c: New file. * generated/matmulavx128_i8.c: New file. * generated/matmulavx128_r10.c: New file. * generated/matmulavx128_r16.c: New file. * generated/matmulavx128_r4.c: New file. * generated/matmulavx128_r8.c: New file. From-SVN: r248472
2017-05-19[multiple changes]Jerry DeLisle2-8/+33
2017-05-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/80333 * trans-io.c (nml_get_addr_expr): If we are dealing with class type data set tmp tree to get that address. (transfer_namelist_element): Set the array spec to point to the the class data. 2017-05-19 Paul Thomas <pault@gcc.gnu.org> Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/80333 * list_read.c (nml_read_obj): Compute pointer into class/type arrays from the nl->dim information. Update it for each iteration of the loop for the given object. 2017-05-19 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/80333 * gfortran.dg/dtio_30.f03: New test. From-SVN: r248293
2017-05-17re PR fortran/80741 ([Regression 7/8] DTIO wrong code causes incorrect ↵Jerry DeLisle3-2/+15
behaviour of namelist READ) 2017-05-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/80741 * transfer.c (finalize_transfer): Reset last_char to 'empty'. * file_pos.c (formatted_backspace): Likewise. (st_endfile): Likewise. (st_rewind): Likewise. (st_flush): Likewise. PR fortran/80741 * trans-io.c (transfer_namelist_element): Change check from NULL_TREE to null_pointer_node. From-SVN: r248170
2017-05-15re PR libfortran/80727 (Crash of runtime gfortran library during integer ↵Jerry DeLisle2-10/+24
transformation) 2017-05-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/80727 * transfer.c (read_sf_internal): Remove bogus code to detect EOR. (read_block_form): For internal units, generate EOR if no more bytes left in unit and we are trying to read with ADVANCE='NO'. * gfortran.dg/read_3.f90: New test. From-SVN: r248080
2017-05-15re PR fortran/80765 (178.galgel in SPEC CPU 2000 fails to run)Thomas Koenig15-198/+218
2017-05-15 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80765 * m4/matmul_internal.m4: Set bystride to correct value in vector-matrix multiplicatin for later calculation of buffer size. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. From-SVN: r248074
2017-05-12Typo fixes for "Don't assume __secure_getenv is available"Thomas Schwinge2-2/+9
libgfortran/ * runtime/environ.c (weak_secure_getenv): Fix "__secure_gettime" vs. "__secure_getenv" typo. (secure_getenv): Fix "HAVE__SECURE_GETENV" vs. "HAVE___SECURE_GETENV" typo. From-SVN: r247952
2017-05-11Don't assume __secure_getenv is availableJanne Blomqvist3-3/+19
Glibc 2.17 made __secure_getenv an officially supported function, and renamed it secure_getenv. The libgfortran configure has checked for both of these, per https://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv. Unfortunately, while the dynamical library (libc.so) retains the __secure_getenv symbol for backwards compatibility, the static library (libc.a) does not. This means that a libgfortran.a compiled against an older glibc will not work if one tries to link against a newer libc.a. This creates problems for providing gfortran binary distributions that work on as many target systems as possible. Thus, retain the support for __secure_getenv but call it only via a weak reference. Regtested on x86_64-pc-linux-gnu. 2017-05-11 Janne Blomqvist <jb@gcc.gnu.org> * libgfortran.h: HAVE_SECURE_GETENV: Don't check HAVE___SECURE_GETENV. * environ/runtime.c (secure_getenv): Use __secure_getenv via a weak reference. From-SVN: r247927
2017-05-10re PR target/80687 (VLA usage in libgfortran; nvptx target: "sorry, ↵Thomas Koenig15-264/+218
unimplemented: target cannot support alloca") 2017-05-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80687 PR fortran/80696 * m4/matmul_internal.m4: 'matmul_name`: Always use malloc/free to allocate t1. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. From-SVN: r247839
2017-05-08re PR libfortran/80602 (Reduce stack usage for blocked matmul)Thomas Koenig16-134/+814
2017-05-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80602 * m4/matmul_internal.m4: 'matmul_name`: Change t1 to a VLA of the required size. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. 2017-05-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80602 * gfortran.dg/matmul_15.f90: New test case. From-SVN: r247753
2017-04-11close.c: Fix white space in pointer declarations and comment formats where ↵Jerry DeLisle16-239/+258
applicable. 2017-04-11 Jerry DeLisle <jvdelisle@gcc.gnu.org> * close.c: Fix white space in pointer declarations and comment formats where applicable. * fbuf.c: Likewise. * fbuf.h: Likewise. * format.c: Likewise. * inquire.c: Likewise. * intrinsics.c: Likewise. * list_read.c: Likewise. * lock.c: Likewise. * open.c: Likewise. * read.c: Likewise. * transfer.c: Likewise. * unit.c: Likewise. * unix.c: Likewise. * unix.h: Likewise. * write.c: Likewise. From-SVN: r246842
2017-03-29re PR fortran/78670 ([F03] Incorrect file position with namelist read under ↵Jerry DeLisle2-53/+65
DTIO) 2017-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/78670 * io/list_read.c (nml_get_obj_data): Delete code which calls the child read procedure. (nml_read_obj): Insert the code which calls the child procedure. Don't need to touch nodes if using dtio since parent will not be traversing the components. PR libgfortran/78670 * gfortran.dg/dtio_25.f90: Use 'a1' format when trying to read a character of length 1. Update test for success. * gfortran.dg/dtio_28.f03: New test. * gfortran.dg/dtio_4.f90: Update to open test file with status = 'scratch' to delete the file when done. From-SVN: r246576
2017-03-28re PR fortran/78661 ([OOP] Namelist output missing object designator under DTIO)Janus Weil2-10/+23
2017-03-28 Janus Weil <janus@gcc.gnu.org> PR fortran/78661 * trans-io.c (transfer_namelist_element): Perform a polymorphic call to a DTIO procedure if necessary. 2017-03-28 Janus Weil <janus@gcc.gnu.org> PR fortran/78661 * gfortran.dg/dtio_25.f90: Modified test case. * gfortran.dg/dtio_27.f90: New test case. 2017-03-28 Janus Weil <janus@gcc.gnu.org> PR fortran/78661 * io/write.c (nml_write_obj): Build a class container only if necessary. From-SVN: r246546
2017-03-27list_read.c: Insert /* Fall through.Dominique d'Humieres2-1/+7
2017-03-27 Dominique d'Humieres <dominiq@lps.ens.fr> * io/list_read.c: Insert /* Fall through. */ in the macro CASE_SEPARATORS in order to silence warnings. From-SVN: r246507
2017-03-25re PR fortran/78881 ([F03] reading from string with DTIO procedure does not ↵Jerry DeLisle4-21/+74
work properly) 2017-03-25 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/78881 * io/io.h (st_parameter_dt): Rename unused component last_char to child_saved_iostat. Move comment to gfc_unit. * io/list_read.c (list_formatted_read_scalar): After call to child READ procedure, save the returned iostat value for later check. (finish_list_read): Only finish READ if child_saved_iostat was OK. * io/transfer.c (read_sf_internal): If there is a saved character in last character, seek back one. Add a new check for EOR condition. (read_sf): If there is a saved character in last character, seek back one. (formatted_transfer_scalar_read): Initialize last character before invoking child procedure. (data_transfer_init): If child dtio, set advance status to nonadvancing. Move update of size and check for EOR condition to before child dtio return. * gfortran.dg/dtio_26.f90: New test. From-SVN: r246478
2017-03-17re PR libfortran/79956 (many new -Wmaybe-uninitialized warnings with ↵Thomas Koenig13-12/+29
bootstrap-O3) 2017-03-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/79956 * m4/reshape.m4 (reshape_'rtype_ccode`): Correct use of GFC_ASSERT. * generated/reshape_c10.c: Regenerated. * generated/reshape_c16.c: Regenerated. * generated/reshape_c4.c: Regenerated. * generated/reshape_c8.c: Regenerated. * generated/reshape_i16.c: Regenerated. * generated/reshape_i4.c: Regenerated. * generated/reshape_i8.c: Regenerated. * generated/reshape_r10.c: Regenerated. * generated/reshape_r16.c: Regenerated. * generated/reshape_r4.c: Regenerated. * generated/reshape_r8.c: Regenerated. From-SVN: r246248
2017-03-15Don't use Win32 functions on CYGWIN.NightStrike4-6/+17
This was a workaround for a cygwin bug which was fixed 4 years ago, and cygwin hasn't supported affected versions for a long time. 2017-03-15 NightStrike <nightstrike@gmail.com> Janne Blomqvist <jb@gcc.gnu.org> * intrinsics/random.c (getosrandom): Remove check for __CYGWIN__ preprocessor flag. * intrinsics/system_clock.c: Likewise. (system_clock_4): Likewise. (system_clock_8): Likewise. * intrinsics/time_1.h: Don't include windows.h if __CYGWIN__ is defined. Co-Authored-By: Janne Blomqvist <jb@gcc.gnu.org> From-SVN: r246162
2017-03-15re PR libfortran/79956 (many new -Wmaybe-uninitialized warnings with ↵Thomas Koenig15-0/+144
bootstrap-O3) 2017-03-15 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/79956 * libgfortran.h (GFC_ASSERT): New macro. * m4/reshape.m4 (reshape_'rtype_ccode`): Use GFC_ASSERT to specify that sdim > 0 and rdim > 0. * intrinsic/reshape_generic.c (reshape_internal): Likweise. * generated/reshape_c10.c: Regenerated. * generated/reshape_c16.c: Regenerated. * generated/reshape_c4.c: Regenerated. * generated/reshape_c8.c: Regenerated. * generated/reshape_i16.c: Regenerated. * generated/reshape_i4.c: Regenerated. * generated/reshape_i8.c: Regenerated. * generated/reshape_r10.c: Regenerated. * generated/reshape_r16.c: Regenerated. * generated/reshape_r4.c: Regenerated. * generated/reshape_r8.c: Regenerated. From-SVN: r246153
2017-03-11re PR fortran/78854 ([F03] DTIO namelist output not working on internal unit)Jerry DeLisle5-0/+36
2017-03-11 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/78854 * io/list_read.c (nml_get_obj_data): Stash internal unit for later use by child procedures. * io/write.c (nml_write_obj): Likewise. * io/tranfer.c (data_transfer_init): Minor whitespace. * io/unit.c (set_internal_uit): Look for the stashed internal unit and use it if found. * gfortran.dg/dtio_25.f90: New test. From-SVN: r246070
2017-03-10re PR libfortran/79956 (many new -Wmaybe-uninitialized warnings with ↵Thomas Koenig195-730/+929
bootstrap-O3) 2017-03-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/79956 * m4/iforeach.m4: Change exit condition from loop for increasing dimension to >=. Fix type in comment. * m4/ifunction.m4: Likewise. * m4/ifunction_logical.m4: Likewise. * generated/all_l1.c: Regenerated. * generated/all_l16.c: Regenerated. * generated/all_l2.c: Regenerated. * generated/all_l4.c: Regenerated. * generated/all_l8.c: Regenerated. * generated/any_l1.c: Regenerated. * generated/any_l16.c: Regenerated. * generated/any_l2.c: Regenerated. * generated/any_l4.c: Regenerated. * generated/any_l8.c: Regenerated. * generated/count_16_l.c: Regenerated. * generated/count_1_l.c: Regenerated. * generated/count_2_l.c: Regenerated. * generated/count_4_l.c: Regenerated. * generated/count_8_l.c: Regenerated. * generated/iall_i1.c: Regenerated. * generated/iall_i16.c: Regenerated. * generated/iall_i2.c: Regenerated. * generated/iall_i4.c: Regenerated. * generated/iall_i8.c: Regenerated. * generated/iany_i1.c: Regenerated. * generated/iany_i16.c: Regenerated. * generated/iany_i2.c: Regenerated. * generated/iany_i4.c: Regenerated. * generated/iany_i8.c: Regenerated. * generated/iparity_i1.c: Regenerated. * generated/iparity_i16.c: Regenerated. * generated/iparity_i2.c: Regenerated. * generated/iparity_i4.c: Regenerated. * generated/iparity_i8.c: Regenerated. * generated/maxloc0_16_i1.c: Regenerated. * generated/maxloc0_16_i16.c: Regenerated. * generated/maxloc0_16_i2.c: Regenerated. * generated/maxloc0_16_i4.c: Regenerated. * generated/maxloc0_16_i8.c: Regenerated. * generated/maxloc0_16_r10.c: Regenerated. * generated/maxloc0_16_r16.c: Regenerated. * generated/maxloc0_16_r4.c: Regenerated. * generated/maxloc0_16_r8.c: Regenerated. * generated/maxloc0_4_i1.c: Regenerated. * generated/maxloc0_4_i16.c: Regenerated. * generated/maxloc0_4_i2.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r10.c: Regenerated. * generated/maxloc0_4_r16.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_8_i1.c: Regenerated. * generated/maxloc0_8_i16.c: Regenerated. * generated/maxloc0_8_i2.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r10.c: Regenerated. * generated/maxloc0_8_r16.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc1_16_i1.c: Regenerated. * generated/maxloc1_16_i16.c: Regenerated. * generated/maxloc1_16_i2.c: Regenerated. * generated/maxloc1_16_i4.c: Regenerated. * generated/maxloc1_16_i8.c: Regenerated. * generated/maxloc1_16_r10.c: Regenerated. * generated/maxloc1_16_r16.c: Regenerated. * generated/maxloc1_16_r4.c: Regenerated. * generated/maxloc1_16_r8.c: Regenerated. * generated/maxloc1_4_i1.c: Regenerated. * generated/maxloc1_4_i16.c: Regenerated. * generated/maxloc1_4_i2.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r10.c: Regenerated. * generated/maxloc1_4_r16.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_8_i1.c: Regenerated. * generated/maxloc1_8_i16.c: Regenerated. * generated/maxloc1_8_i2.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r10.c: Regenerated. * generated/maxloc1_8_r16.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxval_i1.c: Regenerated. * generated/maxval_i16.c: Regenerated. * generated/maxval_i2.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r10.c: Regenerated. * generated/maxval_r16.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc0_16_i1.c: Regenerated. * generated/minloc0_16_i16.c: Regenerated. * generated/minloc0_16_i2.c: Regenerated. * generated/minloc0_16_i4.c: Regenerated. * generated/minloc0_16_i8.c: Regenerated. * generated/minloc0_16_r10.c: Regenerated. * generated/minloc0_16_r16.c: Regenerated. * generated/minloc0_16_r4.c: Regenerated. * generated/minloc0_16_r8.c: Regenerated. * generated/minloc0_4_i1.c: Regenerated. * generated/minloc0_4_i16.c: Regenerated. * generated/minloc0_4_i2.c: Regenerated. * generated/minloc0_4_i4.c: Regenerated. * generated/minloc0_4_i8.c: Regenerated. * generated/minloc0_4_r10.c: Regenerated. * generated/minloc0_4_r16.c: Regenerated. * generated/minloc0_4_r4.c: Regenerated. * generated/minloc0_4_r8.c: Regenerated. * generated/minloc0_8_i1.c: Regenerated. * generated/minloc0_8_i16.c: Regenerated. * generated/minloc0_8_i2.c: Regenerated. * generated/minloc0_8_i4.c: Regenerated. * generated/minloc0_8_i8.c: Regenerated. * generated/minloc0_8_r10.c: Regenerated. * generated/minloc0_8_r16.c: Regenerated. * generated/minloc0_8_r4.c: Regenerated. * generated/minloc0_8_r8.c: Regenerated. * generated/minloc1_16_i1.c: Regenerated. * generated/minloc1_16_i16.c: Regenerated. * generated/minloc1_16_i2.c: Regenerated. * generated/minloc1_16_i4.c: Regenerated. * generated/minloc1_16_i8.c: Regenerated. * generated/minloc1_16_r10.c: Regenerated. * generated/minloc1_16_r16.c: Regenerated. * generated/minloc1_16_r4.c: Regenerated. * generated/minloc1_16_r8.c: Regenerated. * generated/minloc1_4_i1.c: Regenerated. * generated/minloc1_4_i16.c: Regenerated. * generated/minloc1_4_i2.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r10.c: Regenerated. * generated/minloc1_4_r16.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_8_i1.c: Regenerated. * generated/minloc1_8_i16.c: Regenerated. * generated/minloc1_8_i2.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r10.c: Regenerated. * generated/minloc1_8_r16.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minval_i1.c: Regenerated. * generated/minval_i16.c: Regenerated. * generated/minval_i2.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r10.c: Regenerated. * generated/minval_r16.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/norm2_r10.c: Regenerated. * generated/norm2_r16.c: Regenerated. * generated/norm2_r4.c: Regenerated. * generated/norm2_r8.c: Regenerated. * generated/parity_l1.c: Regenerated. * generated/parity_l16.c: Regenerated. * generated/parity_l2.c: Regenerated. * generated/parity_l4.c: Regenerated. * generated/parity_l8.c: Regenerated. * generated/product_c10.c: Regenerated. * generated/product_c16.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i1.c: Regenerated. * generated/product_i16.c: Regenerated. * generated/product_i2.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r10.c: Regenerated. * generated/product_r16.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c10.c: Regenerated. * generated/sum_c16.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i1.c: Regenerated. * generated/sum_i16.c: Regenerated. * generated/sum_i2.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r10.c: Regenerated. * generated/sum_r16.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. From-SVN: r246053
2017-03-05check.c (positive_check): Add new function checking constant for being ↵Andre Vehreschild3-6/+102
greater then zero. gcc/fortran/ChangeLog: 2017-03-05 Andre Vehreschild <vehre@gcc.gnu.org> Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> * check.c (positive_check): Add new function checking constant for being greater then zero. (gfc_check_image_status): Add checking of image_status arguments. (gfc_check_failed_or_stopped_images): Same but for failed_- and stopped_images function. * dump-parse-tree.c (show_code_node): Added output of FAIL IMAGE. * gfortran.h (enum gfc_statement): Added FAIL_IMAGE_ST. (enum gfc_isym_id): Added new intrinsic symbols. (enum gfc_exec_op): Added EXEC_FAIL_IMAGE. * gfortran.texi: Added description for the new API functions. Updated coverage of gfortran of TS18508. * intrinsic.c (add_functions): Added symbols to resolve new intrinsic functions. * intrinsic.h: Added prototypes. * iresolve.c (gfc_resolve_failed_images): Resolve the failed_images intrinsic. (gfc_resolve_image_status): Same for image_status. (gfc_resolve_stopped_images): Same for stopped_images. * libgfortran.h: Added prototypes. * match.c (gfc_match_if): Added matching of FAIL IMAGE statement. (gfc_match_fail_image): Match a FAIL IMAGE statement. * match.h: Added prototype. * parse.c (decode_statement): Added matching for FAIL IMAGE. (next_statement): Same. (gfc_ascii_statement): Same. * resolve.c: Same. * simplify.c (gfc_simplify_failed_or_stopped_images): For COARRAY= single a constant result can be returne.d (gfc_simplify_image_status): For COARRAY=single the result is constant. * st.c (gfc_free_statement): Added FAIL_IMAGE handling. * trans-decl.c (gfc_build_builtin_function_decls): Added decls of the new intrinsics. * trans-expr.c (gfc_conv_procedure_call): This is first time all arguments of a function are optional, which is now handled here correctly. * trans-intrinsic.c (conv_intrinsic_image_status): Translate image_status. (gfc_conv_intrinsic_function): Add support for image_status. (gfc_is_intrinsic_libcall): Add support for the remaining new intrinsics. * trans-stmt.c (gfc_trans_fail_image): Trans a fail image. * trans-stmt.h: Add the prototype for the above. * trans.c (trans_code): Dispatch for fail_image. * trans.h: Add the trees for the new intrinsics. libgfortran/ChangeLog: 2017-03-05 Andre Vehreschild <vehre@gcc.gnu.org> Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> * caf/libcaf.h: Added prototypes and stat codes for failed and stopped images. * caf/single.c (void _gfortran_caf_fail_image): Add the routine. (int _gfortran_caf_image_status): Same. (_gfortran_caf_failed_images): Same. (_gfortran_caf_stopped_images): Same. gcc/testsuite/ChangeLog: 2017-03-05 Andre Vehreschild <vehre@gcc.gnu.org> Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> * gfortran.dg/coarray/fail_image_1.f08: New test. * gfortran.dg/coarray/fail_image_2.f08: New test. * gfortran.dg/coarray/failed_images_1.f08: New test. * gfortran.dg/coarray/failed_images_2.f08: New test. * gfortran.dg/coarray/image_status_1.f08: New test. * gfortran.dg/coarray/image_status_2.f08: New test. * gfortran.dg/coarray/stopped_images_1.f08: New test. * gfortran.dg/coarray/stopped_images_2.f08: New test. * gfortran.dg/coarray_fail_st.f90: New test. * gfortran.dg/coarray_failed_images_1.f08: New test. * gfortran.dg/coarray_image_status_1.f08: New test. * gfortran.dg/coarray_stopped_images_1.f08: New test. From-SVN: r245900
2017-03-02matmul.m4 (matmul_'rtype_code`): Avoid race condition on storing function ↵Thomas Koenig15-154/+257
pointer. 2017-03-02 Thomas Koenig <tkoenig@gcc.gnu.org> Jakub Jelinek <jakub@redhat.com> * m4/matmul.m4 (matmul_'rtype_code`): Avoid race condition on storing function pointer. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r245839
2017-03-02re PR libfortran/78379 (Processor-specific versions for matmul)Thomas Koenig15-91/+62
2017-03-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/78379 * m4/matmul.m4: (matmul_'rtype_code`_avx2): Also generate for reals. Add fma to target options. (matmul_'rtype_code`): Call AVX2 only if FMA is available. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. From-SVN: r245836
2017-02-27Don't try to use rand_s on CYGWINJanne Blomqvist2-1/+6
CYGWIN seems to include _mingw.h and thus __MINGW64_VERSION_MAJOR is defined even though rand_s is not available. Thus add an extra check for __CYGWIN__. 2017-02-27 Janne Blomqvist <jb@gcc.gnu.org> * intrinsics/random.c (getosrandom): Don't try to use rand_s on CYGWIN. From-SVN: r245755
2017-02-20re PR fortran/79382 (DTIO ICE)Paul Thomas2-0/+34
2017-02-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/79382 * decl.c (access_attr_decl): Test for presence of generic DTIO interface and emit error if not present. 2017-02-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/79382 * io/transfer.c (check_dtio_proc): New function. (formatted_transfer_scalar_read): Use it. (formatted_transfer_scalar_write): ditto. 2017-02-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/79382 * gfortran.dg/dtio_10.f90 : Change test of error message. * gfortran.dg/dtio_23.f90 : New test. * gfortran.dg/dtio_24.f90 : New test. From-SVN: r245596
2017-01-31re PR fortran/79305 (real128 - undefined reference to cexpl)Steven G. Kargl3-2/+8
2017-01-31 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/79305 * c99_protos.h: Spell HAVE_EXPL correctly. * intrinsics/c99_functions.c: Ditto. From-SVN: r245068
2017-01-19re PR target/78478 (Compile Error for i386-rtems)Uros Bizjak5-1/+55
PR target/78478 * config/ax_check_define.m4: New file. libgfortran/ChangeLog: PR target/78478 * acinclude.m4: Include ../config/ax_check_define.m4 * configure.ac: Check if _SOFT_FLOAT is defined. * configure.host (i?86 | x86_64): Use fpu-generic when have_soft_float is set. * configure: Regenerate. From-SVN: r244651
2017-01-19re PR target/79127 (Error: invalid register for .seh_savexmm in matmul_i4.c)Jakub Jelinek3-2/+24
PR target/79127 * acinclude.m4 (LIBGFOR_CHECK_AVX512F): Ensure the test clobbers some zmm16+ registers to verify they are handled by unwind info properly if needed. * configure: Regenerated. From-SVN: r244636
2017-01-17re PR other/79046 (g++ -print-file-name=plugin uses full version number in path)Jakub Jelinek5-4/+36
PR other/79046 * configure: Regenerated. config/ * acx.m4 (GCC_BASE_VER): New m4 function. (ACX_TOOL_DIRS): Require GCC_BASE_VER, for --with-gcc-major-version-only use just major number from BASE-VER. gcc/ * configure.ac: Add GCC_BASE_VER. * Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. (CFLAGS-gcc.o): Add -DBASEVER=$(BASEVER_s). (gcc.o): Depend on $(BASEVER). * common.opt (dumpfullversion): New option. * gcc.c (driver_handle_option): Handle OPT_dumpfullversion. * doc/invoke.texi: Document -dumpfullversion. * doc/install.texi: Document --with-gcc-major-version-only. * configure: Regenerated. libatomic/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * testsuite/Makefile.in: Regenerated. * configure: Regenerated. * Makefile.in: Regenerated. libgomp/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * testsuite/Makefile.in: Regenerated. * configure: Regenerated. * Makefile.in: Regenerated. libgcc/ * configure.ac: Add GCC_BASE_VER. * Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. libssp/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. * Makefile.in: Regenerated. liboffloadmic/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * aclocal.m4: Include ../config/acx.m4. * configure: Regenerated. * Makefile.in: Regenerated. libquadmath/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. * Makefile.in: Regenerated. libmpx/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. * Makefile.in: Regenerated. libada/ * configure.ac: Add GCC_BASE_VER. * Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. lto-plugin/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. * Makefile.in: Regenerated. libitm/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * testsuite/Makefile.in: Regenerated. * configure: Regenerated. * Makefile.in: Regenerated. fixincludes/ * configure.ac: Add GCC_BASE_VER. * Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. libcilkrts/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * aclocal.m4: Include ../config/acx.m4. * configure: Regenerated. * Makefile.in: Regenerated. libcc1/ * configure.ac: Add GCC_BASE_VER. For --with-gcc-major-version-only use just major number from BASE-VER. * configure: Regenerated. * Makefile.in: Regenerated. libobjc/ * configure.ac: Add GCC_BASE_VER. * Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. libstdc++-v3/ * configure.ac: Add GCC_BASE_VER. * fragment.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * po/Makefile.in: Regenerated. * libsupc++/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * src/Makefile.in: Regenerated. * configure: Regenerated. * Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * doc/Makefile.in: Regenerated. * python/Makefile.in: Regenerated. * src/c++11/Makefile.in: Regenerated. * src/c++98/Makefile.in: Regenerated. * src/filesystem/Makefile.in: Regenerated. libvtv/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * testsuite/Makefile.in: Regenerated. * configure: Regenerated. * Makefile.in: Regenerated. libsanitizer/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * libbacktrace/Makefile.in: Regenerated. * interception/Makefile.in: Regenerated. * asan/Makefile.in: Regenerated. * ubsan/Makefile.in: Regenerated. * configure: Regenerated. * sanitizer_common/Makefile.in: Regenerated. * lsan/Makefile.in: Regenerated. * Makefile.in: Regenerated. * tsan/Makefile.in: Regenerated. libgfortran/ * configure.ac: Add GCC_BASE_VER. * Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to get version from BASE-VER file. * configure: Regenerated. * Makefile.in: Regenerated. From-SVN: r244521
2017-01-13Revert r244448Janne Blomqvist13-59/+37
From-SVN: r244454
2017-01-13PR 78534 Change character length from int to size_tJanne Blomqvist13-37/+59
In order to handle large character lengths on (L)LP64 targets, switch the GFortran character length from an int to a size_t. This is an ABI change, as procedures with character arguments take hidden arguments with the character length. I also changed the _size member in vtables from int to size_t, as there were some cases where character lengths and sizes were apparently mixed up and caused regressions otherwise. Although I haven't tested, this might enable very large derived types as well. Also, as there are some places in the frontend were negative character lengths are used as special flag values, in the frontend the character length is handled as a signed variable of the same size as a size_t, although in the runtime library it really is size_t. I haven't changed the character length variables for the co-array intrinsics, as this is something that may need to be synchronized with OpenCoarrays. This is v4 of the patch. v3 was applied but had to reverted due to breaking bootstrap. The fix is in resolve.c:resolve_charlen, where it's necessary to check that an expression is constant before using mpz_sgn. Overview of v3 of the patch: All the issues pointed out by FX's review of v2 have been fixed. In particular, there are now new functions gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT instead of a long value. Similarly, gfc_get_int_expr now takes a HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by gfc_extract_hwi. Also, the preliminary work to handle gfc_charlen_type_node being unsigned has been removed. Regtested on x86_64-pc-linux-gnu and i686-pc-linux-gnu. frontend: 2017-01-13 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of hardcoded kind. (find_intrinsic_vtab): Likewise. * expr.c (gfc_get_character_expr): Length parameter of type gfc_charlen_t. (gfc_get_int_expr): Value argument of type HOST_WIDE_INT. (gfc_extract_hwi): New function. (simplify_const_ref): Make string_len of type gfc_charlen_t. (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs. * gfortran.h (gfc_mpz_get_hwi): New prototype. (gfc_mpz_set_hwi): Likewise. (gfc_charlen_t): New typedef. (gfc_expr): Use gfc_charlen_t for character lengths. (gfc_size_kind): New extern variable. (gfc_extract_hwi): New prototype. (gfc_get_character_expr): Use gfc_charlen_t for character length. (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument. * iresolve.c (gfc_resolve_repeat): Pass string length directly without temporary, use gfc_charlen_int_kind. * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen. * misc.c (gfc_mpz_get_hwi): New function. (gfc_mpz_set_hwi): New function. * module.c (atom_int): Change type from int to HOST_WIDE_INT. (parse_integer): Don't complain about large integers. (write_atom): Use HOST_WIDE_INT for integers. (mio_integer): Handle integer type mismatch. (mio_hwi): New function. (mio_intrinsic_op): Use HOST_WIDE_INT. (mio_array_ref): Likewise. (mio_expr): Likewise. * resolve.c (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf. (resolve_substring_charlen): Use gfc_charlen_int_kind. (resolve_charlen): Use mpz_sgn to determine sign. * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t instead of long. * target-memory.c (size_character): Length argument of type gfc_charlen_t. (gfc_encode_character): Likewise. (gfc_interpret_character): Use gfc_charlen_t. * target-memory.h (gfc_encode_character): Modify prototype. * trans-array.c (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type. * trans-const.c (gfc_conv_mpz_to_tree_type): New function. * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype. * trans-expr.c (gfc_class_len_or_zero_get): Build const of type gfc_charlen_type_node. (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of 4, fold_convert to correct type. (gfc_conv_class_to_class): Build const of type size_type_node for size. (gfc_copy_class_to_class): Likewise. (gfc_conv_string_length): Use same type in expression. (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen. (gfc_conv_string_tmp): Make sure len is of the right type. (gfc_conv_concat_op): Use same type in expression. (gfc_conv_procedure_call): Likewise. (alloc_scalar_allocatable_for_subcomponent_assignment): fold_convert to right type. (gfc_trans_subcomponent_assign): Likewise. (trans_class_vptr_len_assignment): Build const of correct type. (gfc_trans_pointer_assignment): Likewise. (alloc_scalar_allocatable_for_assignment): fold_convert to right type in expr. (trans_class_assignment): Build const of correct type. * trans-intrinsic.c (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_repeat): Do calculation in sizetype. * trans-io.c (gfc_build_io_library_fndecls): Use gfc_charlen_type_node for character lengths. * trans-stmt.c (gfc_trans_label_assign): Build const of gfc_charlen_type_node. (gfc_trans_character_select): Likewise. (gfc_trans_allocate): Likewise, don't typecast strlen result. (gfc_trans_deallocate): Don't typecast strlen result. * trans-types.c (gfc_size_kind): New variable. (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind from size_type_node. testsuite: 2017-01-13 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T. * gfortran.dg/repeat_7.f90: New test for PR 66310. * gfortran.dg/scan_2.f90: Handle potential cast in assignment. * gfortran.dg/string_1.f90: Limit to ilp32 targets. * gfortran.dg/string_1_lp64.f90: New test. * gfortran.dg/string_3.f90: Limit to ilp32 targets. * gfortran.dg/string_3_lp64.f90: New test. libgfortran: 2017-01-13 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 * intrinsics/args.c (getarg_i4): Use gfc_charlen_type. (get_command_argument_i4): Likewise. (get_command_i4): Likewise. * intrinsics/chmod.c (chmod_internal): Likewise. * intrinsics/env.c (get_environment_variable_i4): Likewise. * intrinsics/extends_type_of.c (struct vtype): Use size_t for size member. * intrinsics/gerror.c (gerror): Use gfc_charlen_type. * intrinsics/getlog.c (getlog): Likewise. * intrinsics/hostnm.c (hostnm_0): Likewise. * intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to work if gfc_charlen_type is unsigned. (string_scan): Likewise. * io/transfer.c (transfer_character): Modify prototype. (transfer_character_write): Likewise. (transfer_character_wide): Likewise. (transfer_character_wide_write): Likewise. (transfer_array): Typecast to avoid signed-unsigned comparison. * io/unit.c (is_trim_ok): Use gfc_charlen_type. * io/write.c (namelist_write): Likewise. * libgfortran.h (gfc_charlen_type): Change typedef to size_t. From-SVN: r244448
2017-01-13re PR fortran/70696 ([Coarray] ICE on EVENT POST of host-associated ↵Andre Vehreschild2-2/+11
EVENT_TYPE coarray) gcc/testsuite/ChangeLog: 2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/70696 * gfortran.dg/coarray/event_3.f08: New test. gcc/fortran/ChangeLog: 2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/70696 * trans-expr.c (gfc_get_tree_for_caf_expr): Ensure the backend_decl is valid before accessing it. libgfortran/ChangeLog: 2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/70696 * caf/single.c (_gfortran_caf_register): Allocate enough memory for the event counter. From-SVN: r244407
2017-01-07re PR fortran/78781 ([Coarray] ICE in gfc_deallocate_scalar_with_status, at ↵Andre Vehreschild2-4/+24
fortran/trans.c:1588) gcc/fortran/ChangeLog: 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78781 PR fortran/78935 * expr.c (gfc_check_pointer_assign): Return the same error message for rewritten coarray pointer assignments like for plain ones. * gfortran.h: Change prototype. * primary.c (caf_variable_attr): Set attributes used ones only only ones. Add setting of pointer_comp attribute. (gfc_caf_attr): Add setting of pointer_comp attribute. * trans-array.c (gfc_array_allocate): Add flag that the component to allocate is not an ultimate coarray component. Add allocation of pointer arrays. (structure_alloc_comps): Extend nullify to treat pointer components in coarrays correctly. Restructure nullify to remove redundant code. (gfc_nullify_alloc_comp): Allow setting caf_mode flags. * trans-array.h: Change prototype of gfc_nullify_alloc_comp (). * trans-decl.c (generate_coarray_sym_init): Call nullify_alloc_comp for derived type coarrays with pointer components. * trans-expr.c (gfc_trans_structure_assign): Also treat pointer components. (trans_caf_token_assign): Handle assignment of token of scalar pointer components. (gfc_trans_pointer_assignment): Call above routine. * trans-intrinsic.c (conv_expr_ref_to_caf_ref): Add treating pointer components. (gfc_conv_intrinsic_caf_get): Likewise. (conv_caf_send): Likewise. * trans-stmt.c (gfc_trans_allocate): After allocating a derived type in a coarray pre-register the tokens. (gfc_trans_deallocate): Simply determining the coarray type (scalar or array) and deregistering it correctly. * trans-types.c (gfc_typenode_for_spec): Replace in_coarray flag by the actual codim to allow lookup of array types in the cache. (gfc_build_array_type): Likewise. (gfc_get_array_descriptor_base): Likewise. (gfc_get_array_type_bounds): Likewise. (gfc_get_derived_type): Likewise. * trans-types.h: Likewise. * trans.c (gfc_deallocate_with_status): Enable deregistering of all kind of coarray components. (gfc_deallocate_scalar_with_status): Use free() in fcoarray_single mode instead of caf_deregister. libgfortran/ChangeLog: 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78781 PR fortran/78935 * caf/single.c (send_by_ref): Fix addressing of non-allocatable scalar destination components. gcc/testsuite/ChangeLog: 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray/ptr_comp_1.f08: New test. * gfortran.dg/coarray/ptr_comp_2.f08: New test. * gfortran.dg/coarray/ptr_comp_3.f08: New test. * gfortran.dg/coarray/ptr_comp_4.f08: New test. * gfortran.dg/coarray_ptr_comp_1.f08: New test. * gfortran.dg/coarray_ptr_comp_2.f08: New test. * gfortran.dg/coarray_ptr_comp_3.f08: New test. From-SVN: r244196
2017-01-03PR 78534 Revert r244011Janne Blomqvist13-59/+37
r244011 caused regressions on 32-bit hosts. From-SVN: r244027
2017-01-03PR 78534 Change character length from int to size_tJanne Blomqvist13-37/+59
In order to handle large character lengths on (L)LP64 targets, switch the GFortran character length from an int to a size_t. This is an ABI change, as procedures with character arguments take hidden arguments with the character length. I also changed the _size member in vtables from int to size_t, as there were some cases where character lengths and sizes were apparently mixed up and caused regressions otherwise. Although I haven't tested, this might enable very large derived types as well. Also, as there are some places in the frontend were negative character lengths are used as special flag values, in the frontend the character length is handled as a signed variable of the same size as a size_t, although in the runtime library it really is size_t. I haven't changed the character length variables for the co-array intrinsics, as this is something that may need to be synchronized with OpenCoarrays. This is v3 of the patch. All the issues pointed out by FX's review of v2 have been fixed. In particular, there are now new functions gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT instead of a long value. Similarly, gfc_get_int_expr now takes a HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by gfc_extract_hwi. Also, the preliminary work to handle gfc_charlen_type_node being unsigned has been removed. Regtested on x86_64-pc-linux-gnu. frontend: 2017-01-03 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of hardcoded kind. (find_intrinsic_vtab): Likewise. * expr.c (gfc_get_character_expr): Length parameter of type gfc_charlen_t. (gfc_get_int_expr): Value argument of type HOST_WIDE_INT. (gfc_extract_hwi): New function. (simplify_const_ref): Make string_len of type gfc_charlen_t. (gfc_simplify_expr): Use HOST_WIDE_INT for substring refs. * gfortran.h (gfc_mpz_get_hwi): New prototype. (gfc_mpz_set_hwi): Likewise. (gfc_charlen_t): New typedef. (gfc_expr): Use gfc_charlen_t for character lengths. (gfc_size_kind): New extern variable. (gfc_extract_hwi): New prototype. (gfc_get_character_expr): Use gfc_charlen_t for character length. (gfc_get_int_expr): Use HOST_WIDE_INT type for value argument. * iresolve.c (gfc_resolve_repeat): Pass string length directly without temporary, use gfc_charlen_int_kind. * match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen. * misc.c (gfc_mpz_get_hwi): New function. (gfc_mpz_set_hwi): New function. * module.c (atom_int): Change type from int to HOST_WIDE_INT. (parse_integer): Don't complain about large integers. (write_atom): Use HOST_WIDE_INT for integers. (mio_integer): Handle integer type mismatch. (mio_hwi): New function. (mio_intrinsic_op): Use HOST_WIDE_INT. (mio_array_ref): Likewise. (mio_expr): Likewise. * resolve.c (resolve_select_type): Use HOST_WIDE_INT for charlen, use snprintf. (resolve_charlen): Use mpz_sgn to determine sign. * simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t instead of long. * target-memory.c (size_character): Length argument of type gfc_charlen_t. (gfc_encode_character): Likewise. (gfc_interpret_character): Use gfc_charlen_t. * target-memory.h (gfc_encode_character): Modify prototype. * trans-array.c (get_array_ctor_var_strlen): Use gfc_conv_mpz_to_tree_type. * trans-const.c (gfc_conv_mpz_to_tree_type): New function. * trans-const.h (gfc_conv_mpz_to_tree_type): New prototype. * trans-expr.c (gfc_class_len_or_zero_get): Build const of type gfc_charlen_type_node. (gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of 4, fold_convert to correct type. (gfc_conv_class_to_class): Build const of type size_type_node for size. (gfc_copy_class_to_class): Likewise. (gfc_conv_string_length): Use same type in expression. (gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen. (gfc_conv_string_tmp): Make sure len is of the right type. (gfc_conv_concat_op): Use same type in expression. (gfc_conv_procedure_call): Likewise. (alloc_scalar_allocatable_for_subcomponent_assignment): fold_convert to right type. (gfc_trans_subcomponent_assign): Likewise. (trans_class_vptr_len_assignment): Build const of correct type. (gfc_trans_pointer_assignment): Likewise. (alloc_scalar_allocatable_for_assignment): fold_convert to right type in expr. (trans_class_assignment): Build const of correct type. * trans-intrinsic.c (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_repeat): Do calculation in sizetype. * trans-io.c (gfc_build_io_library_fndecls): Use gfc_charlen_type_node for character lengths. * trans-stmt.c (gfc_trans_label_assign): Build const of gfc_charlen_type_node. (gfc_trans_character_select): Likewise. (gfc_trans_allocate): Likewise, don't typecast strlen result. (gfc_trans_deallocate): Don't typecast strlen result. * trans-types.c (gfc_size_kind): New variable. (gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind from size_type_node. testsuite: 2017-01-03 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 PR fortran/66310 * gfortran.dg/dependency_49.f90: Change scan-tree-dump-times due to gfc_trans_string_copy change to avoid -Wstringop-overflow. * gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T. * gfortran.dg/repeat_7.f90: New test for PR 66310. * gfortran.dg/scan_2.f90: Handle potential cast in assignment. * gfortran.dg/string_1.f90: Limit to ilp32 targets. * gfortran.dg/string_1_lp64.f90: New test. * gfortran.dg/string_3.f90: Limit to ilp32 targets. * gfortran.dg/string_3_lp64.f90: New test. * gfortran.dg/transfer_intrinsic_1.f90: Change scan-tree-dump-times due to gfc_trans_string_copy change to avoid -Wstringop-overflow. libgfortran: 2017-01-03 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/78534 * intrinsics/args.c (getarg_i4): Use gfc_charlen_type. (get_command_argument_i4): Likewise. (get_command_i4): Likewise. * intrinsics/chmod.c (chmod_internal): Likewise. * intrinsics/env.c (get_environment_variable_i4): Likewise. * intrinsics/extends_type_of.c (struct vtype): Use size_t for size member. * intrinsics/gerror.c (gerror): Use gfc_charlen_type. * intrinsics/getlog.c (getlog): Likewise. * intrinsics/hostnm.c (hostnm_0): Likewise. * intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to work if gfc_charlen_type is unsigned. (string_scan): Likewise. * io/transfer.c (transfer_character): Modify prototype. (transfer_character_write): Likewise. (transfer_character_wide): Likewise. (transfer_character_wide_write): Likewise. (transfer_array): Typecast to avoid signed-unsigned comparison. * io/unit.c (is_trim_ok): Use gfc_charlen_type. * io/write.c (namelist_write): Likewise. * libgfortran.h (gfc_charlen_type): Change typedef to size_t. From-SVN: r244011