backport: re PR libstdc++/80506 (Wrong magic number in std::gamma_distribution)
2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net>
Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net>
PR libstdc++/80506
* include/bits/random.tcc (gamma_distribution::operator()): Fix magic
number used in loop condition.
(gamma_distribution::__generate_impl()): Ditto.
Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>
From-SVN: r260006
re PR fortran/85507 (ICE in gfc_dep_resolver, at fortran/dependency.c:2258)
gcc/fortran/ChangeLog:
2018-05-06 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/85507
Backport from trunk.
* dependency.c (gfc_dep_resolver): Revert looking at coarray dimension
introduced by r259385.
* trans-intrinsic.c (conv_caf_send): Always report a dependency for
same variables in coarray assignments.
gcc/testsuite/ChangeLog:
2018-05-06 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/85507
Backport from trunk
* gfortran.dg/coarray_dependency_1.f90: New test.
* gfortran.dg/coarray_lib_comm_1.f90: Fix counting caf-expressions.
Jonathan Wakely [Thu, 3 May 2018 20:16:29 +0000 (21:16 +0100)]
PR libstdc++/85632 fix wraparound in filesystem::space
On 32-bit targets any values over 4GB would wrap and produce the wrong
result.
PR libstdc++/85632 use uintmax_t for arithmetic
* src/filesystem/ops.cc (experimental::filesystem::space): Perform
arithmetic in result type.
* testsuite/experimental/filesystem/operations/space.cc: New.
PR libstdc++/pr66689 - comp_ellint_3 and ellint_3 return garbage values
2018-04-30 Edward Smith-Rowland <3dw4rd@verizon.net>
PR libstdc++/pr66689 - comp_ellint_3 and ellint_3 return garbage values
* include/tr1/ell_integral.tcc: Correct the nu sign convention
in ellint_3 and comp_ellint_3.
* testsuite/tr1/5_numerical_facilities/special_functions/
06_comp_ellint_3/check_value.cc: Regen with correct values.
* testsuite/tr1/5_numerical_facilities/special_functions/
14_ellint_3/check_value.cc: Ditto.
* testsuite/special_functions/06_comp_ellint_3/check_value.cc: Ditto.
* testsuite/special_functions/13_ellint_3/check_value.cc: Ditto.
* testsuite/special_functions/06_comp_ellint_3/pr66689.cc: New.
* testsuite/special_functions/13_ellint_3/pr66689.cc: New.
* testsuite/tr1/5_numerical_facilities/special_functions/
06_comp_ellint_3/pr66689.cc: New.
* testsuite/tr1/5_numerical_facilities/special_functions/
14_ellint_3/pr66689.cc: New.
2018-04-30 Edward Smith-Rowland <3dw4rd@verizon.net>
PR libstdc++/68397 std::tr1::expint fails ... long double arguments.
* include/tr1/exp_integral.tcc: Increase iteration limits.
* testsuite/tr1/5_numerical_facilities/special_functions/15_expint/
pr68397.cc: New test.
* testsuite/special_functions/14_expint/pr68397.cc: New test.
svn commit \ --This line, and those below, will be ignored--
ChangeLog \ M ChangeLog M include/tr1/ell_integral.tcc A testsuite/special_functions/06_comp_ellint_3/pr66689.cc A
testsuite/special_functions/13_ellint_3/pr66689.cc A testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/pr66689.cc A
testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/pr66689.cc M testsuite/special_functions/06_comp_ellint_3/check_value.cc M
testsuite/special_functions/13_ellint_3/check_value.cc M testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_value.cc M
testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_value.cc M include/tr1/exp_integral.tcc A
testsuite/special_functions/14_expint/pr68397.cc A testsuite/tr1/5_numerical_facilities/special_functions/15_expint/pr68397.cc
include/tr1/ell_integral.tcc \
testsuite/special_functions/06_comp_ellint_3/pr66689.cc \
testsuite/special_functions/13_ellint_3/pr66689.cc \
testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/pr66689.cc \
testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/pr66689.cc \
testsuite/special_functions/06_comp_ellint_3/check_value.cc \
testsuite/special_functions/13_ellint_3/check_value.cc \
testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_value.cc \
testsuite/tr1/5_numerical_facilities/special_functio
re PR fortran/81773 ([Coarray] Get with vector index on lhs leads to incorrect caf_get_by_ref() call.)
gcc/fortran/ChangeLog:
2018-04-28 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/81773
PR fortran/83606
Backport from trunk
* dependency.c (gfc_dep_resolver): Coarray indexes are to be ignored
during dependency computation. They define no data dependency.
* trans-array.c (conv_array_index_offset): The stride can not be set
here, prevent fail.
* trans-intrinsic.c (conv_caf_send): Add creation of temporary array
for caf_get's result and copying to the array with vectorial
indexing.
gcc/testsuite/ChangeLog:
2018-04-28 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/81773
PR fortran/83606
Backport from trunk
* gfortran.dg/coarray/get_to_indexed_array_1.f90: New test.
* gfortran.dg/coarray/get_to_indirect_array.f90: New test.
Richard Biener [Thu, 26 Apr 2018 10:00:24 +0000 (10:00 +0000)]
Backport PRs 84873, 85168, 85244, 85284
2018-04-26 Richard Biener <rguenther@suse.de>
Backport from mainline
2018-04-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/85284
* tree-ssa-loop-niter.c (number_of_iterations_exit_assumptions):
Only use the niter constraining form of simple_iv when the exit
is always executed.
* gcc.dg/torture/pr85284.c: New testcase.
2018-04-06 Richard Biener <rguenther@suse.de>
PR middle-end/85244
* tree-dfa.c (get_ref_base_and_extent): Reset seen_variable_array_ref
after seeing a component reference with an adjacent field. Treat
refs to arrays at struct end of external decls similar to
refs to unconstrained commons.
* gcc.dg/torture/pr85244-1.c: New testcase.
* gcc.dg/torture/pr85244-2.c: Likewise.
Martin Liska [Tue, 24 Apr 2018 15:17:48 +0000 (17:17 +0200)]
Backport r258924
2018-04-24 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-03-28 Jakub Jelinek <jakub@redhat.com>
Martin Liska <mliska@suse.cz>
PR sanitizer/85081
* gimplify.c (asan_poison_variable): Don't do the check for
gimplify_omp_ctxp here.
(gimplify_decl_expr): Do it here.
(gimplify_target_expr): Likewise.
2018-04-24 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-03-28 Jakub Jelinek <jakub@redhat.com>
Martin Liska <mliska@suse.cz>
PR sanitizer/85081
* g++.dg/asan/pr85081.C: New test.
Martin Liska [Tue, 24 Apr 2018 15:17:00 +0000 (17:17 +0200)]
Backport r258480
2018-04-24 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-03-13 Martin Liska <mliska@suse.cz>
PR ipa/84658.
* (sem_item_optimizer::sem_item_optimizer): Initialize new
vector.
(sem_item_optimizer::~sem_item_optimizer): Release it.
(sem_item_optimizer::merge_classes): Register variable aliases.
(sem_item_optimizer::fixup_pt_set): New function.
(sem_item_optimizer::fixup_points_to_sets): Likewise.
* ipa-icf.h: Declare new variables and functions.
2018-04-24 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-03-13 Martin Liska <mliska@suse.cz>
backport: re PR target/83660 (ICE with vec_extract inside expression statement)
2018-04-23 Aaron Sawdey <acsawdey@linux.ibm.com>
Backport from mainline
2018-04-16 Aaron Sawdey <acsawdey@linux.ibm.com>
PR target/83660
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Mark
vec_extract expression as having side effects to make sure it gets
a cleanup point.
2018-04-23 Aaron Sawdey <acsawdey@linux.ibm.com>
Backport from mainline
2018-04-16 Aaron Sawdey <acsawdey@linux.ibm.com>
PR target/83660
* gcc.target/powerpc/pr83660.C: New test.
Eric Botcazou [Mon, 23 Apr 2018 20:29:22 +0000 (20:29 +0000)]
re PR middle-end/85496 (internal compiler error: in emit_move_insn, at expr.c:3722)
PR middle-end/85496
* expr.c (store_field): In the bitfield case, if the value comes from
a function call and is returned in registers by means of a PARALLEL,
do not change the mode of the temporary unless BLKmode and VOIDmode.
Peter Bergner [Fri, 20 Apr 2018 12:19:10 +0000 (07:19 -0500)]
backport: re PR target/83969 (ICE in final_scan_insn, at final.c:2997 (error: could not split insn) for powerpc targets)
gcc/
Backport from mainline
2018-03-09 Peter Bergner <bergner@vnet.ibm.com>
PR target/83969
* config/rs6000/rs6000.c (rs6000_offsettable_memref_p): New prototype.
Add strict argument and use it.
(rs6000_split_multireg_move): Update for new strict argument.
(mem_operand_gpr): Disallow all non-offsettable addresses.
* config/rs6000/rs6000.md (*movdi_internal64): Use YZ constraint.
gcc/testsuite/
PR target/85436
* go.dg/pr85436.go: New test.
Backport from mainline
2018-03-09 Peter Bergner <bergner@vnet.ibm.com>
PR target/83969
* gcc.target/powerpc/pr83969.c: New test.
Jonathan Wakely [Thu, 19 Apr 2018 15:29:03 +0000 (16:29 +0100)]
PR c++/85464 - missing location for -Wignored-qualifiers diagnostic
The fix for PR c++/69733 caused a regression for conversion operators
with redundant cv-qualifiers, changing an incorrect location to an
unknown location. This restores it to the incorrect location (as was
already done on trunk by the fix for PR c++/65775).
gcc/cp:
PR c++/85464 - missing location for -Wignored-qualifiers diagnostic
* decl.c (grokdeclarator): If declspecs->locations[ds_type_spec]
is UNKNOWN_LOCATION fall back to input_location.
Instruction pattern for setting the FPSCR expects the input value to be
in a register. However, __builtin_arm_set_fpscr expander does not ensure
that this is the case and as a result GCC ICEs when the builtin is
called with a constant literal.
This commit fixes the builtin to force the input value into a register.
It also remove the unneeded volatile in the existing fpscr test and
fixes the function prototype.
2018-04-18 Thomas Preud'homme <thomas.preudhomme@arm.com>
Backport from mainline
2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
PR target/85261
* config/arm/arm-builtins.c (arm_expand_builtin): Force input operand
into register.
gcc/testsuite/
PR target/85261
* gcc.target/arm/fpscr.c: Add call to __builtin_arm_set_fpscr with
literal value. Expect 2 MCR instruction. Fix function prototype.
Remove volatile keyword.
Jonathan Wakely [Fri, 13 Apr 2018 10:19:30 +0000 (11:19 +0100)]
Fix __iosfail_type_info hack to work on darwin
* src/c++11/Makefile.am: Rewrite sed rule to be less fragile and to
handle mangled names starting with double underscores on darwin.
* src/c++11/Makefile.in: Regenerate.
Jonathan Wakely [Thu, 12 Apr 2018 19:06:50 +0000 (20:06 +0100)]
PR libstdc++/85222 allow catching iostream errors as gcc4-compatible ios::failure
Define a new exception type derived from std::ios::failure[abi:cxx11]
which also aggregates an object of the gcc4-compatible ios::failure
type. Make __throw_ios_failure throw this new type for iostream errors
that raise exceptions. Provide custom type info for the new type so that
it can be caught by handlers for the gcc4-compatible ios::failure type
as well as handlers for ios::failure[abi:cxx11] and its bases.
Backport from mainline
2018-04-10 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/85222
* src/c++11/Makefile.am [ENABLE_DUAL_ABI]: Add special rules for
cxx11-ios_failure.cc to rewrite type info for __ios_failure.
* src/c++11/Makefile.in: Regenerate.
* src/c++11/cxx11-ios_failure.cc (__ios_failure, __iosfail_type_info):
New types.
[_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
* src/c++11/ios.cc (__throw_ios_failure): Remove definition.
(_GLIBCXX_USE_CXX11_ABI): Don't define here.
* src/c++98/ios_failure.cc (__construct_ios_failure)
(__destroy_ios_failure, is_ios_failure_handler): New functions.
[!_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
* testsuite/27_io/ios_base/failure/dual_abi.cc: New.
* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Revert changes to
handler types, to always catch std::ios_base::failure.
* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/
exceptions_failbit.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
exceptions_failbit.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_other/char/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
exceptions_null.cc: Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
Sebastian Huber [Thu, 12 Apr 2018 11:08:35 +0000 (11:08 +0000)]
Ada: Fix s-oscons.ads generation
The $(GNATLIBCFLAGS) are already included in $(GNATLIBCFLAGS_FOR_C).
We must call the C compiler with the right machine flags. So, add
$(GNATLIBCFLAGS_FOR_C) to $(OSCONS_EXTRACT). For example, on a bi-arch
compiler supporting 32-bit and 64-bit instruction sets we pick otherwise
only one variant due to a missing -m32 or -m64 flag.
Andreas Krebbel [Thu, 12 Apr 2018 10:20:11 +0000 (10:20 +0000)]
IBM Z: Spectre: Prevent thunk cfi to be emitted with -fno-dwarf2-cfi-asm
The CFI magic we emit as part of the indirect branch thunks in order to
have somewhat sane unwind information must not be emitted with
-fno-dwarf2-cfi-asm.
gcc/ChangeLog:
2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Backport from mainline
2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/s390.c (s390_output_indirect_thunk_function): Check
also for flag_dwarf2_cfi_asm.
gcc/testsuite/ChangeLog:
2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Backport from mainline
2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
[ARM] Fix PR85203: cmse_nonsecure_caller returns wrong result
__builtin_cmse_nonsecure_caller implementation returns true in almost
all cases due to 2 separate bugs:
* gen_addsi is used instead of gen_andsi to retrieve the lsb
* the lsb boolean value is not negated but the specification [1] says
the intrinsic should return true for a nonsecure caller and a
nonsecure caller is characterized with LR's lsb being 0
This was not caught due to (1) lack of runtime test and (2) the existing
RTL scan not taking into account that '.' matches newline in Tcl regular
expressions.
This commit fixes the implementation issues and improves testing of
cmse_nonsecure_caller by (1) adding a runtime test for the secure caller
case and (2) looking for an SET insn of an AND expression in the right
function. This leaves the nonsecure caller case only partly tested
since the exact value being AND and the negation are not covered by the
scan and the existing test infrastructure does not allow 2 separate
compilation and link to be performed. It is enough though to catch the
current incorrect behavior.
The commit also reorganize the scan directives in cmse-1.c to more
easily identify what function they are intended to test in the file.
2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
Backport from mainline
2018-04-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
PR target/85203
* config/arm/arm-builtins.c (arm_expand_builtin): Change
expansion to perform a bitwise AND of the argument followed by a
boolean negation of the result.
gcc/testsuite/
PR target/85203
* gcc.target/arm/cmse/cmse-1.c: Tighten cmse_nonsecure_caller RTL scan
to match a single insn of the baz function. Move scan directives at
the end of the file below the functions they are trying to test for
better readability.
* gcc.target/arm/cmse/cmse-16.c: New testcase.
Peter Bergner [Wed, 4 Apr 2018 19:51:32 +0000 (14:51 -0500)]
backport: re PR rtl-optimization/84878 (ICE: Segmentation fault (in add_cross_iteration_register_deps))
gcc/
Backport from mainline
2018-04-04 Peter Bergner <bergner@vnet.ibm.com>
PR rtl-optimization/84878
* ddg.c (add_cross_iteration_register_deps): Use DF_REF_BB to determine
the basic block. Assert the use reference is not artificial and that
it has an associated insn.
gcc/testsuite/
Backport from mainline
2018-04-04 Peter Bergner <bergner@vnet.ibm.com>
PR rtl-optimization/84878
* gcc.target/powerpc/pr84878.c: New test.
i386.c (emit_i387_cw_initialization): Always use logic instructions when changing rounding bits to preserve precision...
* config/i386/i386.c (emit_i387_cw_initialization): Always use logic
instructions when changing rounding bits to preserve precision bits
in the x87 control word.
H.J. Lu [Mon, 2 Apr 2018 12:03:16 +0000 (12:03 +0000)]
i386: Enable AVX/AVX512 features only if supported by OSXSAVE
Enable AVX and AVX512 features only if their states are supported by
OSXSAVE.
Backport from mainline
PR target/85100
* config/i386/cpuinfo.c (XCR_XFEATURE_ENABLED_MASK): New.
(XSTATE_FP): Likewise.
(XSTATE_SSE): Likewise.
(XSTATE_YMM): Likewise.
(XSTATE_OPMASK): Likewise.
(XSTATE_ZMM): Likewise.
(XSTATE_HI_ZMM): Likewise.
(XCR_AVX_ENABLED_MASK): Likewise.
(XCR_AVX512F_ENABLED_MASK): Likewise.
(get_available_features): Enable AVX and AVX512 features only
if their states are supported by OSXSAVE.
Sudakshina Das [Thu, 29 Mar 2018 09:19:45 +0000 (09:19 +0000)]
[ARM][PR target/84826] Fix ICE in extract_insn, at recog.c:2304 on
arm-linux-gnueabihf
This patch backports r258777 and r258805 to gcc-7-branch
and gcc-6-branch. The same ICE occurs in both the branches with
-fstack-check. Thus the test case directive has been changed.
The discussion on the patch that went into trunk is:
https://gcc.gnu.org/ml/gcc-patches/2018-03/msg01120.html
ChangeLog entries:
*** gcc/ChangeLog ***
2018-03-29 Sudakshina Das <sudi.das@arm.com>
Backport from mainline
2018-03-22 Sudakshina Das <sudi.das@arm.com>