2019-08-28 Martin Liska <mliska@suse.cz>
PR tree-optimization/90970
* builtins.c (check_access): Remove assignment to maxread
as it hasn't been used since when it was introduced in r255755.
From-SVN: r274983
* semantics.c (maybe_mark_exp_read_r): New function.
(finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
* g++.dg/cpp1z/constexpr-if31.C: New test.
* g++.dg/cpp1z/constexpr-if32.C: New test.
From-SVN: r274982
gcc/ChangeLog:
PR tree-optimization/91567
* gimple-ssa-sprintf.c (get_string_length): Handle more forms of lengths
of unknown strings.
* vr-values.c (vr_values::extract_range_basic): Set strlen upper bound
to PTRDIFF_MAX - 2.
gcc/testsuite/ChangeLog:
PR tree-optimization/91567
* gcc.dg/tree-ssa/builtin-snprintf-6.c: Xfail a subset of assertions
on targets other than x86_64 to work around PR 83543.
* gcc.dg/tree-ssa/builtin-sprintf-warn-22.c: New test.
From-SVN: r274976
* tree-ssa-strlen.c (printf_strlen_execute): Initialize
the loop optimizer and SCEV before sizing ssa_ver_to_stridx.
* gcc.c-torture/compile/20190827-1.c: New test.
From-SVN: r274975
PR target/91528
* config/i386/i386-features.c (convert_scalars_to_vector):
Update crtl->stack_realign_needed, crtl->stack_realign_tried and
crtl->stack_realign_processed. Update crtl->drap_reg by calling
targetm.calls.get_drap_rtx. If drap_rtx is non-null then
Update crtl->args.internal_arg_pointer and call fixup_tail_calls.
testsuite/ChangeLog:
PR target/91528
* gcc.target/i386/pr91528.c: New test.
From-SVN: r274962
Ensure that options lists fit cleanly inside the margins of a PDF page.
Reword description of option -ffrontend-loop-interchange so that it fits
cleanly inside the margins of a PDF page. Add options to those enabled
by -fdec.
From-SVN: r274958
2019-08-27 Martin Liska <mliska@suse.cz>
PR lto/91478
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
First find a WEAK HIDDEN symbol in symbol table that will be
preserved. Later, use the symbol name for all removed symbols.
From-SVN: r274955
* config/i386/i386-features.h
(general_scalar_chain::~general_scalar_chain): Add.
(general_scalar_chain::insns_conv): New bitmap.
(general_scalar_chain::n_sse_to_integer): New.
(general_scalar_chain::n_integer_to_sse): Likewise.
(general_scalar_chain::make_vector_copies): Adjust signature.
* config/i386/i386-features.c
(general_scalar_chain::general_scalar_chain): Outline,
initialize new members.
(general_scalar_chain::~general_scalar_chain): New.
(general_scalar_chain::mark_dual_mode_def): Record insns
we need to insert conversions at and count them.
(general_scalar_chain::compute_convert_gain): Account
for conversion instructions at chain boundary.
(general_scalar_chain::make_vector_copies): Generate a single
copy for a def by a specific insn.
(general_scalar_chain::convert_registers): First populate
defs_map, then make copies at out-of chain insns.
From-SVN: r274953
PR c++/91415
* c-common.c (verify_tree): For LSHIFT_EXPR, RSHIFT_EXPR,
COMPONENT_REF and ARRAY_REF in cxx_dialect >= cxx17 mode handle it
like COMPOUND_EXPR rather than normal expression.
* g++.dg/warn/sequence-pt-4.C: New test.
From-SVN: r274952
Following the publication of https://kb.cert.org/vuls/id/129209/ I've
been having a look at GCC's implementation for Arm and AArch64. I
haven't identified any issues yet, but it's a bit early to be
completely sure.
One observation, however, is that the instruction sequence that
initializes the stack canary might be vulnerable to producing a
reusable value if it were ever split early. I don't think we ever
would, because the memory locations involved with the stack protector
are all marked volatile to ensure that the values are only loaded at
the point in time when the test is intended to happen, and that also
has the effect of making it unlikely that the value would be reused
without reloading. Nevertheless, defence in depth is probably
warranted here.
So this patch just adds some comments warning that the patterns should
not be split.
* config/arm/arm.md (stack_protect_set_insn): Add security-related
comment.
* config/aarch64/aarch64.md (stack_protect_set_<mode>): Likewise.
From-SVN: r274946
2019-08-26 Richard Biener <rguenther@suse.de>
* config/i386/i386-features.c (general_remove_non_convertible_regs):
Remove.
(convert_scalars_to_vector): Do not call it.
From-SVN: r274929
2019-08-26 Tejas Joshi <tejasjoshi9673@gmail.com>
* builtins.c (mathfn_built_in_2): Added CASE_MATHFN_FLOATN
for ROUNDEVEN.
* builtins.def: Added function definitions for roundeven function
variants.
* fold-const-call.c (fold_const_call_ss): Added case for roundeven
function call. Adjust condition for floor, ceil, trunc and round.
* fold-const.c (negate_mathfn_p): Added case for roundeven function.
(tree_call_nonnegative_warnv_p): Added case for roundeven function.
(integer_valued_real_call_p): Added case for roundeven function.
* real.c (is_even): New function. Returns true if real number is even,
otherwise returns false.
(is_halfway_below): New function. Returns true if real number is
halfway between two integers, else return false.
(real_roundeven): New function. Round real number to nearest integer,
rounding halfway cases towards even.
* real.h (real_value): Added descriptive comments. Added function
declaration for roundeven function.
* doc/extend.texi (Other Builtins): List roundeven variants among
functions which can be handled as builtins.
gcc/testsuite/ChangeLog:
2019-08-26 Tejas Joshi <tejasjoshi9673@gmail.com>
* gcc.dg/torture/builtin-round-roundeven.c: New test.
* gcc.dg/torture/builtin-round-roundevenf128.c: New test.
From-SVN: r274927
2019-08-26 Richard Biener <rguenther@suse.de>
PR target/91522
PR target/91527
* config/i386/i386-features.h (general_scalar_chain::defs_map):
New member.
(general_scalar_chain::replace_with_subreg): Remove.
(general_scalar_chain::replace_with_subreg_in_insn): Likewise.
(general_scalar_chain::convert_reg): Adjust signature.
* config/i386/i386-features.c (scalar_chain::add_insn): Do not
iterate over all defs of a reg.
(general_scalar_chain::replace_with_subreg): Remove.
(general_scalar_chain::replace_with_subreg_in_insn): Likewise.
(general_scalar_chain::make_vector_copies): Populate defs_map,
place copy only after defs that are used as vectors in the chain.
(general_scalar_chain::convert_reg): Emit a copy for a specific
def in a specific instruction.
(general_scalar_chain::convert_op): All reg uses are converted here.
(general_scalar_chain::convert_insn): Emit copies for scalar
uses of defs here. Replace uses with the copies we created.
Replace and convert the def. Adjust REG_DEAD notes, remove
REG_EQUIV/EQUAL notes.
(general_scalar_chain::convert_registers): Only handle copies
into the chain here.
From-SVN: r274926
This patch allows users of the substitute_and_fold_engine to
enable folding all statements. It is now enabled for VRP which
is needed for the match.pd pattern in patch 2/2.
The loop versioning pass was missing one case when
deconstructing addresses that would only be triggered after
this patch for me:
It could handle addition and subsequent convert/nop but not
a convert/nop directly. This would cause the hash to be
calculated differently and, in turn, cause the pass to miss
a versioning opportunity. Fixed this by adding the missing
case.
--
gcc/ChangeLog:
2019-08-26 Robin Dapp <rdapp@linux.ibm.com>
* gimple-loop-versioning.cc (loop_versioning::record_address_fragment):
Add nop_convert case.
* tree-ssa-propagate.c (substitute_and_fold_dom_walker::before_dom_children):
Fold all statements if requested.
* tree-ssa-propagate.h (class substitute_and_fold_engine):
Allow to fold all statements.
* tree-vrp.c (class vrp_folder):
Let substitute_and_fold_engine fold all statements.
From-SVN: r274923
2019-08-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/91526
* passes.def: Note that after late FRE we do TODO_update_address_taken.
* tree-ssa-sccvn.c (pass_fre::execute): In late mode schedule
TODO_update_address_taken.
From-SVN: r274922
2019-08-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91390
PR fortran/91519
* frontend-passes.c (check_externals_procedure): New
function. If a procedure is not in the translation unit, create
an "interface" for it, including its formal arguments.
(check_externals_code): Use check_externals_procedure for common
code with check_externals_expr.
(check_externals_expr): Vice versa.
* gfortran.h (gfc_get_formal_from_actual-arglist): New prototype.
(gfc_compare_actual_formal): New prototype.
* interface.c (compare_actual_formal): Rename to
(gfc_compare_actual_formal): New function, make global.
(gfc_get_formal_from_actual_arglist): Make global, and move here from
* trans-types.c (get_formal_from_actual_arglist): Remove here.
(gfc_get_function_type): Use gfc_get_formal_from_actual_arglist.
2019-08-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91390
PR fortran/91519
* gfortran.dg/bessel_3.f90: Add type mismatch errors.
* gfortran.dg/coarray_7.f90: Rename subroutines to avoid
additional errors.
* gfortran.dg/g77/20010519-1.f: Add -std=legacy. Remove
warnings for ASSIGN. Add warnings for type mismatch.
* gfortran.dg/goacc/acc_on_device-1.f95: Add -std=legacy.
Add catch-all warning.
* gfortran.dg/internal_pack_9.f90: Rename subroutine to
avoid type error.
* gfortran.dg/internal_pack_9.f90: Add -std=legacy. Add
warnings for type mismatch.
* gfortran.dg/pr39937.f: Add -std=legacy and type warnings. Move
here from
* gfortran.fortran-torture/compile/pr39937.f: Move to
gfortran.dg.
From-SVN: r274902
/cp
2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
* semantics.c (finish_switch_cond): Improve error message location.
/testsuite
2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/conversion/simd4.C: Test all the locations.
From-SVN: r274901
Record when a local pointer variable is set to a value such that
indirecting through the pointer does not require a write barrier. Use
that to eliminate write barriers when indirecting through that local
pointer variable. Only keep this information per-block, so it's not
all that applicable.
This reduces the number of write barriers generated when compiling the
runtime package from 553 to 524.
The point of this is to eliminate a bad write barrier in the bytes
function in runtime/print.go. Mark that function nowritebarrier so
that the problem does not recur.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191581
From-SVN: r274890
We used to implement darn with unspecs, not unspec_volatiles, which
means two darn instructions could be CSEd together.
This testcase tests it by adding together four random numbers. If all
is well that means we get four darn instructions, because such a small
loop is unrolled fine at -O2 already. If things go bad, combine will
combine it all to one darn and a shift left by two.
gcc/testsuite/
PR target/91481
* gcc.target/powerpc/darn-3.c: New testcase.
From-SVN: r274889
Building for i686-mingw32 target (with some local changes) produced an
error
error: ISO C++ forbids declaration of 'lstat' with no type [-fpermissive]
in libstdc++-v3/src/filesystem/ops-common.h. This patch adds the
missing return type. OK to commit (trunk and GCC 9 branch)?
Note 1: I haven't run the testsuite with this patch, but it fixes the
build failure I see (in sources with other local changes).
Note 2: I don't know why this hasn't produced build failures for other
people, but the missing return type looks wrong in any case even if
other local changes are for some reason needed for it to produce an
error.
* src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
(std::filesystem::__gnu_posix::lstat): Add return type.
From-SVN: r274885