Thomas Koenig [Sun, 17 Mar 2019 12:54:29 +0000 (12:54 +0000)]
re PR fortran/84394 (compiler error when using modules with derived types in block data subprograms)
2019-03-17 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84394
Backport from trunk
* symbol.c (gfc_add_subroutine): If we are encountering a
subrtoutine within a BLOCK DATA and the name starts with an
underscore, do not check.
2019-03-17 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84394
Backport from trunk
* gfortran.dg/blockdata_11.f90: New test.
H.J. Lu [Sun, 17 Mar 2019 09:27:56 +0000 (09:27 +0000)]
x32: Add addr32 prefix to VSIB address
32-bit indices in VSIB address are sign-extended to 64 bits. In x32,
when 32-bit indices are used as addresses, like in
vgatherdps %ymm7, 0(,%ymm9,1), %ymm6
32-bit indices, 0xf7fa3010, is sign-extended to 0xfffffffff7fa3010 which
is invalid address. Add addr32 prefix to UNSPEC_VSIBADDR instructions
for x32 if there is no base register nor symbol.
This fixes 175.vpr and 254.gap in SPEC CPU 2000 on x32 with
-Ofast -funroll-loops -march=haswell
gcc/
Backport from mainline
2019-03-14 H.J. Lu <hongjiu.lu@intel.com>
PR target/89523
* config/i386/i386.c (ix86_print_operand): Handle 'M' to add
addr32 prefix to VSIB address for X32.
* config/i386/sse.md (*avx512pf_gatherpf<mode>sf_mask): Prepend
"%M2" to opcode.
(*avx512pf_gatherpf<mode>df_mask): Likewise.
(*avx512pf_scatterpf<mode>sf_mask): Likewise.
(*avx512pf_scatterpf<mode>df_mask): Likewise.
(*avx2_gathersi<mode>): Prepend "%M3" to opcode.
(*avx2_gathersi<mode>_2): Prepend "%M2" to opcode.
(*avx2_gatherdi<mode>): Prepend "%M3" to opcode.
(*avx2_gatherdi<mode>_2): Prepend "%M2" to opcode.
(*avx2_gatherdi<mode>_3): Prepend "%M3" to opcode.
(*avx2_gatherdi<mode>_4): Prepend "%M2" to opcode.`
(*avx512f_gathersi<mode>): Prepend "%M4" to opcode.
(*avx512f_gathersi<mode>_2): Prepend "%M3" to opcode.
(*avx512f_gatherdi<mode>): Prepend "%M4" to opcode.
(*avx512f_gatherdi<mode>_2): Prepend "%M3" to opcode.
(*avx512f_scattersi<mode>): Prepend "%M0" to opcode.
(*avx512f_scatterdi<mode>): Likewise.
gcc/testsuite/
Backport from mainline
2019-03-14 H.J. Lu <hongjiu.lu@intel.com>
Thomas Koenig [Sat, 16 Mar 2019 14:03:00 +0000 (14:03 +0000)]
re PR fortran/66089 (elemental dependency mishandling when class array are involved)
2019-03-16 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/66089
Backport from trunk
* trans-array.c (gfc_scalar_elemental_arg_saved_as_reference):
Return false if a scalar tempoary is needed.
(gfc_walk_variable_expr): Fix up class refs.
2019-03-16 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/66089
Backport from trunk
* gfortran.dg/dependency_53.f90: New test.
* gfortran.dg/assumed_type_2.f90: Adapted tree dumps.
* gfortran.dg/no_arg_check_2.f90: Likewise.
Thomas Koenig [Sat, 16 Mar 2019 13:24:40 +0000 (13:24 +0000)]
re PR fortran/66695 ([F03] ICE with binding-name equal to the name of a use-associated procedure)
2019-03-16 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/66695
PR fortran/77746
PR fortran/79485
Backport from trunk
* gfortran.h (gfc_symbol): Add bind_c component.
(gfc_get_gsymbol): Add argument bind_c.
* decl.c (add_global_entry): Add bind_c argument to
gfc_get_symbol.
* parse.c (parse_block_data): Likewise.
(parse_module): Likewise.
(add_global_procedure): Likewise.
(add_global_program): Likewise.
* resolve.c (resolve_common_blocks): Likewise.
(resolve_global_procedure): Likewise.
(gfc_verify_binding_labels): Likewise.
* symbol.c (gfc_get_gsymbol): Add argument bind_c. Set bind_c
in gsym.
* trans-decl.c (gfc_get_module_backend_decl): Add bind_c argument
to gfc_get_symbol.
(gfc_get_extern_function_decl): If the sym has a binding label
and it cannot be found in the global symbol tabel, it is the wrong
one and vice versa.
2019-03-16 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/66695
PR fortran/77746
PR fortran/79485
Backport from trunk
* gfortran.dg/binding_label_tests_30.f90: New test.
* gfortran.dg/binding_label_tests_31.f90: New test.
* gfortran.dg/binding_label_tests_32.f90: New test.
* gfortran.dg/binding_label_tests_33.f90: New test.
Richard Biener [Thu, 14 Mar 2019 09:18:07 +0000 (09:18 +0000)]
backport: re PR target/84272 (AddressSanitizer: heap-use-after-free ../../gcc/config/aarch64/cortex-a57-fma-steering.c:519 in fma_node::get_parity())
2019-03-14 Richard Biener <rguenther@suse.de>
Backport from mainline
2018-02-16 Jakub Jelinek <jakub@redhat.com>
PR target/84272
* config/aarch64/cortex-a57-fma-steering.c (fma_forest::merge_forest):
Use ++iter rather than iter++ for std::list iterators.
(func_fma_steering::dfs): Likewise. Don't delete nodes right away,
defer deleting them until all nodes in the forest are processed. Do
free even leaf nodes. Change to_process into auto_vec.
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.