Commit Graph

5031 Commits

Author SHA1 Message Date
Jakub Jelinek bd2c62704b re PR translation/79019 (translatable string typo in cif-code.def:141)
PR translation/79019
	PR translation/79020
	* params.def (PARAM_INLINE_MIN_SPEEDUP,
	PARAM_IPA_CP_SINGLE_CALL_PENALTY,
	PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD): Fix typos
	in descriptions.
	* config/avr/avr.opt (maccumulate-args): Likewise.
	* config/msp430/msp430.opt (mwarn-mcu): Likewise.
	* common.opt (freport-bug): Likewise.
	* cif-code.def (CIF_FINAL_ERROR): Likewise.
	* doc/invoke.texi (ipa-cp-single-call-penalty): Likewise.
	* config/s390/s390.c (s390_invalid_binary_op): Fix spelling in
	translatable string.
	* config/i386/i386.c (function_value_32): Likewise.
	* config/nios2/nios2.c (nios2_valid_target_attribute_rec): Likewise.
	* config/msp430/msp430.c (msp430_option_override, msp430_attr):
	Likewise.
	* config/msp430/driver-msp430.c (msp430_select_hwmult_lib): Likewise.
	* common/config/msp430/msp430-common.c (msp430_handle_option):
	Likewise.
	* symtab.c (symtab_node::verify_base): Likewise.
	* opts.c (set_debug_level): Likewise.
	* tree.c (verify_type_variant): Likewise.  Fix typo in comment.
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add
	missing whitespace to translatable strings.
	* config/avr/avr.md (bswapsi2): Fix typo in comment.
	* config/sh/superh.h: Likewise.
	* config/i386/xopintrin.h: Likewise.
	* config/i386/znver1.md: Likewise.
	* config/rs6000/rs6000.c (struct rs6000_opt_mask): Likewise.
	* ipa-inline-analysis.c (compute_inline_parameters): Likewise.
	* double-int.h (struct double_int): Likewise.
	* double-int.c (div_and_round_double): Likewise.
	* wide-int.cc: Likewise.
	* tree-ssa.c (non_rewritable_mem_ref_base): Likewise.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
	* cfgcleanup.c (crossjumps_occured): Renamed to ...
	(crossjumps_occurred): ... this.
	(try_crossjump_bb, try_head_merge_bb, try_optimize_cfg, cleanup_cfg):
	Adjust all uses.
cp/
	* semantics.c (finish_omp_clauses): Add missing whitespace to
	translatable strings.
	* cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
lto/
	* lto-symtab.c (lto_symtab_merge_symbols): Fix comment typo.
fortran/
	* decl.c (attr_decl1): Fix spelling in translatable string.
	* intrinsic.texi: Fix spelling - invokation -> invocation.
	* lang.opt (faggressive-function-elimination, gfc_convert): Fix
	typos in descriptions.
	* openmp.c (resolve_omp_clauses): Add missing whitespace to
	translatable strings.
c-family/
	* c.opt (Wnormalized=): Fix typo in description.
testsuite/
	* c-c++-common/goacc/host_data-2.c (f): Adjust expected spelling of
	diagnostics.
	* gfortran.dg/initialization_17.f90: Likewise.

From-SVN: r244245
2017-01-09 22:48:33 +01:00
Martin Sebor efcc8d387f PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

	PR middle-end/77708
	* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
	* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
	New member functions.
	(format_directive): Used them.
	(add_bytes): Same.
	(pass_sprintf_length::handle_gimple_call): Same.
	* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
	to avoid truncation for any argument.
	(extract_affine_mul): Same.
	* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

	PR middle-end/77708
	* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

	PR tree-optimization/78913
	PR middle-end/77708
	* trans-common.c (build_equiv_decl): Increase buffer size to avoid
	truncation for any argument.
	* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

	PR middle-end/77708
	* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
	* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
	due to bug 78969.
	* gcc.dg/format/pr78569.c: Adjust.

