Bernd Schmidt [Mon, 12 Dec 2016 13:01:28 +0000 (13:01 +0000)]
backport: re PR tree-optimization/77309 (wrong code at -Os and above on x86_64-linux-gnu (in the 64-bit mode))
Backport from mainline
2016-11-07 Bernd Schmidt <bschmidt@redhat.com>
PR rtl-optimization/77309
* combine.c (make_compound_operation): Allow EQ for IN_CODE, and
don't assume an equality comparison for plain COMPARE.
(simplify_comparison): Pass a more accurate code to
make_compound_operation.
PR rtl-optimization/77309
* gcc.dg/torture/pr77309.c: New test.
Nathan Sidwell [Thu, 8 Dec 2016 19:27:32 +0000 (19:27 +0000)]
re PR c++/78551 (Internal compiler error with constexpr initialization of union)
PR c++/78551
* constexpr.c (extract_string_elt): New. Broken out of ...
(cxx_eval_array_reference): ... here. Call it.
(cxx_eval_store_expression): Convert init by STRING_CST into
CONSTRUCTOR, if needed.
rs6000: Don't forget to initialize the TOC (PR77957)
The code generating traceback tables mistakenly does an early return
if !optional_tbtab, which causes it to miss the code generating the TOC
section. This only matters if the TOC will be empty since otherwise
the section is created elsewhere.
This patch fixes it.
PR target/77957
* config/rs6000/rs6000.c (rs6000_output_function_epilogue): Don't
return early if !optional_tbtab.
backport: Constrain optional's __constexpr_addressof in its return type and use a constexpr addressof for optional, if available.
Backport from mainline
2016-12-06 Ville Voutilainen <ville.voutilainen@gmail.com>
Constrain optional's __constexpr_addressof in its return type
and use a constexpr addressof for optional, if available.
* include/experimental/optional (__constexpr_addressof):
Constrain in the return type instead of in a template parameter.
(_Has_addressof_mem)
(_Has_addressof_free, _Has_addressof, __constexpr_addressof):
Guard with #ifndef __cpp_lib_addressof_constexpr.
(operator->()): Use std::__addressof if it's constexpr.
Bill Schmidt [Wed, 7 Dec 2016 01:08:40 +0000 (01:08 +0000)]
backport: re PR tree-optimization/78646 (incorrect result type for pointer addition in slsr)
2016-12-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2016-12-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Stefan Freudenberger <stefan@reservoir.com>
PR tree-optimization/78646
* gimple-ssa-strength-reduction.c (replace_ref): The pointer
addition used for the memory base expression should have the type
of the candidate.
Backport from mainline
2016-10-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/78038
* ree.c (get_defs): Return NULL if a defining insn for REG cannot
be deduced to set REG through the RTL structure.
(make_defs_and_copies_lists): Return false on a failing get_defs call.
Andreas Krebbel [Fri, 2 Dec 2016 08:51:58 +0000 (08:51 +0000)]
S/390: Fix vector all/any cc modes.
This fixes a problem with the vector compares producing CC mode
results.
The instructions produce condition code modes which can be either
interpreted to check an ALL elements or an ANY element result. As the
modes where used before they could not be inverted by the middle-end
by inverting the comparison code (e.g. eq to ne). The result usually
was just wrong.
In fact inverting a comparison code on an CCVALL mode would require to
also change the mode to CCVANY but this cannot be done easily in the
middle-end. With this patch the meaning of an ALL cc mode only refers
to the not-inverted comparison code (e.g. eq, gt, ge). With that
change inverting the comparison code matches a not operation on the
condition code mask again.
Bootstrapped and regression tested on s390 and s390x.
Bye,
-Andreas-
gcc/testsuite/ChangeLog:
2016-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Backport from mainline
2016-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.target/s390/vector/vec-scalar-cmp-1.c: Fix and harden the
pattern checks.
* gcc.target/s390/zvector/vec-cmp-1.c: New test.
gcc/ChangeLog:
2016-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Backport from mainline
2016-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/s390-modes.def (CCVEQANY, CCVH, CCVHANY, CCVHU)
(CCVHUANY): Remove modes.
(CCVIH, CCVIHU, CCVIALL, CCVIANY, CCVFALL, CCVFANY): Add modes and
documentation.
* config/s390/s390.c (s390_match_ccmode_set): Rename cc modes.
(s390_expand_vec_compare_scalar): Pick one of the cc consumer
modes.
(s390_branch_condition_mask): Adjust to use the new cc consumer
modes. The new modes allow for proper reversal in the middle-end.
(s390_expand_vec_compare_cc): Determine the proper cc producer and
consumer modes for a comparison.
* config/s390/s390.md: Rename CCVH to CCVIH and CCVHU to CCVIHU
throughout the file.
* config/s390/vx-builtins.md: Likewise.
Martin Liska [Thu, 24 Nov 2016 10:12:24 +0000 (11:12 +0100)]
Add sem_item::m_hash_set (PR ipa/78309)
PR ipa/78309
* ipa-icf.c (void sem_item::set_hash): Update m_hash_set.
(sem_function::get_hash): Use the new field.
(sem_function::parse): Remove an argument from ctor.
(sem_variable::parse): Likewise.
(sem_variable::get_hash): Use the new field.
(sem_item_optimizer::read_section): Use new ctor and set hash.
* ipa-icf.h: _hash is removed from sem_item::sem_item,
sem_variable::sem_variable, sem_function::sem_function.
Fix PR78294 - thread sanitizer broken when using ld.gold
When one uses ld.gold to build gcc, the thread sanitizer doesn't work,
because gold is more conservative when applying TLS relaxations than
ld.bfd. In this case a missing initial-exec attribute on a declaration
causes gcc to assume the general dynamic model. With ld.bfd this gets
relaxed to initial exec when linking the shared library, so the missing
attribute doesn't matter. But ld.gold doesn't perform this optimization
and this leads to crashes on tsan instrumented binaries.
Uros Bizjak [Fri, 11 Nov 2016 19:43:54 +0000 (20:43 +0100)]
i386.md (*<shift_insn><mode>3_doubleword): Mark operand 0 as earlyclobber.
* config/i386/i386.md (*<shift_insn><mode>3_doubleword): Mark
operand 0 as earlyclobber.
(*ashl<mode>3_doubleword): Ditto for all operand 0 alternatives.
Thomas Koenig [Sun, 6 Nov 2016 20:30:31 +0000 (20:30 +0000)]
backport: re PR fortran/69544 (Internal compiler error with -Wall and where)
2016-11-06 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/69544
PR fortran/78178
* gfortran.dg/where_5.f90: New test.
* gfortran.dg/where_6.f90: New test.
2016-11-06 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/69544
PR fortran/78178
* match.c (match_simple_where): Fill in locus for assigment
in simple WHERE statement.
(gfc_match_where): Likewise.
Thomas Koenig [Tue, 1 Nov 2016 08:12:00 +0000 (08:12 +0000)]
backport: re PR fortran/71902 (Unneeded temporary on reallocatable character assignment)
2016-10-31 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/71902
* frontend-passes.c (realloc_string_callback): Also check for the
lhs being deferred. Name temporary variable "realloc_string".
2016-10-31 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
PR fortran/71902
* gfortran.dg/dependency_47.f90: New test.
* gfortran.dg/dependency_49.f90: New test.
Jerry DeLisle [Mon, 31 Oct 2016 23:40:40 +0000 (23:40 +0000)]
backport: re PR libfortran/78123 (Short reads with T edit descriptor not padding correctly)
2016-10-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
PR libgfortran/78123
* io/transfer.c (formatted_transfer_scalar_read): Clear seen_eor
only if we have tabbed to left of current position.
Backport from trunk
PR fortran/78123
* gfortran.dg/fmt_t_9.f: New test.
Paul Thomas [Mon, 24 Oct 2016 12:14:52 +0000 (12:14 +0000)]
re PR fortran/61420 ([OOP] type-bound procedure returning a procedure pointer fails to compile)
2016-10-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/61420
PR fortran/78013
* resolve.c (resolve_variable): Obtain the typespec for a
variable expression, when the variable is a function result
that is a procedure pointer.
2016-10-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/61420
PR fortran/78013
* gfortran.dg/proc_ptr_49.f90: New test.
Bill Schmidt [Mon, 24 Oct 2016 02:41:12 +0000 (02:41 +0000)]
backport: re PR tree-optimization/77916 (ICE in verify_gimple_in_cfg: invalid (pointer) operands to plus/minus)
[gcc]
2016-10-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2016-10-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/77916
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge):
Don't allow a MINUS_EXPR for pointer arithmetic for either known
or unknown strides.
(record_increment): Increments of -1 for unknown strides just use
a multiply initializer like other negative values.
(analyze_increments): Remove stopgap solution for -1 increment
applied to pointer arithmetic.
(insert_initializers): Requirement of initializer for -1 should be
based on pointer-typedness of the candidate basis.
[gcc/testsuite]
2016-10-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
2016-10-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>