2017-12-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
PR libgfortran/83613
* io/unit.c (init_units): Don't forget to unlock the unit locks
after being inserted.
From-SVN: r256041
2017-12-28 Steven G. Kargl <kargl@gcc.gnu.org>
PR Fortran/83548
* match.c (gfc_match_type_spec): Check for LOGICAL conflict in
type-spec versus LOGICAL intrinsic subprogram.
2017-12-28 Steven G. Kargl <kargl@gcc.gnu.org>
PR Fortran/83548
* gfortran.dg/array_constructor_type_22.f03: New test.
From-SVN: r256025
PR c++/83553
* fold-const.c (struct contains_label_data): New type.
(contains_label_1): Return non-NULL even for CASE_LABEL_EXPR, unless
inside of a SWITCH_BODY seen during the walk.
(contains_label_p): Use walk_tree instead of
walk_tree_without_duplicates, prepare data for contains_label_1 and
provide own pset.
* c-c++-common/torture/pr83553.c: New test.
From-SVN: r255988
2017-12-22 Martin Jambor <mjambor@suse.cz>
PR lto/82027
* lto-cgraph.c (output_cgraph_opt_summary_p): Also check former
clones.
testsuite/
* g++.dg/lto/pr82027_0.C: New test.
From-SVN: r255983
PR debug/83550
* c-decl.c (finish_struct): Set DECL_SOURCE_LOCATION on
TYPE_STUB_DECL and call rest_of_type_compilation before processing
incomplete vars rather than after it.
* c-c++-common/dwarf2/pr83550.c: New test.
From-SVN: r255982
Backported from mainline
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR c/83448
* gimple-ssa-sprintf.c (maybe_warn): Don't call set_caret_index
if navail is >= dir.len.
* gcc.c-torture/compile/pr83448.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-warn-4.c: New test.
From-SVN: r255972
Backported from mainline
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/80747
PR rtl-optimization/83512
* cfgrtl.c (force_nonfallthru_and_redirect): When splitting
succ edge from ENTRY, copy partition from e->dest to the newly
created bb.
* bb-reorder.c (reorder_basic_blocks_simple): If last_tail is
ENTRY, use BB_PARTITION of its successor block as current_partition.
Don't copy partition when splitting succ edge from ENTRY.
* gcc.dg/pr80747.c: New test.
* gcc.dg/pr83512.c: New test.
From-SVN: r255971
Backported from mainline
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83521
* tree-ssa-phiopt.c (factor_out_conditional_conversion): Use
gimple_build_assign without code on result of
fold_build1 (VIEW_CONVERT_EXPR, ...), as it might not create
a VIEW_CONVERT_EXPR.
* gcc.dg/pr83521.c: New test.
From-SVN: r255969
Backported from mainline
2017-12-19 Jakub Jelinek <jakub@redhat.com>
PR ipa/82801
PR ipa/83346
* ipa-inline.c (flatten_remove_node_hook): New function.
(ipa_inline): Keep only nodes with flatten attribute at the end of
the array in the order from ipa_reverse_postorder, only walk that
portion of array for flattening, if there is more than one such
node, temporarily register a removal hook and ignore removed nodes.
* g++.dg/ipa/pr82801.C: New test.
From-SVN: r255968
2017-12-21 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/83436
* gfortran.dg/internal_readwrite_4.f90: New test.
From-SVN: r255940
Backport from mainline
2017-11-15 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/82726
PR tree-optimization/70754
* tree-predcom.c (order_drefs_by_pos): New function.
(combine_chains): Move code setting has_max_use_after to...
(try_combine_chains): ...here. New parameter. Sort combined chains
according to position information.
(tree_predictive_commoning_loop): Update call to above function.
(update_pos_for_combined_chains, pcom_stmt_dominates_stmt_p): New.
2017-11-15 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/82726
Revert
2017-01-23 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/70754
* tree-predcom.c (stmt_combining_refs): New parameter INSERT_BEFORE.
(reassociate_to_the_same_stmt): New parameter INSERT_BEFORE. Insert
combined stmt before it if not NULL.
(combine_chains): Process refs reversely and compute dominance point
for root ref.
Revert
2017-02-23 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/79663
* tree-predcom.c (combine_chains): Process refs in reverse order
only for ZERO length chains, and add explaining comment.
gcc/testsuite
Backport from mainline
2017-11-15 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/82726
* gcc.dg/tree-ssa/pr82726.c: New test.
From-SVN: r255828
PR c++/83116
* constexpr.c (cxx_eval_call_expression): Only look into
constexpr_call_table if ctx->strict.
* g++.dg/cpp1y/constexpr-83116.C: New test.
From-SVN: r255813
In some cases the jump could be to a return instruction and in those cases the
next_active_insn() function tries to follow an invalid pointer which leads to a
crash. This error did not manifest when using a 32-bit version of GCC which is
why I did not detect it before.
gcc/
* config/sparc/sparc.c (sparc_do_work_around_errata): Make sure
the jump is to a label.
From-SVN: r255808
Backport from mainline
2017-12-03 John David Anglin <danglin@gcc.gnu.org>
* config/pa/pa.c (pa_legitimate_address_p): For scaled indexing,
require base operand is a REG_POINTER prior to reload on targets
with non-equivalent space registers.
From-SVN: r255762
2017-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
PR libgfortran/81937
* io/list_read.c (next_char_internal): Don't attempt to read
from the internal unit stream if no bytes are left. Decrement
bytes_left in the right place.
From-SVN: r255752
2017-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
PR libgfortran/78549
* io/inquire.c (inquire_via_unit): Adjust test for existence for
pre-connected internal units.
* io/transfer.c (finalize_transfer): When done with a transfer
to internal units, free the format buffer and close the stream.
(st_read_done): Delete freeing the stream, now handled using
sclose in finalize_transfer. (st_write_done): Likewise.
* io/unit.c (get_unit): Return NULL for special reserved unit
numbers, signifying not accessible to the user.
(init_units): Insert the two special internal units into the
unit treap. This makes these unit structures available without
further allocations for later use by internal unit I/O. These
units are automatically deleted by normal program termination.
* io/unix.c (mem_close): Add a guard check to protect from double free.
From-SVN: r255751
Backported from mainline
2017-12-15 Jakub Jelinek <jakub@redhat.com>
PR c++/83205
* decl.c (cp_finish_decomp): Handle the case when tsize is not
error_mark_node, but doesn't fit into uhwi. Split up count != eltscnt
and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
to handle plural forms properly.
* g++.dg/cpp1z/decomp3.C: Adjust for structured binding count
mismatch diagnostics split into error and warning with plural
forms.
* g++.dg/cpp1z/decomp10.C: Likewise.
* g++.dg/cpp1z/decomp32.C: New test.
From-SVN: r255736
PR c++/83217
* decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
call complete_type (TREE_TYPE (type)).
* g++.dg/cpp1z/decomp33.C: New test.
From-SVN: r255730
PR tree-optimization/83269
* fold-const.c (fold_binary_loc): Perform (-A) - B -> (-B) - A
subtraction in arg0's type if type is signed and arg0 is unsigned.
Formatting fix.
* gcc.c-torture/execute/pr83269.c: New test.
From-SVN: r255729
Backported from mainline
2017-12-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83198
* gimple-ssa-sprintf.c (format_floating): Set type solely based on
dir.modifier, regardless of TREE_TYPE (arg). Assume non-REAL_CST
value if arg is a REAL_CST with incompatible type.
* gcc.dg/pr83198.c: New test.
* gcc.dg/tree-ssa/pr83198.c: New test.
From-SVN: r255728
Backported from mainline
2017-12-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/80631
* tree-vect-loop.c (get_initial_def_for_reduction): Fix comment typo.
(vect_create_epilog_for_reduction): Add INDUC_VAL argument, for
INTEGER_INDUC_COND_REDUCTION use INDUC_VAL instead of
hardcoding zero as the value if COND_EXPR is never true. For
INTEGER_INDUC_COND_REDUCTION don't emit the final COND_EXPR if
INDUC_VAL is equal to INITIAL_DEF.
(vectorizable_reduction): Compute INDUC_VAL for
vect_create_epilog_for_reduction, if no value is suitable, don't
use INTEGER_INDUC_COND_REDUCTION for now. Formatting fixes.
* gcc.dg/vect/pr80631-1.c: New test.
* gcc.dg/vect/pr80631-2.c: New test.
PR tree-optimization/80631
* gcc.target/i386/avx2-pr80631.c: New test.
From-SVN: r255726
Backported from mainline
2017-12-06 Jakub Jelinek <jakub@redhat.com>
PR c++/80259
* decl2.c (grokfield): Diagnose = delete redefinition of a friend.
* g++.dg/cpp0x/pr80259.C: New test.
From-SVN: r255723
Backported from mainline
2017-12-02 Jakub Jelinek <jakub@redhat.com>
PR c++/81212
* tree-cfg.c (pass_warn_function_return::execute): Handle
__builtin_ubsan_handle_missing_return like __builtin_unreachable
with BUILTINS_LOCATION.
* g++.dg/ubsan/pr81212.C: New test.
From-SVN: r255722
Backported from mainline
2017-12-02 Jakub Jelinek <jakub@redhat.com>
PR target/78643
PR target/80583
* expr.c (get_inner_reference): If DECL_MODE of a non-bitfield
is BLKmode for vector field with vector raw mode, use TYPE_MODE
instead of DECL_MODE.
* gcc.target/i386/pr80583.c: New test.
From-SVN: r255721
Backported from mainline
2017-11-27 Jakub Jelinek <jakub@redhat.com>
PR c++/81888
* parser.c (cp_parser_decomposition_declaration): Reject just
BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather
than all such CONSTRUCTORs, and only if is_direct_init is true.
* g++.dg/cpp1z/decomp30.C: Add a test for structured binding with
= {} and = { a, a } initializers.
* g++.dg/cpp1z/decomp31.C: New test.
From-SVN: r255719
Backported from mainline
2017-11-27 Jakub Jelinek <jakub@redhat.com>
PR c++/81675
* cp-gimplify.c (cp_fold) <case COND_EXPR>: Don't return immediately
for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is
INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall
through into normal folding, otherwise just rebuild x if any op
changed.
* g++.dg/warn/pr81675.C: New test.
From-SVN: r255718