From-SVN: r244210
2017-01-08 16:42:09 -07:00
Andre Vehreschild de91486c74 re PR fortran/78781 ([Coarray] ICE in gfc_deallocate_scalar_with_status, at 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-07 18:26:58 +01:00
Jakub Jelinek 75213cc0e4 system.h (GCC_DIAGNOSTIC_PUSH_IGNORED, [...]): Define.
* system.h (GCC_DIAGNOSTIC_PUSH_IGNORED, GCC_DIAGNOSTIC_POP,
	GCC_DIAGNOSTIC_STRINGIFY): Define.

	* simplify.c (simplify_transformation_to_array): Use
	GCC_DIAGNOSTIC_PUSH_IGNORED and GCC_DIAGNOSTIC_POP instead of
	#pragma GCC diagnostic {push,ignored,pop}.

From-SVN: r244179
2017-01-06 19:41:23 +01:00
Alexandre Oliva e1d070a4f7 [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
simplify_transformation_to_array had the nested loop unrolled 7 times,
which is reasonable given that it iterates over arrays of size
GFC_MAX_DIMENSIONS == 7.

The problem is that the last iteration increments the index, tests
that it's less than result->rank, and then accesses the arrays with
the incremented index.

We did not optimize out that part in the 7th iteration, so VRP flagged
the unreachable code as accessing arrays past the end.

It couldn't possibly know that we'd never reach that part, since the
test was on result->rank, and it's not obvious (for the compiler) that
result->rank <= GFC_MAX_DIMENSIONS.

Even an assert to that effect before the enclosing loop didn't avoid
the warning turned to error, though; I suppose there might be some
aliasing at play, because moving the assert into the loop does.  An
assert on the index itself would also work, even more efficiently, but
we're just silencing the warning instead.

for  gcc/fortran/ChangeLog

	* simplify.c (simplify_transformation_to_array): Silence
	array bounds warning.  Fix whitespace.

From-SVN: r244122
2017-01-06 03:34:37 +00:00
Alexandre Oliva 692216906b [bootstrap-O3,fortran] add a NULL initializer to avoid a warning at -O3
Building with the bootstrap-O3 configuration option fails to compile
fortran/module.c due to an AFAICT false-positive warning about an
uninitialized use of a variable.

This patch adds a dummy initializer to silence it.

for  gcc/fortran/ChangeLog

	* module.c (load_omp_udrs): Initialize name.

From-SVN: r244087
2017-01-05 01:46:01 +00:00
Janne Blomqvist 84aff3c2d4 PR 78534 Revert r244011
r244011 caused regressions on 32-bit hosts.

From-SVN: r244027
2017-01-03 20:01:30 +02:00
Janne Blomqvist 994e4aca2c PR 78534 Change character length from int to size_t
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
2017-01-03 09:04:01 +02:00
Janne Blomqvist 096308ba6c PR 78534 Modify string copy to avoid -Wstringop-overflow warning
When the character length is changed from int to size_t the existing
algorithm causes a -Wstringop-overflow warning with -O1 on the
gfortran.dg/allocate_deferred_char_scalar_1.f03 testcase. This change
is committed separately from the character length size change in order
to make bisecting potential performance issues easier.

2017-01-02  Janne Blomqvist  <jb@gcc.gnu.org>

        PR fortran/78534
	* trans-expr.c (gfc_trans_string_copy): Rework string copy
	algorithm to avoid -Wstringop-overflow warning.

From-SVN: r244003
2017-01-02 22:00:18 +02:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Jakub Jelinek c1a9c36961 gcc.c (process_command): Update copyright notice dates.
gcc/
	* gcc.c (process_command): Update copyright notice dates.
	* gcov-dump.c (print_version): Ditto.
	* gcov.c (print_version): Ditto.
	* gcov-tool.c (print_version): Ditto.
	* gengtype.c (create_file): Ditto.
	* doc/cpp.texi: Bump @copying's copyright year.
	* doc/cppinternals.texi: Ditto.
	* doc/gcc.texi: Ditto.
	* doc/gccint.texi: Ditto.
	* doc/gcov.texi: Ditto.
	* doc/install.texi: Ditto.
	* doc/invoke.texi: Ditto.
gcc/fortran/
	* gfortranspec.c (lang_specific_driver): Update copyright notice
	dates.
	* gfc-internals.texi: Bump @copying's copyright year.
	* gfortran.texi: Ditto.
	* intrinsic.texi: Ditto.
	* invoke.texi: Ditto.
gcc/ada/
	* gnat_ugn.texi: Bump @copying's copyright year.
	* gnat_rm.texi: Likewise.
gcc/go/
	* gccgo.texi: Bump @copyrights-go year.
libitm/
	* libitm.texi: Bump @copying's copyright year.
libgomp/
	* libgomp.texi: Bump @copying's copyright year.
libquadmath/
	* libquadmath.texi: Bump @copying's copyright year.

From-SVN: r243992
2017-01-01 12:31:28 +01:00
Jakub Jelinek 2700d0e3ab gfortran.h (gfc_error): Rename overload with OPT argument to...
* gfortran.h (gfc_error): Rename overload with OPT argument to...
	(gfc_error_opt): ... this.
	* error.c (gfc_error): Rename overloads with OPT argument to...
	(gfc_error_opt): ... this.  Adjust callers.
	(gfc_notify_std, gfc_error): Adjust callers.
	* resolve.c (resolve_structure_cons, resolve_global_procedure): Use
	gfc_error_opt instead of gfc_error.
	* interface.c (argument_rank_mismatch, compare_parameter,
	gfc_check_typebound_override): Likewise.  Fix up formatting.

From-SVN: r243941
2016-12-27 16:17:19 +01:00
Andre Vehreschild f19dd7b634 class_assign_1.f08: New test.
gcc/testsuite/ChangeLog:

2016-12-23  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/class_assign_1.f08: New test.


gcc/fortran/ChangeLog:

2016-12-23  Andre Vehreschild  <vehre@gcc.gnu.org>

	* trans-expr.c (trans_class_assignment): Allocate memory of _vptr->size
        before assigning an allocatable class object.
	(gfc_trans_assignment_1): Flag that (re-)alloc of the class object
	shall be done.

From-SVN: r243909
2016-12-23 11:26:47 +01:00
Jakub Jelinek 4e2044d68d re PR fortran/78866 (ICE in gimplify_adjust_omp_clauses_1, at gimplify.c:8721)
PR fortran/78866
	* openmp.c (resolve_omp_clauses): Diagnose assumed size arrays in
	OpenMP map, to and from clauses.
	* trans-openmp.c: Include diagnostic-core.h, temporarily redefining
	GCC_DIAG_STYLE to __gcc_tdiag__.
	(gfc_omp_finish_clause): Diagnose implicitly mapped assumed size
	arrays.

	* gfortran.dg/gomp/map-1.f90: Add expected error.
	* gfortran.dg/gomp/pr78866-1.f90: New test.
	* gfortran.dg/gomp/pr78866-2.f90: New test.

From-SVN: r243860
2016-12-21 17:16:20 +01:00
Janne Blomqvist b528e42751 PR 78867 Function returning string ICE with -flto
The fix for PR 78757 was slightly too cautious, and covered only the
case of functions returning pointers to characters. By moving the
block above the if statement the DECL_EXPR is created also for
functions returning non-pointer characters.

Regtested on x86_64-pc-linux-gnu.

fortran ChangeLog:

2016-12-21  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78867
	* trans-expr.c (gfc_conv_procedure_call): Emit DECL_EXPR also for
	non-pointer character results.

testsuite ChangeLog:

2016-12-21  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78867
	* gfortran.dg/string_length_4.f90: New test.

From-SVN: r243842
2016-12-21 11:41:25 +02:00
Francois-Xavier Coudert f7db9ebf2b iresolve.c (gfc_resolve_ftell): Call "ftell" instead of "ftell2".
* iresolve.c (gfc_resolve_ftell): Call "ftell" instead of "ftell2".

	* gfortran.map: Remove _gfortran_ftell2.
	* io/intrinsics.c (ftell): Remove.
	(ftell2): Rename to ftell.

From-SVN: r243841
2016-12-21 09:35:57 +00:00
Janne Blomqvist a388bdc777 Use the middle-end boolean_type_node
Use the boolean_type_node setup by the middle-end instead of
redefining it. boolean_type_node is not used in GFortran for any
ABI-visible stuff, only internally as the type of boolean
expressions. There appears to be one exception to this, namely the
caf_get* and caf_send* calls which have boolean_type_node
arguments. However, on the library side they seem to use C _Bool, so I
suspect this might be a case of a argument mismatch that hasn't
affected anything so far.

The practical effect of this is that the size of such variables will
be the same as a C _Bool or C++ bool, that is, on most targets a
single byte. Previously we redefined boolean_type_node to be a Fortran
default logical kind sized variable, that is 4 or 8 bytes depending on
compile options. This might enable slightly more compact code, in case
the optimizer determines that the result of such a generated
comparison expression needs to be stored in some temporary location
rather than being used immediately.

Regression tested on x86_64-pc-linux-gnu.

2016-12-20  Janne Blomqvist  <jb@gcc.gnu.org>

	* trans-types.c (gfc_init_types): Don't redefine boolean type node.

From-SVN: r243830
2016-12-20 22:46:13 +02:00
Francois-Xavier Coudert 75b07bb45a trans-decl.c (create_main_function): Remove unused elements to the set_options call.
* trans-decl.c (create_main_function): Remove unused elements to
	the set_options call.

	* runtime/compile_options.c (set_options): Remove unused elements.

From-SVN: r243814
2016-12-19 22:29:43 +00:00
Francois-Xavier Coudert 03506f8cc3 trans.h: Remove gfor_fndecl_stop_numeric_f08.
* trans.h: Remove gfor_fndecl_stop_numeric_f08.
	* trans-decl.c: Remove gfor_fndecl_stop_numeric_f08.
	* trans-stmt.c (gfc_trans_stop): Use gfor_fndecl_stop_numeric
	instead of gfor_fndecl_stop_numeric_f08.

	* gfortran.map: Remove _gfortran_stop_numeric_f08.
	* runtime/stop.c: Rename stop_numeric_f08 into stop_numeric.

From-SVN: r243803
2016-12-19 16:09:12 +00:00
Janus Weil 99eb50e806 re PR fortran/78545 (Possible correction to online LTIME documentation)
2016-12-19  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78545
	* intrinsic.texi: Minor documentation fixes for non-standard
	time-related intrinsics. Add references to standard intrinsics and
	linkify some existing references.

From-SVN: r243794
2016-12-19 11:26:04 +01:00
Dominique d'Humieres 1feb2bedae re PR fortran/78545 (Possible correction to online LTIME documentation)
2016-12-18  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR fortran/78545
	* intrinsic.texi: Fix documentation for GMTIME and LTIME.

	* intrinsics/date_and_time.c: Fix comments for GMTIME and LTIME.

From-SVN: r243785
2016-12-18 19:03:36 +01:00
Janus Weil 707024b2e8 re PR fortran/78848 ([OOP] ICE on writing CLASS variable with non-typebound DTIO procedure)
2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78848
	* trans-io.c (get_dtio_proc): Generate non-typebound DTIO call for class
	variables, if no typebound DTIO procedure is available.

2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78848
	* gfortran.dg/dtio_22.f90: New test.

From-SVN: r243784
2016-12-18 14:22:13 +01:00
Janus Weil 413e859cdf re PR fortran/78592 (ICE in gfc_find_specific_dtio_proc, at fortran/interface.c:4939)
2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78592
	* interfac.c (gfc_find_specific_dtio_proc): Fixup for r243005, making
	sure that the generic list is followed through until the end.

2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78592
	* gfortran.dg/dtio_21.f90: New test.

From-SVN: r243783
2016-12-18 12:03:41 +01:00
Thomas Koenig 63ac625170 re PR fortran/78239 (ICE in char_len_param_value, at fortran/decl.c:926, with -fimplicit-none)
2016-12-17  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78239
	* decl.c (char_len_param_value):  Actually commit
	previous change.

From-SVN: r243776
2016-12-17 17:03:49 +00:00
Thomas Koenig 52fd48aeea re PR fortran/78239 (ICE in char_len_param_value, at fortran/decl.c:926, with -fimplicit-none)
2016-12-17  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78239
	* decl.c(char_len_param_value): Also check for -fimplicit-none
	when determining if implicit none is in force.

2016-12-17  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78239
	* gfortran.dg/fimplicit_none_1.f90:  New test.
	* gfortran.dg/fimplicit_none_2.f90:  New test.

From-SVN: r243773
2016-12-17 11:13:16 +00:00
Jerry DeLisle 5cdc4b0ef0 re PR fortran/78662 ([F03] Incorrect parsing of quotes in the char-literal-constant of the DT data descriptor)
2016-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/78622
	* io.c (format_lex): Continue of string delimiter seen.

	* io/transfer.c (get_dt_format): New static function to alloc
	and set the DT iotype string, handling doubled quotes.
	(formatted_transfer_scalar_read,
	formatted_transfer_scalar_write): Use new function.

	* gfortran.dg/dtio_20.f03: New test.

From-SVN: r243765
2016-12-16 20:27:51 +00:00
Jakub Jelinek c2d42d1619 re PR fortran/78757 (ICE with function returning a pointer to a character)
PR fortran/78757
	* trans-expr.c (gfc_conv_procedure_call): Emit DECL_EXPR for the
	type pstr var points to.

	* gfortran.dg/char_result_16.f90: New test.

From-SVN: r243761
2016-12-16 20:41:13 +01:00
Janus Weil f3e1097bc6 re PR fortran/78798 ([cleanup] some int-valued functions should be bool)
2016-12-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78798
	* gfortran.h (gfc_compare_derived_types,gfc_compare_types,
	gfc_compare_interfaces,gfc_has_vector_subscript): Return bool instead
	of int.
	* interface.c (compare_components): Ditto.
	(gfc_compare_union_types): Rename to compare_union_types, declare as
	static, return bool.
	(gfc_compare_derived_types): Return bool instead of int.
	(gfc_compare_types): Ditto.
	(compare_type): Ditto.
	(compare_rank): Ditto.
	(compare_type_rank): Ditto.
	(compare_type_rank_if): Ditto.
	(count_types_test): Ditto.
	(generic_correspondence): Ditto.
	(gfc_compare_interfaces): Ditto.
	(check_interface0): Ditto.
	(check_interface1): Ditto.
	(compare_allocatable): Ditto.
	(compare_parameter): Ditto.
	(gfc_has_vector_subscript): Ditto.
	(compare_actual_formal): Ditto.

From-SVN: r243726
2016-12-15 21:54:18 +01:00
Janus Weil fec5ce2485 re PR fortran/78800 ([OOP] ICE in compare_parameter, at fortran/interface.c:2246)
2016-12-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78800
	* interface.c (compare_allocatable): Avoid additional errors on bad
	class declarations.
	(compare_parameter): Put the result of gfc_expr_attr into a variable,
	in order to avoid calling it multiple times. Exit early on bad class
	declarations to avoid ICE.

2016-12-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78800
	* gfortran.dg/unlimited_polymorphic_27.f90: New test case.

From-SVN: r243691
2016-12-15 15:07:51 +01:00
Martin Jambor 629b3d75c8 Split omp-low into multiple files
2016-12-14  Martin Jambor  <mjambor@suse.cz>

	* omp-general.h: New file.
	* omp-general.c: New file.
	* omp-expand.h: Likewise.
	* omp-expand.c: Likewise.
	* omp-offload.h: Likewise.
	* omp-offload.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-low.h: Include omp-general.h and omp-grid.h.  Removed includes
	of params.h, symbol-summary.h, lto-section-names.h, cilk.h, tree-eh.h,
	ipa-prop.h, tree-cfgcleanup.h, cfgloop.h, except.h, expr.h, stmt.h,
	varasm.h, calls.h, explow.h, dojump.h, flags.h, tree-into-ssa.h,
	tree-cfg.h, cfganal.h, alias.h, emit-rtl.h, optabs.h, expmed.h,
	alloc-pool.h, cfghooks.h, rtl.h and memmodel.h.
	(omp_find_combined_for): Declare.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.h.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.h.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.h.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.h.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.h.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.h.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.h.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(omp_expand_local): Moved to omp-expand.h.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.h.
	(omp_finish_file): Moved to omp-offload.h.
	(default_goacc_validate_dims): Renamed to
	oacc_default_goacc_validate_dims and moved to omp-offload.h.
	(offload_funcs, offload_vars): Moved to omp-offload.h.
	* omp-low.c: Include omp-general.h, omp-offload.h and omp-grid.h.
	(omp_region): Moved to omp-expand.c.
	(omp_for_data_loop): Moved to omp-general.h.
	(omp_for_data): Likewise.
	(oacc_loop): Moved to omp-offload.c.
	(oacc_loop_flags): Moved to omp-general.h.
	(offload_funcs, offload_vars): Moved to omp-offload.c.
	(root_omp_region): Moved to omp-expand.c.
	(omp_any_child_fn_dumped): Likewise.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.c.
	(is_combined_parallel): Moved to omp-expand.c.
	(is_reference): Renamed to omp_is_reference and and moved to
	omp-general.c.
	(adjust_for_condition): Renamed to omp_adjust_for_condition and moved
	to omp-general.c.
	(get_omp_for_step_from_incr): Renamed to omp_get_for_step_from_incr
	and moved to omp-general.c.
	(extract_omp_for_data): Renamed to omp_extract_for_data and moved to
	omp-general.c.
	(workshare_safe_to_combine_p): Moved to omp-expand.c.
	(omp_adjust_chunk_size): Likewise.
	(get_ws_args_for): Likewise.
	(get_base_type): Removed.
	(dump_omp_region): Moved to omp-expand.c.
	(debug_omp_region): Likewise.
	(debug_all_omp_regions): Likewise.
	(new_omp_region): Likewise.
	(free_omp_region_1): Likewise.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.c.
	(find_combined_for): Renamed to omp_find_combined_for, made global.
	(build_omp_barrier): Renamed to omp_build_barrier and moved to
	omp-general.c.
	(omp_max_vf): Moved to omp-general.c.
	(omp_max_simt_vf): Likewise.
	(gimple_build_cond_empty): Moved to omp-expand.c.
	(parallel_needs_hsa_kernel_p): Likewise.
	(expand_omp_build_assign): Moved declaration to omp-expand.c.
	(expand_parallel_call): Moved to omp-expand.c.
	(expand_cilk_for_call): Likewise.
	(expand_task_call): Likewise.
	(vec2chain): Likewise.
	(remove_exit_barrier): Likewise.
	(remove_exit_barriers): Likewise.
	(optimize_omp_library_calls): Likewise.
	(expand_omp_regimplify_p): Likewise.
	(expand_omp_build_assign): Likewise.
	(expand_omp_taskreg): Likewise.
	(oacc_collapse): Likewise.
	(expand_oacc_collapse_init): Likewise.
	(expand_oacc_collapse_vars): Likewise.
	(expand_omp_for_init_counts): Likewise.
	(expand_omp_for_init_vars): Likewise.
	(extract_omp_for_update_vars): Likewise.
	(expand_omp_ordered_source): Likewise.
	(expand_omp_ordered_sink): Likewise.
	(expand_omp_ordered_source_sink): Likewise.
	(expand_omp_for_ordered_loops): Likewise.
	(expand_omp_for_generic): Likewise.
	(expand_omp_for_static_nochunk): Likewise.
	(find_phi_with_arg_on_edge): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	(expand_cilk_for): Likewise.
	(expand_omp_simd): Likewise.
	(expand_omp_taskloop_for_outer): Likewise.
	(expand_omp_taskloop_for_inner): Likewise.
	(expand_oacc_for): Likewise.
	(expand_omp_for): Likewise.
	(expand_omp_sections): Likewise.
	(expand_omp_single): Likewise.
	(expand_omp_synch): Likewise.
	(expand_omp_atomic_load): Likewise.
	(expand_omp_atomic_store): Likewise.
	(expand_omp_atomic_fetch_op): Likewise.
	(expand_omp_atomic_pipeline): Likewise.
	(expand_omp_atomic_mutex): Likewise.
	(expand_omp_atomic): Likewise.
	(oacc_launch_pack): and moved to omp-general.c, made public.
	(OACC_FN_ATTRIB): Likewise.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.c.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.c.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.c.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.c.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.c.
	(oacc_fn_attrib_level): Moved to omp-offload.c.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(get_oacc_ifn_dim_arg): Renamed to oacc_get_ifn_dim_arg and moved to
	omp-general.c.
	(mark_loops_in_oacc_kernels_region): Moved to omp-expand.c.
	(grid_launch_attributes_trees): Likewise.
	(grid_attr_trees): Likewise.
	(grid_create_kernel_launch_attr_types): Likewise.
	(grid_insert_store_range_dim): Likewise.
	(grid_get_kernel_launch_attributes): Likewise.
	(get_target_argument_identifier_1): Likewise.
	(get_target_argument_identifier): Likewise.
	(get_target_argument_value): Likewise.
	(push_target_argument_according_to_value): Likewise.
	(get_target_arguments): Likewise.
	(expand_omp_target): Likewise.
	(grid_expand_omp_for_loop): Moved to omp-grid.c.
	(grid_arg_decl_map): Likewise.
	(grid_remap_kernel_arg_accesses): Likewise.
	(grid_expand_target_grid_body): Likewise.
	(expand_omp): Renamed to omp_expand and moved to omp-expand.c.
	(build_omp_regions_1): Moved to omp-expand.c.
	(build_omp_regions_root): Likewise.
	(omp_expand_local): Likewise.
	(build_omp_regions): Likewise.
	(execute_expand_omp): Likewise.
	(pass_data_expand_omp): Likewise.
	(pass_expand_omp): Likewise.
	(make_pass_expand_omp): Likewise.
	(pass_data_expand_omp_ssa): Likewise.
	(pass_expand_omp_ssa): Likewise.
	(make_pass_expand_omp_ssa): Likewise.
	(grid_lastprivate_predicate): Renamed to
	omp_grid_lastprivate_predicate and moved to omp-grid.c, made public.
	(grid_prop): Moved to omp-grid.c.
	(GRID_MISSED_MSG_PREFIX): Likewise.
	(grid_safe_assignment_p): Likewise.
	(grid_seq_only_contains_local_assignments): Likewise.
	(grid_find_single_omp_among_assignments_1): Likewise.
	(grid_find_single_omp_among_assignments): Likewise.
	(grid_find_ungridifiable_statement): Likewise.
	(grid_parallel_clauses_gridifiable): Likewise.
	(grid_inner_loop_gridifiable_p): Likewise.
	(grid_dist_follows_simple_pattern): Likewise.
	(grid_gfor_follows_tiling_pattern): Likewise.
	(grid_call_permissible_in_distribute_p): Likewise.
	(grid_handle_call_in_distribute): Likewise.
	(grid_dist_follows_tiling_pattern): Likewise.
	(grid_target_follows_gridifiable_pattern): Likewise.
	(grid_remap_prebody_decls): Likewise.
	(grid_var_segment): Likewise.
	(grid_mark_variable_segment): Likewise.
	(grid_copy_leading_local_assignments): Likewise.
	(grid_process_grid_body): Likewise.
	(grid_eliminate_combined_simd_part): Likewise.
	(grid_mark_tiling_loops): Likewise.
	(grid_mark_tiling_parallels_and_loops): Likewise.
	(grid_process_kernel_body_copy): Likewise.
	(grid_attempt_target_gridification): Likewise.
	(grid_gridify_all_targets_stmt): Likewise.
	(grid_gridify_all_targets): Renamed to omp_grid_gridify_all_targets
	and moved to omp-grid.c, made public.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.c.
	(add_decls_addresses_to_decl_constructor): Moved to omp-offload.c.
	(omp_finish_file): Likewise.
	(oacc_thread_numbers): Likewise.
	(oacc_xform_loop): Likewise.
	(oacc_default_dims, oacc_min_dims): Likewise.
	(oacc_parse_default_dims): Likewise.
	(oacc_validate_dims): Likewise.
	(new_oacc_loop_raw): Likewise.
	(new_oacc_loop_outer): Likewise.
	(new_oacc_loop): Likewise.
	(new_oacc_loop_routine): Likewise.
	(finish_oacc_loop): Likewise.
	(free_oacc_loop): Likewise.
	(dump_oacc_loop_part): Likewise.
	(dump_oacc_loop): Likewise.
	(debug_oacc_loop): Likewise.
	(oacc_loop_discover_walk): Likewise.
	(oacc_loop_sibling_nreverse): Likewise.
	(oacc_loop_discovery): Likewise.
	(oacc_loop_xform_head_tail): Likewise.
	(oacc_loop_xform_loop): Likewise.
	(oacc_loop_process): Likewise.
	(oacc_loop_fixed_partitions): Likewise.
	(oacc_loop_auto_partitions): Likewise.
	(oacc_loop_partition): Likewise.
	(default_goacc_fork_join): Likewise.
	(default_goacc_reduction): Likewise.
	(execute_oacc_device_lower): Likewise.
	(default_goacc_validate_dims): Likewise.
	(default_goacc_dim_limit): Likewise.
	(pass_data_oacc_device_lower): Likewise.
	(pass_oacc_device_lower): Likewise.
	(make_pass_oacc_device_lower): Likewise.
	(execute_omp_device_lower): Likewise.
	(pass_data_omp_device_lower): Likewise.
	(pass_omp_device_lower): Likewise.
	(make_pass_omp_device_lower): Likewise.
	(pass_data_omp_target_link): Likewise.
	(pass_omp_target_link): Likewise.
	(find_link_var_op): Likewise.
	(pass_omp_target_link::execute): Likewise.
	(make_pass_omp_target_link): Likewise.

	* Makefile.in (OBJS): Added omp-offload.o, omp-expand.o, omp-general.o
	and omp-grid.o.
	(GTFILES): Added omp-offload.h, omp-offload.c and omp-expand.c, removed
	omp-low.h.
	* gimple-fold.c: Include omp-general.h instead of omp-low.h.
	(fold_internal_goacc_dim): Adjusted calls to
	get_oacc_ifn_dim_arg and get_oacc_fn_dim_size to use their new names.
	* gimplify.c: Include omp-low.h.
	(omp_notice_variable): Adjust the call to get_oacc_fn_attrib to use
	its new name.
	(gimplify_omp_task): Adjusted calls to find_omp_clause to use its new
	name.
	(gimplify_omp_for): Likewise.
	* lto-cgraph.c: Include omp-offload.h instead of omp-low.h.
	* toplev.c: Include omp-offload.h instead of omp-low.h.
	* tree-cfg.c: Include omp-general.h instead of omp-low.h.  Also
	include omp-expand.h.
	(make_edges_bb): Adjusted the call to make_gimple_omp_edges to use its
	new name.
	(make_edges): Adjust the call to free_omp_regions to use its new name.
	* tree-parloops.c: Include omp-general.h.
	(create_parallel_loop): Adjusted the call to set_oacc_fn_attrib to use
	its new name.
	(parallelize_loops): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-ssa-loop.c: Include omp-general.h instead of omp-low.h.
	(gate_oacc_kernels): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-vrp.c: Include omp-general.h instead of omp-low.h.
	(extract_range_basic): Adjusted calls to get_oacc_ifn_dim_arg and
	get_oacc_fn_dim_size to use their new names.
	* varpool.c: Include omp-offload.h instead of omp-low.h.
	* gengtype.c (open_base_files): Replace omp-low.h with omp-offload.h in
	ifiles.
	* config/nvptx/nvptx.c: Include omp-general.c.
	(nvptx_expand_call): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	(nvptx_reorg): Likewise.
	(nvptx_record_offload_symbol): Likewise.

gcc/c-family:
	* c-omp.c: Include omp-general.h instead of omp-low.h.
	(c_finish_oacc_wait): Adjusted call to find_omp_clause to use its new
	name.

gcc/c/
	* c-parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(c_finish_oacc_routine): Adjusted call to
	get_oacc_fn_attrib, build_oacc_routine_dims and replace_oacc_fn_attrib
	to use their new names.
	(c_parser_oacc_enter_exit_data): Adjusted call to find_omp_clause to
	use its new name.
	(c_parser_oacc_update): Likewise.
	(c_parser_omp_simd): Likewise.
	(c_parser_omp_target_update): Likewise.
	* c-typeck.c: Include omp-general.h instead of omp-low.h.
	(c_finish_omp_cancel): Adjusted call to find_omp_clause to use its new
	name.
	(c_finish_omp_cancellation_point): Likewise.
	* gimple-parser.c: Do not include omp-low.h

gcc/cp/
	* parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(cp_parser_omp_simd): Adjusted calls to find_omp_clause to use its new
	name.
	(cp_parser_omp_target_update): Likewise.
	(cp_parser_oacc_declare): Likewise.
	(cp_parser_oacc_enter_exit_data): Likewise.
	(cp_parser_oacc_update): Likewise.
	(cp_finalize_oacc_routine): Adjusted call to get_oacc_fn_attrib,
	build_oacc_routine_dims and replace_oacc_fn_attrib to use their new
	names.
	* semantics.c: Include omp-general insteda of omp-low.h.
	(finish_omp_for): Adjusted calls to find_omp_clause to use its new
	name.
	(finish_omp_cancel): Likewise.
	(finish_omp_cancellation_point): Likewise.

fortran/
	* trans-openmp.c: Include omp-general.h.

From-SVN: r243673
2016-12-14 23:30:41 +01:00
Andre Vehreschild 8c92e4522d re PR fortran/78780 ([Coarray] ICE in conv_caf_send, at fortran/trans-intrinsic.c:1936)
gcc/testsuite/ChangeLog:

2016-12-14  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78780
	* gfortran.dg/coarray/alloc_comp_5.f90: New test.
	* gfortran.dg/coarray_42.f90: New test.


gcc/fortran/ChangeLog:

2016-12-14  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78780
	* trans-expr.c (gfc_trans_assignment_1): Improve check whether detour
	caf-runtime routines is needed.

From-SVN: r243648
2016-12-14 13:49:45 +01:00
Andre Vehreschild eb401400f5 re PR fortran/78672 (Gfortran test suite failures with a sanitized compiler)
gcc/fortran/ChangeLog:

2016-12-14  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78672
	* array.c (gfc_find_array_ref): Add flag to return NULL when no ref is
	found instead of erroring out.
	* data.c (gfc_assign_data_value): Only constant expressions are valid
	for initializers.
	* gfortran.h: Reflect change of gfc_find_array_ref's signature.
	* interface.c (compare_actual_formal): Access the non-elemental
	array-ref.  Prevent taking a REF_COMPONENT for a REF_ARRAY.  Correct
	indentation.
	* module.c (load_omp_udrs): Clear typespec before reading into it.
	* trans-decl.c (gfc_build_qualified_array): Prevent accessing the array
	when it is a coarray.
	* trans-expr.c (gfc_conv_cst_int_power): Use wi::abs()-function instead
	of crutch preventing sanitizer's bickering here.
	* trans-stmt.c (gfc_trans_deallocate): Only get data-component when it
	is a descriptor-array here.

From-SVN: r243647
2016-12-14 12:52:09 +01:00
Janus Weil 7a28353e36 re PR fortran/78798 ([cleanup] some int-valued functions should be bool)
2016-12-13  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78798
	* gfortran.h (gfc_is_constant_expr, gfc_is_formal_arg,
	gfc_is_compile_time_shape): Return bool instead of int.
	* array.c (gfc_is_compile_time_shape): Ditto.
	* expr.c (gfc_is_constant_expr): Ditto.
	* resolve.c (gfc_is_formal_arg): Ditto. Make formal_arg_flag bool.

From-SVN: r243621
2016-12-13 19:55:20 +01:00
Andre Vehreschild 6479f45b31 re PR fortran/77785 ([Coarray] ICE in gfc_get_caf_token_offset, at fortran/trans-expr.c:1990)
gcc/fortran/ChangeLog:

2016-12-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/77785
	* resolve.c (resolve_symbol): Correct attr lookup to the _data
	component.
	* trans-array.c (gfc_alloc_allocatable_for_assignment): Indirect ref
	pointers and references before retrieving the caf-token.

gcc/testsuite/ChangeLog:

2016-12-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/77785
	* gfortran.dg/coarray_38.f90: Added expecting error message.
	* gfortran.dg/coarray_41.f90: New test.
	* gfortran.dg/coarray_class_2.f90: New test.

From-SVN: r243614
2016-12-13 17:47:48 +01:00
Janus Weil e4e659b947 re PR fortran/78737 ([OOP] linking error with deferred, undefined user-defined derived-type I/O)
2016-12-13  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78737
	* gfortran.h (gfc_find_typebound_dtio_proc): New prototype.
	* interface.c (gfc_compare_interfaces): Whitespace fix.
	(gfc_find_typebound_dtio_proc): New function.
	(gfc_find_specific_dtio_proc): Use it. Improve error recovery.
	* trans-io.c (get_dtio_proc): Implement polymorphic calls to DTIO
	procedures.

2016-12-13  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78737
	* gfortran.dg/dtio_19.f90: New test case.

Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>

From-SVN: r243609
2016-12-13 15:28:17 +01:00
Janus Weil 068b961b6a re PR fortran/78392 (ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:5979)
2016-12-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78392
	* expr.c (gfc_is_constant_expr): Specification functions are not
	compile-time constants. Update documentation (add reference to F08
	standard), add a FIXME.
	(external_spec_function): Add reference to F08 standard.
	* resolve.c (resolve_fl_variable): Ditto.

2016-12-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78392
	* gfortran.dg/constant_shape.f90: New test case.

From-SVN: r243580
2016-12-12 19:54:54 +01:00
Thomas Koenig be841e112b re PR fortran/78226 (Fill out location information everywhere)
2016-12-10  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78226
	* error.c (gfc_warning_internal):  New function.
	* frontend-passes.c (gfc_run_passes):  Call check_locus if
	CHECKING_P is defined.
	(check_locus_code):  New function.
	(check_locus_expr):  New function.
	(check_locus):  New function.
	* gfortran.h:  Add prototype for gfc_warning_internal.

From-SVN: r243520
2016-12-10 22:28:32 +00:00
Paul Thomas c3879be19f re PR fortran/78350 (ICE in gfc_code2string(): Bad code, at fortran/misc.c:193)
2016-12-10 Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78350
	* resolve.c (resolve_structure_cons): Remove the block that
	tried to remove a charlen and rely on namespace cleanup.

From-SVN: r243517
2016-12-10 18:35:47 +00:00
Paul Thomas c064374dc4 re PR fortran/77903 ([F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces)
2016-12-09  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/77903
	* decl.c (get_proc_name): Use the symbol tlink field instead of
	the typespec interface field.
	(gfc_match_function_decl, gfc_match_submod_proc): Ditto.
	* gfortran.h : Since the symbol tlink field is no longer used
	by the frontend for change management, change the comment to
	reflect its current uses.
	* parse.c (get_modproc_result): Same as decl.c changes.
	* resolve.c (resolve_fl_procedure): Ditto.

2016-12-09  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/77903
	* gfortran.dg/submodule_20.f08: New test.

From-SVN: r243507
2016-12-09 22:25:26 +00:00
Janus Weil cdeb16cbf2 re PR fortran/61767 ([OOP] ICE in generate_finalization_wrapper at fortran/class.c:1491)
2016-12-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/61767
	* class.c (has_finalizer_component): Fix this function to detect only
	non-pointer non-allocatable components which have a finalizer.

2016-12-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/61767
	* gfortran.dg/finalize_31.f90: New test.

From-SVN: r243483
2016-12-09 14:21:44 +01:00
Andre Vehreschild ffaf9305aa re PR fortran/78505 ([F08] Coarray source allocation not synchronizing on oversubscribed cores)
gcc/fortran/ChangeLog:

2016-12-09  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78505
	* trans-stmt.c (gfc_trans_allocate): Add sync all after the execution
	of the whole allocate-statement to adhere to the standard.

gcc/testsuite/ChangeLog:

2016-12-09  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78505
	* gfortran.dg/coarray_alloc_with_implicit_sync_1.f90: New test.

From-SVN: r243482
2016-12-09 13:46:57 +01:00
Andre Vehreschild 39da58667d trans-array.c (gfc_array_deallocate): Remove wrapper.
gcc/fortran/ChangeLog:

2016-12-09  Andre Vehreschild  <vehre@gcc.gnu.org>

	* trans-array.c (gfc_array_deallocate): Remove wrapper.
	(gfc_trans_dealloc_allocated): Same.
	(structure_alloc_comps): Restructure deallocation of (nested)
	allocatable components.  Insert dealloc of sub-component into the block
	guarded by the if != NULL for the component.
	(gfc_trans_deferred_array): Use the almightly deallocate_with_status.
	* trans-array.h: Remove prototypes.
	* trans-expr.c (gfc_conv_procedure_call): Use the almighty deallocate_
	with_status.
	* trans-openmp.c (gfc_walk_alloc_comps): Likewise.
	(gfc_omp_clause_assign_op): Likewise. 
	(gfc_omp_clause_dtor): Likewise.
	* trans-stmt.c (gfc_trans_deallocate): Likewise.
	* trans.c (gfc_deallocate_with_status): Allow deallocation of scalar
	and arrays as well as coarrays.
	(gfc_deallocate_scalar_with_status): Get the data member for coarrays
	only when freeing an array with descriptor.  And set correct caf_mode
	when freeing components of coarrays.
	* trans.h: Change prototype of gfc_deallocate_with_status to allow
	adding statements into the block guarded by the if (pointer != 0) and
	supply a coarray handle.

gcc/testsuite/ChangeLog:

2016-12-09  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/coarray_alloc_comp_3.f08: New test.
	* gfortran.dg/coarray_alloc_comp_4.f08: New test.
	* gfortran.dg/finalize_18.f90: Add count for additional guard against
	accessing null-pointer.
	* gfortran.dg/proc_ptr_comp_47.f90: New test.

From-SVN: r243480
2016-12-09 13:32:50 +01:00
Paul Thomas 345bd7ebbb re PR fortran/44265 (Link error with reference to parameter array in specification expression)
2016-12-09  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/44265
	* gfortran.h : Add fn_result_spec bitfield to gfc_symbol.
	* resolve.c (flag_fn_result_spec): New function.
	(resolve_fntype): Call it for character result lengths.
	* symbol.c (gfc_new_symbol): Set fn_result_spec to zero.
	* trans-decl.c (gfc_sym_mangled_identifier): Include the
	procedure name in the mangled name for symbols with the
	fn_result_spec bit set.
	(gfc_finish_var_decl): Mark the decls of these symbols
	appropriately for the case where the function is external.
	(gfc_get_symbol_decl): Mangle the name of these symbols.
	(gfc_create_module_variable): Allow them through the assert.
	(gfc_generate_function_code): Remove the assert before the
	initialization of sym->tlink because the frontend no longer
	uses this field.
	* trans-expr.c (gfc_map_intrinsic_function): Add a case to
	treat the LEN_TRIM intrinsic.
	(gfc_trans_string_copy): Deal with Wstringop-overflow warning
	that can occur with constant source lengths at -O3.

2016-12-09  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/44265
	* gfortran.dg/char_result_14.f90: New test.
	* gfortran.dg/char_result_15.f90: New test.

From-SVN: r243478
2016-12-09 11:55:27 +00:00
Steven G. Kargl d0803c0cf8 re PR fortran/65173 (ICE while compiling wrong code)
2016-12-07  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/65173
	PR fortran/69064
	PR fortran/69859
	PR fortran/78350
	* gfortran.h (gfc_namespace): Remove old_cl_list member.
	* parse.c (use_modules, next_statement): old_cl_list is gone.
	(clear_default_charlen): Remove no longer used function.
	(reject_statement): Do not try ot clean up gfc_charlen structure(s)
	that may have been added to a cl_list list.
	* symbol.c (gfc_new_charlen): old_cl_list structure is gone.

2016-12-07  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/65173
	PR fortran/69064
	PR fortran/69859
	PR fortran/78350
	* gfortran.dg/misplaced_implicit_character.f90: Adjust errors.
	* gfortran.dg/charlen_01.f90: New test.
	* gfortran.dg/charlen_02.f90: Ditto.
	* gfortran.dg/charlen_03.f90: Ditto.
	* gfortran.dg/charlen_04.f90: Ditto.
	* gfortran.dg/charlen_05.f90: Ditto.
	* gfortran.dg/charlen_06.f90: Ditto.
	* gfortran.dg/charlen_07.f90: Ditto.
	* gfortran.dg/charlen_08.f90: Ditto.
	* gfortran.dg/charlen_09.f90: Ditto.
	* gfortran.dg/charlen_10.f90: Ditto.
	* gfortran.dg/charlen_11.f90: Ditto.
	* gfortran.dg/charlen_12.f90: Ditto.
	* gfortran.dg/charlen_13.f90: Ditto.
	* gfortran.dg/charlen_14.f90: Ditto.
	* gfortran.dg/charlen_15.f90: Ditto.
	* gfortran.dg/charlen_16.f90: Ditto.

From-SVN: r243463
2016-12-08 21:26:11 +00:00
Jerry DeLisle 34022d2b2e re PR fortran/78659 ([F03] Spurious "requires DTIO" reported against namelist statement)
2016-12-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/78659
	* resolve.c (resolve_fl_namelist): Remove unneeded error.
	PR fortran/78659
	* gfortran.dg/alloc_comp_constraint_1.f90: Update test.
	* gfortran.dg/alloc_comp_constraint_7.f90: New test.
	* gfortran.dg/namelist_34.f90: Update test.
	* gfortran.dg/namelist_63.f90: Update test.

From-SVN: r243308
2016-12-06 17:13:31 +00:00
Andre Vehreschild 1011502b46 re PR fortran/78226 (Fill out location information everywhere)
gcc/fortran/ChangeLog:

2016-12-06  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78226
	* class.c (finalize_component): Add missing locus information.
	(finalization_scalarizer): Likewise.
	(finalization_get_offset): Likewise.
	(finalizer_insert_packed_call): Likewise.
	(generate_finalization_wrapper): Likewise.

From-SVN: r243300
2016-12-06 14:41:46 +01:00
Nathan Sidwell d0ea9f0aa2 diagnostic.c (diagnostic_check_max_errors): New, broken out of ...
gcc/
	* diagnostic.c (diagnostic_check_max_errors): New, broken out of ...
	(diagnostic_action_after_output): ... here.
	(diagnostic_report_diagnostic): Call it for non-notes.
	* diagnostic.h (struct diagnostic_context): Make max_errors signed
	int.
	(diagnostic_check_max_errors): Declare.

	gcc/fortran/
	* error.c (gfc_warning_check): Call diagnostic_check_max_errors.
	(gfc_error_check): Likewise.

	gcc/testsuite/
	* c-c++-common/fmax_errors.c: Check notes after last error are
	emitted.

From-SVN: r243254
2016-12-05 12:24:39 +00:00
Janus Weil aa7cfe4057 re PR fortran/78618 (ICE in gfc_check_rank, at fortran/check.c:3670)
2016-12-04  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78618
	* intrinsic.c (gfc_convert_type_warn): Do not set the full typespec for
	the conversion symbol, but only type and kind. Set the full typespec
	for the expression.
	(gfc_convert_chartype): Ditto.

From-SVN: r243232
2016-12-04 21:31:26 +01:00
Janus Weil 4ceda20498 re PR fortran/43207 ([OOP] invalid (pointer) assignment to and from abstract non-polymorphic expressions)
2016-12-03  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/43207
	* primary.c (gfc_match_varspec): Reject nonpolymorphic references to
	abstract types.

2016-12-03  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/43207
	* gfortran.dg/abstract_type_9.f90: New test case.

From-SVN: r243224
2016-12-03 19:48:48 +01:00
Janus Weil 20fee4a901 re PR fortran/42188 ([OOP] F03:C612. The leftmost part-name shall be the name of a data object.)
2016-12-03  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42188
	* primary.c (gfc_match_rvalue): Add a new check that gives better error
	messages.

2016-12-03  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42188
	* gfortran.dg/derived_result_2.f90.f90: New test case.

From-SVN: r243223
2016-12-03 19:37:57 +01:00