Martin Liska [Mon, 11 Mar 2019 11:18:08 +0000 (12:18 +0100)]
Backport r268789
2019-03-11 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-02-11 David Malcolm <dmalcolm@redhat.com>
PR lto/88147
* input.c (selftest::test_line_offset_overflow): New selftest.
(selftest::input_c_tests): Call it.
2019-03-11 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-02-11 Martin Liska <mliska@suse.cz>
PR lto/88147
* line-map.c (linemap_line_start): Don't reuse the existing line
map if the line offset is sufficiently large to cause overflow
when computing location_t values.
Thomas Koenig [Sun, 10 Mar 2019 11:26:25 +0000 (11:26 +0000)]
re PR fortran/71544 (gfortran compiler optimization bug when dealing with c-style pointers)
2019-03-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71544
Backport from trunk
* trans-types.c (gfc_typenode_for_spec) Set ts->is_c_interop of
C_PTR and C_FUNPTR.
(create_fn_spec): Mark argument as escaping if ts->is_c_interop is set.
2019-03-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71544
Backport from trunk
* gfortran.dg/c_ptr_tests_19.f90: New test.
Thomas Koenig [Sun, 10 Mar 2019 11:09:30 +0000 (11:09 +0000)]
re PR fortran/87734 (ICE in is_illegal_recursion check for character len= parameter)
2019-03-10 Thomas Koenig <tkoenig@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/87734
Backort from trunk
* symbol.c (gfc_add_procedure): Only throw an error if the
procedure has not been declared either PUBLIC or PRIVATE.
* resolve.c (is_illegal_recursion): Remove an assert().
2019-03-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/87734
Backport from trunk
* gfortran.dg/public_private_module_10.f90: New test.
Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r269550
Thomas Koenig [Sun, 3 Mar 2019 09:20:09 +0000 (09:20 +0000)]
re PR fortran/87689 (PowerPC64 ELFv2 function parameter passing violation)
2019-03-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/87689
Backport from trunk
* trans-decl.c (gfc_get_extern_function_decl): Add argument
actual_args and pass it through to gfc_get_function_type.
* trans-expr.c (conv_function_val): Add argument actual_args
and pass it on to gfc_get_extern_function_decl.
(conv_procedure_call): Pass actual arguments to conv_function_val.
* trans-types.c (get_formal_from_actual_arglist): New function.
(gfc_get_function_type): Add argument actual_args. Generate
formal args from actual args if necessary.
* trans-types.h (gfc_get_function_type): Add optional argument.
* trans.h (gfc_get_extern_function_decl): Add optional argument.
2019-03-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/87689
Backport from trunk
* gfortran.dg/lto/20091028-1_0.f90: Add -Wno-lto-type-mismatch to
options.
* gfortran.dg/lto/20091028-2_0.f90: Likewise.
* gfortran.dg/lto/pr87689_0.f: New file.
* gfortran.dg/lto/pr87689_1.f: New file.
* gfortran.dg/altreturn_9_0.f90: New file.
* gfortran.dg/altreturn_9_1.f90: New file.
Eric Botcazou [Tue, 26 Feb 2019 08:12:21 +0000 (08:12 +0000)]
re PR ada/81956 (call to null procedure not optimized away)
PR ada/81956
Backport from mainline
2017-09-06 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Expand_Call_Helper): Do not optimize calls to
null procedures when GNAT coverage is used, so that their (empty)
bodies are properly covered.
2017-09-06 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Expand_Call_Helper): Replace call to null
procedure by a single null statement, after evaluating the
actuals that require it.
Thomas Koenig [Sat, 23 Feb 2019 11:49:47 +0000 (11:49 +0000)]
re PR fortran/71066 (ICE in set_loop_bounds, at fortran/trans-array.c:4680)
2019-02-23 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71066
Backport from trunk
* trans-decl.c (generate_coarray_sym_init): For an array
constructor in a DATA statement of a coarray variable, set the
rank to 1 to avoid confusion later on. If the constructor
contains only one value, use that for initiailizig.
2019-02-23 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71066
Backport from trunk
* gfortran.dg/coarray_data_1.f90: New test.
Eric Botcazou [Sat, 23 Feb 2019 10:04:41 +0000 (10:04 +0000)]
re PR ada/89349 (segfault when building GCC 7 & 8 branch with GCC master)
PR ada/89349
Backport from mainline
2018-05-25 Arnaud Charlet <charlet@adacore.com>
* osint.ads (Unknown_Attributes): No longer pretend this is a constant.
(No_File_Info_Cache): Initialize separately.
* osint.adb (No_File_Info_Cache): Update initializer.
Jonathan Wakely [Sat, 23 Feb 2019 01:01:56 +0000 (01:01 +0000)]
PR libstdc++/89446 fix null pointer dereference in char_traits
PR libstdc++/89446
* include/bits/char_traits.h (__constant_char_array): Check index is
in range before dereferencing.
* testsuite/21_strings/basic_string_view/operators/char/89446.cc:
New test.
Martin Liska [Fri, 15 Feb 2019 10:59:02 +0000 (11:59 +0100)]
Backport r268873
2019-02-15 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-02-14 Martin Liska <mliska@suse.cz>
PR rtl-optimization/89242
* dce.c (delete_unmarked_insns): Call free_dominance_info we
process a transformation.
2019-02-15 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-02-14 Martin Liska <mliska@suse.cz>
PR rtl-optimization/89242
* g++.dg/pr89242.C: New test.
Thomas Koenig [Sun, 10 Feb 2019 18:41:03 +0000 (18:41 +0000)]
re PR fortran/71723 ([F08] ICE on invalid pointer initialization)
2019-02-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71723
Backport from trunk
* expr.c (gfc_check_assign): Add argument is_init_expr. If we are
looking at an init expression, issue error if the target is not a
TARGET and we are not looking at a procedure pointer.
* gfortran.h (gfc_check_assign): Add optional argument
is_init_expr.
2019-02-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71723
Backport from trunk
* gfortran.dg/pointer_init_2.f90: Adjust error messages.
* gfortran.dg/pointer_init_6.f90: Likewise.
* gfortran.dg/pointer_init_9.f90: New test.
Eric Botcazou [Fri, 8 Feb 2019 11:08:07 +0000 (11:08 +0000)]
trans.c (Regular_Loop_to_gnu): Replace tests on individual flag_unswitch_loops and flag_tree_loop_vectorize...
* gcc-interface/trans.c (Regular_Loop_to_gnu): Replace tests on
individual flag_unswitch_loops and flag_tree_loop_vectorize switches
with test on global optimize switch.
(Raise_Error_to_gnu): Likewise.
Eric Botcazou [Wed, 6 Feb 2019 23:28:34 +0000 (23:28 +0000)]
backport: decl.c (annotate_value): Tidy up.
Backport from mainline
2017-09-05 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (annotate_value): Tidy up.
<INTEGER_CST>: Set TCODE instead of recursing.
<COMPONENT_REF>: Set TCODE instead of calling Create_Node manually.
<MULT_EXPR, PLUS_EXPR>: Fold conversions into inner operations.
<BIT_AND_EXPR>: Adjust.
<CALL_EXPR>: Do not fall through.
Kelvin Nilsen [Wed, 6 Feb 2019 21:35:44 +0000 (21:35 +0000)]
backport: rs6000-c.c (altivec-resolve_overloaded_builtin): Change handling of ALTIVEC_BUILTIN_VEC_EXTRACT.
gcc/ChangeLog:
2019-02-06 Kelvin Nilsen <kelvin@gcc.gnu.org>
Backport from mainline.
2019-01-30 Kelvin Nilsen <kelvin@gcc.gnu.org>
* config/rs6000/rs6000-c.c (altivec-resolve_overloaded_builtin):
Change handling of ALTIVEC_BUILTIN_VEC_EXTRACT. Coerce result to
type of vector element when vec_extract is implemented by direct
move.
Backport from mainline.
2019-01-30 Kelvin Nilsen <kelvin@gcc.gnu.org>
* gcc.target/powerpc/vec-extract-schar-1.c: New test.
* gcc.target/powerpc/vec-extract-sint-1.c: New test.
* gcc.target/powerpc/vec-extract-sint128-1.c: New test.
* gcc.target/powerpc/vec-extract-slong-1.c: New test.
* gcc.target/powerpc/vec-extract-sshort-1.c: New test.
* gcc.target/powerpc/vec-extract-uchar-1.c: New test.
* gcc.target/powerpc/vec-extract-uint-1.c: New test.
* gcc.target/powerpc/vec-extract-uint128-1.c: New test.
* gcc.target/powerpc/vec-extract-ulong-1.c: New test.
* gcc.target/powerpc/vec-extract-ushort-1.c: New test.
Thomas Koenig [Tue, 5 Feb 2019 21:23:07 +0000 (21:23 +0000)]
re PR fortran/67679 (-Wunitialized reports on compiler-generated variables)
2019-02-05 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/67679
Backport from trunk
* trans-array.c (gfc_array_allocate): For setting the bounds on
the new array, add a condition for a not previously allocated
variable.
2019-02-05 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/67679
Backport from trunk
* gfortran.dg/warn_undefined_1.f90: New test.
* gfortran.dg/coarray_lock_7.f90: Fix patterns in test.
Paul Thomas [Sun, 3 Feb 2019 18:23:25 +0000 (18:23 +0000)]
backport: re PR fortran/88393 ([OOP] Segfault with type-bound assignment)
2019-02-03 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
PR fortran/88393
* trans-expr.c (gfc_conv_procedure_call): For derived entities,
passed in parentheses to class formals, invert the order of
copying allocatable components to taking the _data of the
class expression.
2019-02-03 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
PR fortran/88393
* gfortran.dg/alloc_comp_assign_16.f03 : New test.
Thomas Koenig [Sat, 2 Feb 2019 17:07:40 +0000 (17:07 +0000)]
re PR fortran/88298 (Bogus conversion warning for CSHIFT with -fno-range-check -m64)
2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/88298
Backport from trunk
* arith.c (gfc_int2int): Do not warn if src->do_not_warn is set.
* gfortran.h (gfc_expr): Add flag do_not_warn.
* intrinsic.c (gfc_convert_type_warn): Set expr->do_not_warn if
no warning is desired.
2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/88298
Backport from trunk
* gfortran.dg/warn_conversion_10.f90: New test.
Thomas Koenig [Sat, 2 Feb 2019 16:57:39 +0000 (16:57 +0000)]
re PR fortran/57048 (Handling of C_PTR and C_FUNPTR leads to reject valid)
2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/57048
Backport from trunk
* interface.c (gfc_compare_types): If a derived type and an
integer both have a derived type, and they are identical,
this is a C binding type and compares equal.
2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/57048
Backport from trunk
* gfortran.dg/c_funptr_1.f90: New file.
* gfortran.dg/c_funptr_1_mod.f90: New file.
PR rtl-optimization/89115
* opts.c (default_options_optimization): Reduce
PARAM_MAX_DSE_ACTIVE_LOCAL_STORES by a factor of 10 at -O1.
Make PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP reduction relative
to the default.
Kewen Lin [Wed, 30 Jan 2019 08:18:05 +0000 (08:18 +0000)]
backport: [multiple changes]
2019-01-30 Kewen Lin <linkw@gcc.gnu.org>
Backport from mainline.
gcc/
2019-01-17 Kewen Lin <linkw@gcc.gnu.org>
* doc/extend.texi: Add four new prototypes for vec_ld and seven new
prototypes for vec_st.
* config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add entries
for scalar address type variants of altivec_vec_ld/altivec_vec_st,
mainly on signed/unsigned long long and double.
gcc/testsuite/
2019-01-20 Kewen Lin <linkw@gcc.gnu.org>
* gcc.target/powerpc/altivec_vld_vst_addr.c: Remove, split into
altivec_vld_vst_addr-1.c and altivec_vld_vst_addr-2.c.
* gcc.target/powerpc/altivec_vld_vst_addr-1.c: New test.
* gcc.target/powerpc/altivec_vld_vst_addr-2.c: Ditto.
2019-01-17 Kewen Lin <linkw@gcc.gnu.org>
* gcc.target/powerpc/altivec_vld_vst_addr.c: New test.
Paul Thomas [Sun, 27 Jan 2019 18:53:47 +0000 (18:53 +0000)]
Backport PRs 56386, 58906, 77385, 80260, 82077
2019-01-27 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
PR fortran/56386
PR fortran/58906
PR fortran/77385
PR fortran/80260
PR fortran/82077
* resolve.c (resolve_variable): Fix up expressions with array
associate names, where the parser did not detect that this is
array and there was no array part_ref in the expression.
* trans-expr.c (gfc_find_and_cut_at_last_class_ref): base_expr
should be a copy of e and not the initialization expr.
2019-01-27 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
PR fortran/56386
PR fortran/58906
PR fortran/77385
* gfortran.dg/associate_44.f90 : New test.
PR fortran/80260
* gfortran.dg/select_type_45.f90 : New test.
PR fortran/82077
* gfortran.dg/select_type_46.f90 : New test.
Uros Bizjak [Sun, 27 Jan 2019 17:42:58 +0000 (18:42 +0100)]
re PR rtl-optimization/88948 (ICE in elimination_costs_in_insn, at reload1.c:3640 since r264148)
PR target/88948
* rtl.h (prepare_copy_insn): New prototype.
* gcse.c (prepare_copy_insn): New function, split out from
process_insert_insn.
(process_insert_insn): Use prepare_copy_insn.
* store-motion.c (replace_store_insn): Use prepare_copy_insn
instead of gen_move_insn.
testsuite/ChangeLog:
PR target/88948
* gcc.target/i386/pr88948.c: New test.
Eric Botcazou [Sat, 26 Jan 2019 16:03:42 +0000 (16:03 +0000)]
trans.c (gnat_to_gnu): Use DECL_SIZE_UNIT instead of TYPE_SIZE_UNIT for the size to be assigned by a...
* gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Use
DECL_SIZE_UNIT instead of TYPE_SIZE_UNIT for the size to be assigned
by a call to memset if the LHS is a DECL.
Eric Botcazou [Sat, 26 Jan 2019 11:36:05 +0000 (11:36 +0000)]
decl.c (annotate_value): Use test on the sign bit instead of on the sign of the value.
* gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Use test on
the sign bit instead of on the sign of the value.
<PLUS_EXPR>: Turn addition of negative constant into subtraction.
<BIT_AND_EXPR>: Simplify.