]> gcc.gnu.org Git - gcc.git/log
gcc.git
3 years agod: Fix ICE in create_tmp_var, at gimple-expr.c:482
Iain Buclaw [Fri, 4 Sep 2020 20:54:22 +0000 (22:54 +0200)]
d: Fix ICE in create_tmp_var, at gimple-expr.c:482

Array concatenate expressions were creating more SAVE_EXPRs than what
was necessary.  The internal error itself was the result of a forced
temporary being made on a TREE_ADDRESSABLE type.

gcc/d/ChangeLog:

PR d/96924
* expr.cc (ExprVisitor::visit (CatAssignExp *)): Don't force
temporaries needlessly.

gcc/testsuite/ChangeLog:

PR d/96924
* gdc.dg/pr96924.d: New test.

(cherry picked from commit 52908b8de15a1c762a73063f1162bcedfcc993b4)

3 years agors6000, remove improperly defined and unsupported builtins.
Carl Love [Thu, 27 Aug 2020 18:36:13 +0000 (13:36 -0500)]
rs6000, remove improperly defined and unsupported builtins.

gcc/ChangeLog

2020-08-31  Carl Love  <cel@us.ibm.com>

PR target/85830
* config/rs6000/altivec.h (vec_popcntb, vec_popcnth, vec_popcntw,
vec_popcntd): Remove defines.

3 years agosra: Avoid SRAing if there is an aout-of-bounds access (PR 96820)
Martin Jambor [Fri, 4 Sep 2020 12:31:16 +0000 (14:31 +0200)]
sra: Avoid SRAing if there is an aout-of-bounds access (PR 96820)

The testcase causes and ICE in the SRA verifier on x86_64 when
compiling with -m32 because build_user_friendly_ref_for_offset looks
at an out-of-bounds array_ref within an array_ref which accesses an
offset which does not fit into a signed 32bit integer and turns it
into an array-ref with a negative index.

The best thing is probably to bail out early when encountering an out
of bounds access to a local stack-allocated aggregate (and let the DSE
just delete such statements) which is what the patch does.

I also glanced over to the initial candidate vetting routine to make
sure the size would fit into HWI and noticed that it uses unsigned
variants whereas the rest of SRA operates on signed offsets and
sizes (because get_ref_and_extent does) and so changed that for the
sake of consistency.  These ancient checks operate on sizes of types
as opposed to DECLs but I hope that any issues potentially arising
from that are basically hypothetical.

gcc/ChangeLog:

2020-08-28  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/96820
* tree-sra.c (create_access): Disqualify candidates with accesses
beyond the end of the original aggregate.
(maybe_add_sra_candidate): Check that candidate type size fits
signed uhwi for the sake of consistency.

gcc/testsuite/ChangeLog:

2020-08-28  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/96820
* gcc.dg/tree-ssa/pr96820.c: New test.

(cherry picked from commit 8ad3fc6ca46c603d9c3efe8e6d4a8f2ff1a893a4)

3 years agobpf: generate indirect calls for xBPF
David Faust [Fri, 4 Sep 2020 08:18:56 +0000 (10:18 +0200)]
bpf: generate indirect calls for xBPF

This patch updates the BPF back end to generate indirect calls via
the 'call %reg' instruction when targetting xBPF.

Additionally, the BPF ASM_SPEC is updated to pass along -mxbpf to
gas, where it is now supported.

2020-09-03  David Faust  <david.faust@oracle.com>

gcc/

* config/bpf/bpf.h (ASM_SPEC): Pass -mxbpf to gas, if specified.
* config/bpf/bpf.c (bpf_output_call): Support indirect calls in xBPF.

gcc/testsuite/

* gcc.target/bpf/xbpf-indirect-call-1.c: New test.

(cherry picked from commit c3a0f5373919deff68819de1db88c04261d61a87)

3 years agoDaily bump.
GCC Administrator [Fri, 4 Sep 2020 00:17:07 +0000 (00:17 +0000)]
Daily bump.

3 years agors6000: MMA built-in dies with incorrect sharing of tree nodes error
Peter Bergner [Tue, 1 Sep 2020 18:47:44 +0000 (13:47 -0500)]
rs6000: MMA built-in dies with incorrect sharing of tree nodes error

When we expand our MMA built-ins into gimple, we erroneously reused the
accumulator memory reference for both the source input value as well as
the destination output value.  This led to a tree sharing error.
The solution is to create separate memory references for the input
and output values.

2020-09-01  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96808
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Do not
reuse accumulator memory reference for source and destination accesses.

gcc/testsuite/
PR target/96808
* gcc.target/powerpc/pr96808.c: New test.

(cherry picked from commit 8bc0f24d7a20d89383859907b875a26ce59dc6c8)

3 years agolibstdc++: Replace __int_limits with __numeric_traits_integer
Jonathan Wakely [Tue, 7 Jul 2020 22:26:38 +0000 (23:26 +0100)]
libstdc++: Replace __int_limits with __numeric_traits_integer

I recently added std::__detail::__int_limits as a lightweight
alternative to std::numeric_limits, forgetting that the values it
provides (digits, min and max) are already provided by
__gnu_cxx::__numeric_traits.

This change adds __int_traits as an alias for __numeric_traits_integer.
This avoids instantiating __numeric_traits to decide whether to use
__numeric_traits_integer or __numeric_traits_floating. Then all uses of
__int_limits can be replaced with __int_traits, and __int_limits can be
removed.

libstdc++-v3/ChangeLog:

* include/Makefile.am: Remove bits/int_limits.h.
* include/Makefile.in: Regenerate.
* include/bits/int_limits.h: Removed.
* include/bits/parse_numbers.h (_Select_int_base): Replace
__int_limits with __int_traits.
* include/bits/range_access.h (_SSize::operator()): Likewise.
* include/ext/numeric_traits.h (__numeric_traits_integer): Add
static assertion.
(__int_traits): New alias template.
* include/std/bit (__rotl, __rotr, __countl_zero, __countl_one)
(__countr_zero, __countr_one, __popcount, __bit_ceil)
(__bit_floor, __bit_width) Replace __int_limits with
__int_traits.
* include/std/charconv (__to_chars_8, __from_chars_binary)
(__from_chars_alpha_to_num, from_chars): Likewise.
* include/std/memory_resource (polymorphic_allocator::allocate)
(polymorphic_allocator::allocate_object): Likewise.
* include/std/string_view (basic_string_view::_S_compare):
Likewise.
* include/std/utility (cmp_equal, cmp_less, in_range): Likewise.

(cherry picked from commit eb04805be4029716e76532babc0fa9ecb18de96e)

3 years agoDaily bump.
GCC Administrator [Thu, 3 Sep 2020 00:17:00 +0000 (00:17 +0000)]
Daily bump.

3 years agolibstdc++: Fix std::gcd and std::lcm for unsigned integers [PR 92978]
Jonathan Wakely [Fri, 28 Aug 2020 21:45:24 +0000 (22:45 +0100)]
libstdc++: Fix std::gcd and std::lcm for unsigned integers [PR 92978]

This fixes a bug with mixed signed and unsigned types, where converting
a negative value to the unsigned result type alters the value. The
solution is to obtain the absolute values of the arguments immediately
and to perform the actual GCD or LCM algorithm on two arguments of the
same type.

In order to operate on the most negative number without overflow when
taking its absolute, use an unsigned type for the result of the abs
operation. For example, -INT_MIN will overflow, but -(unsigned)INT_MIN
is (unsigned)INT_MAX+1U which is the correct value.

libstdc++-v3/ChangeLog:

PR libstdc++/92978
* include/std/numeric (__abs_integral): Replace with ...
(__detail::__absu): New function template that returns an
unsigned type, guaranteeing it can represent the most
negative signed value.
(__detail::__gcd, __detail::__lcm): Require arguments to
be unsigned and therefore already non-negative.
(gcd, lcm): Convert arguments to absolute value as unsigned
type before calling __detail::__gcd or __detail::__lcm.
* include/experimental/numeric (gcd, lcm): Likewise.
* testsuite/26_numerics/gcd/gcd_neg.cc: Adjust expected
errors.
* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
* testsuite/26_numerics/gcd/92978.cc: New test.
* testsuite/26_numerics/lcm/92978.cc: New test.
* testsuite/experimental/numeric/92978.cc: New test.

(cherry picked from commit 82db1a42e9254c9009bbf8ac01366da4d1ab6df5)

3 years agolibstdc++: Fix three-way comparison for std::array [PR 96851]
Jonathan Wakely [Wed, 2 Sep 2020 14:17:24 +0000 (15:17 +0100)]
libstdc++: Fix three-way comparison for std::array [PR 96851]

The spaceship operator for std::array uses memcmp when the
__is_byte<value_type> trait is true, but memcmp isn't usable in
constexpr contexts. Also, memcmp should only be used for unsigned byte
types, because it gives the wrong answer for signed chars with negative
values.

We can simply check std::is_constant_evaluated() so that we don't use
memcmp during constant evaluation.

To fix the problem of using memcmp for inappropriate types, this patch
adds new __is_memcmp_ordered and __is_memcmp_ordered_with traits. These
say whether using memcmp will give the right answer for ordering
operations such as lexicographical_compare and three-way comparisons.
The new traits can be used in several places.

Unlike the trunk commit this was backported from, this commit for the
branch doesn't extend the memcmp optimisations to all unsigned integers
on big endian targets. Only narrow character types and std::byte will
use memcmp.

libstdc++-v3/ChangeLog:

PR libstdc++/96851
* include/bits/cpp_type_traits.h (__is_memcmp_ordered):
New trait that says if memcmp can be used for ordering.
(__is_memcmp_ordered_with): Likewise, for two types.
* include/bits/ranges_algo.h (__lexicographical_compare_fn):
Use new traits instead of __is_byte and __numeric_traits.
* include/bits/stl_algobase.h (__lexicographical_compare_aux1)
(__is_byte_iter): Likewise.
* include/std/array (operator<=>): Likewise. Only use memcmp
when std::is_constant_evaluated() is false.
* testsuite/23_containers/array/comparison_operators/96851.cc:
New test.
* testsuite/23_containers/array/tuple_interface/get_neg.cc:
Adjust dg-error line numbers.

(cherry picked from commit 2f983fa69005b603ea1758a013b4134d5b0f24a8)

3 years agolibstdc++: Use __throw_exception_again macro for -fno-exceptions
Jonathan Wakely [Wed, 2 Sep 2020 13:50:34 +0000 (14:50 +0100)]
libstdc++: Use __throw_exception_again macro for -fno-exceptions

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (counted_iterator::operator++(int)):
Use __throw_exception_again macro.

3 years agobpf: use the default asm_named_section target hook
Jose E. Marchesi [Wed, 2 Sep 2020 07:12:51 +0000 (09:12 +0200)]
bpf: use the default asm_named_section target hook

This patch makes the BPF backend to not provide its own implementation
of the asm_named_section hook; the default handler works perfectly
well.

2020-09-02  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.c (bpf_asm_named_section): Delete.
(TARGET_ASM_NAMED_SECTION): Likewise.

(cherry picked from commit 7047a8bab6e41fe9f5dbb29ca170ce416e08dd11)

3 years agobpf: use elfos.h
Jose E. Marchesi [Wed, 2 Sep 2020 07:12:21 +0000 (09:12 +0200)]
bpf: use elfos.h

BPF is an ELF-based target, so it definitely benefits from using
elfos.h.  This patch makes the target to use it, and removes
superfluous definitions from bpf.h which are better defined in
elfos.h.

Note that BPF, despite being an ELF target, doesn't use DWARF.  At
some point it will generate DWARF when generating xBPF (-mxbpf) and
BTF when generating plain eBPF, but for the time being it just
generates stabs.

2020-09-02  Jose E. Marchesi  <jemarch@gnu.org>

gcc/
* config.gcc: Use elfos.h in bpf-*-* targets.
* config/bpf/bpf.h (MAX_OFILE_ALIGNMENT): Remove definition.
(COMMON_ASM_OP): Likewise.
(INIT_SECTION_ASM_OP): Likewise.
(FINI_SECTION_ASM_OP): Likewise.
(ASM_OUTPUT_SKIP): Likewise.
(ASM_OUTPUT_ALIGNED_COMMON): Likewise.
(ASM_OUTPUT_ALIGNED_LOCAL): Likewise.

(cherry picked from commit c9d440223594cbf955177628d62a667727a1780a)

3 years agoDaily bump.
GCC Administrator [Wed, 2 Sep 2020 00:17:02 +0000 (00:17 +0000)]
Daily bump.

3 years agoFortran : ICE on invalid code PR95398
Mark Eggleston [Mon, 1 Jun 2020 07:15:31 +0000 (08:15 +0100)]
Fortran  : ICE on invalid code PR95398

The CLASS_DATA macro is used to shorten the code accessing the derived
components of an expressions type specification.  If the type is not
BT_CLASS the derived pointer is NULL resulting in an ICE.  To avoid
dereferencing a NULL pointer the type should be BT_CLASS.

2020-09-01  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran

PR fortran/95398
* resolve.c (resolve_select_type): Add check for BT_CLASS
type before using the CLASS_DATA macro which will have a
NULL pointer to derive components if it isn't BT_CLASS.

2020-09-01  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite

PR fortran/95398
* gfortran.dg/pr95398.f90: New test.

(cherry picked from commit 3d137b75febd1a4ad70bcc64e0f79198f5571b86)

3 years agoAdd missing vn_reference_t::punned initialization
Martin Liska [Thu, 13 Aug 2020 11:05:12 +0000 (13:05 +0200)]
Add missing vn_reference_t::punned initialization

gcc/ChangeLog:

PR tree-optimization/96597
* tree-ssa-sccvn.c (vn_reference_lookup_call): Add missing
initialization of ::punned.
(vn_reference_insert): Use consistently false instead of 0.
(vn_reference_insert_pieces): Likewise.

(cherry picked from commit adc646b10c7168c3c95373ee9321e3760fc4c5f1)

3 years agotree-optimization/88240 - stopgap for floating point code-hoisting issues
Richard Biener [Tue, 4 Aug 2020 12:10:45 +0000 (14:10 +0200)]
tree-optimization/88240 - stopgap for floating point code-hoisting issues

This adds a stopgap measure to avoid performing code-hoisting
on mixed type loads when the load we'd insert in the hoisting
position would be a floating point one.  This is because certain
targets (hello x87) cannot perform floating point loads without
possibly altering the bit representation and thus cannot be used
in place of integral loads.

2020-08-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/88240
* tree-ssa-sccvn.h (vn_reference_s::punned): New flag.
* tree-ssa-sccvn.c (vn_reference_insert): Initialize punned.
(vn_reference_insert_pieces): Likewise.
(visit_reference_op_call): Likewise.
(visit_reference_op_load): Track whether a ref was punned.
* tree-ssa-pre.c (do_hoist_insertion): Refuse to perform hoist
insertion on punned floating point loads.

* gcc.target/i386/pr88240.c: New testcase.

(cherry picked from commit 1af5cdd77985daf76130f527deac425c43df9f49)

3 years agoDaily bump.
GCC Administrator [Tue, 1 Sep 2020 00:16:59 +0000 (00:16 +0000)]
Daily bump.

3 years agotree-optimization/96854 - SLP reduction of two-operator is broken
Richard Biener [Mon, 31 Aug 2020 11:36:09 +0000 (13:36 +0200)]
tree-optimization/96854 - SLP reduction of two-operator is broken

This fixes SLP reduction of two-operator operations by marking those
not supported.  In fact any live lane out of such an operation cannot
be code-generated correctly.

2020-08-31  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96854
* tree-vect-loop.c (vectorizable_live_operation): Disallow
SLP_TREE_TWO_OPERATORS nodes.

* gcc.dg/vect/pr96854.c: New testcase.

3 years agoRefine expander vec_unpacku_float_hi_v16si/vec_unpacku_float_lo_v16si
liuhongt [Tue, 11 Aug 2020 03:05:40 +0000 (11:05 +0800)]
Refine expander vec_unpacku_float_hi_v16si/vec_unpacku_float_lo_v16si

gcc/
PR target/96551
* config/i386/sse.md (vec_unpacku_float_hi_v16si): For vector
compare to integer mask, don't use gen_rtx_LT, use
ix86_expand_mask_vec_cmp instead.
(vec_unpacku_float_hi_v16si): Ditto.

gcc/testsuite
* gcc.target/i386/avx512f-pr96551-1.c: New test.
* gcc.target/i386/avx512f-pr96551-2.c: New test.

3 years agoFortran: Fix absent-optional handling for nondescriptor arrays (PR94672)
Tobias Burnus [Fri, 28 Aug 2020 11:54:10 +0000 (13:54 +0200)]
Fortran: Fix absent-optional handling for nondescriptor arrays (PR94672)

gcc/fortran/ChangeLog:

PR fortran/94672
* trans-array.c (gfc_trans_g77_array): Check against the parm decl and
set the nonparm decl used for the is-present check to NULL if absent.

gcc/testsuite/ChangeLog:

PR fortran/94672
* gfortran.dg/optional_assumed_charlen_2.f90: New test.

(cherry picked from commit cb3c3d63315ceb4dc262e5efb83b42c73c43387d)

3 years agoDaily bump.
GCC Administrator [Mon, 31 Aug 2020 00:16:55 +0000 (00:16 +0000)]
Daily bump.

3 years agod: Fix no NRVO when returning an array of a non-POD struct
Iain Buclaw [Mon, 24 Aug 2020 22:39:17 +0000 (00:39 +0200)]
d: Fix no NRVO when returning an array of a non-POD struct

TREE_ADDRESSABLE was not propagated from the RECORD_TYPE to the ARRAY_TYPE, so
NRVO code generation was not being triggered.

gcc/d/ChangeLog:

PR d/96157
* d-codegen.cc (d_build_call): Handle TREE_ADDRESSABLE static arrays.
* types.cc (make_array_type): Propagate TREE_ADDRESSABLE from base
type to static array.

gcc/testsuite/ChangeLog:

PR d/96157
* gdc.dg/pr96157a.d: New test.
* gdc.dg/pr96157b.d: New test.

(cherry picked from commit 312ad889e99ff9458c01518325775e75ab57f272)

3 years agod: Limit recursive expansion to a common global limit.
Iain Buclaw [Tue, 25 Aug 2020 09:44:48 +0000 (11:44 +0200)]
d: Limit recursive expansion to a common global limit.

Fixes both a bug where compilation would hang, and an issue where recursive
template limits are hit too early.

gcc/d/ChangeLog:

* dmd/globals.h (Global): Add recursionLimit.
* dmd/dmacro.c (Macro::expand): Limit recursive expansion to
global.recursionLimit.
* dmd/dtemplate.c (deduceType): Likewise.
(TemplateInstance::tryExpandMembers): Likewise.
(TemplateInstance::trySemantic3): Likewise.
(TemplateMixin::semantic): Likewise.
* dmd/expressionsem.c (ExpressionSemanticVisitor::visit): Likewise.
* dmd/mtype.c (Type::noMember): Likewise.
(TypeFunction::semantic): Likewise.
* dmd/optimize.c (Expression_optimize): Likewise.

gcc/testsuite/ChangeLog:

* gdc.test/compilable/ice20092.d: New test.

(cherry picked from commit 0f5c98b6a1a7eed281e359f40bc2e4326f2a2f56)

3 years agod: Use read() to load contents of stdin into memory.
Iain Buclaw [Tue, 25 Aug 2020 09:23:24 +0000 (11:23 +0200)]
d: Use read() to load contents of stdin into memory.

This would be an improvement over reading one character at a time.

An ICE was discovered when mixing reading from stdin with `-v', this has been
fixed in upstream DMD and backported as well.

Reviewed-on: https://github.com/dlang/dmd/pull/11620

gcc/d/ChangeLog:

* d-lang.cc (d_parse_file): Use read() to load contents from stdin,
allow the front-end to free the memory after parsing.
* dmd/func.c (FuncDeclaration::semantic): Use module filename if
searchPath returns NULL.

(cherry picked from commit 7421802276e737c2da297599121480833db92de9)

3 years agoDaily bump.
GCC Administrator [Sun, 30 Aug 2020 00:16:55 +0000 (00:16 +0000)]
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 29 Aug 2020 00:16:54 +0000 (00:16 +0000)]
Daily bump.

4 years agoAdd expander for movp2hi and movp2qi.
liuhongt [Wed, 26 Aug 2020 07:24:10 +0000 (15:24 +0800)]
Add expander for movp2hi and movp2qi.

2020-08-30  Uros Bizjak    <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/96744
* config/i386/i386-expand.c (split_double_mode): Also handle
E_P2HImode and E_P2QImode.
* config/i386/sse.md (MASK_DWI): New define_mode_iterator.
(mov<mode>): New expander for P2HI,P2QI.
(*mov<mode>_internal): New define_insn_and_split to split
movement of P2QI/P2HI to 2 movqi/movhi patterns after reload.

gcc/testsuite/ChangeLog:

* gcc.target/i386/double_mask_reg-1.c: New test.

4 years agoFix: AVX512VP2INTERSECT should imply AVX512DQ.
liuhongt [Fri, 28 Aug 2020 07:01:18 +0000 (15:01 +0800)]
Fix: AVX512VP2INTERSECT should imply AVX512DQ.

gcc/ChangeLog

* common/config/i386/i386-common.c (ix86_handle_option): Set
AVX512DQ when AVX512VP2INTERSECT exists.

4 years agoDaily bump.
GCC Administrator [Fri, 28 Aug 2020 00:16:56 +0000 (00:16 +0000)]
Daily bump.

4 years agoFix shadd-2.c scan assembler count.
John David Anglin [Thu, 27 Aug 2020 19:49:15 +0000 (19:49 +0000)]
Fix shadd-2.c scan assembler count.

2020-08-27  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/
* gcc.target/hppa/shadd-2.c: Adjust times to 4.

4 years agors6000, restrict bfloat convert intrinsic to Power 10.
Carl Love [Mon, 24 Aug 2020 16:48:11 +0000 (11:48 -0500)]
rs6000, restrict bfloat convert intrinsic to Power 10.

gcc/ChangeLog

2020-08-26  Carl Love  <cel@us.ibm.com>
* config/rs6000/rs6000-builtin.def: (BU_P10V_VSX_1) New builtin
macro expansion.
(XVCVBF16SPN, XVCVSPBF16): Replace macro expansion BU_VSX_1 with
BU_P10V_VSX_1.
* config/rs6000/rs6000-call.c: (VSX_BUILTIN_XVCVSPBF16,
VSX_BUILTIN_XVCVBF16SPN): Replace with P10V_BUILTIN_XVCVSPBF16,
P10V_BUILTIN_XVCVBF16SPN respectively.

4 years agoFortran : ICE for division by zero in declaration PR95882
Mark Eggleston [Fri, 21 Aug 2020 05:39:30 +0000 (06:39 +0100)]
Fortran  : ICE for division by zero in declaration PR95882

A length expression containing a divide by zero in a character
declaration will result in an ICE if the constant is anymore
complicated that a contant divided by a constant.

The cause was that char_len_param_value can return MATCH_YES
even if a divide by zero was seen.  Prior to returning check
whether a divide by zero was seen and if so set it to MATCH_ERROR.

2020-08-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/fortran

PR fortran/95882
* decl.c (char_len_param_value): Check gfc_seen_div0 and
if it is set return MATCH_ERROR.

2020-08-27  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/95882
* gfortran.dg/pr95882_1.f90: New test.
* gfortran.dg/pr95882_2.f90: New test.
* gfortran.dg/pr95882_3.f90: New test.
* gfortran.dg/pr95882_4.f90: New test.
* gfortran.dg/pr95882_5.f90: New test.

(cherry picked from commit c336eda750d4e7a0827fedf995da955d6d88d5ca)

4 years agoarm: Fix -mpure-code support/-mslow-flash-data for armv8-m.base [PR94538]
Christophe Lyon [Wed, 19 Aug 2020 09:02:21 +0000 (09:02 +0000)]
arm: Fix -mpure-code support/-mslow-flash-data for armv8-m.base [PR94538]

armv8-m.base (cortex-m23) has the movt instruction, so we need to
disable the define_split to generate a constant in this case,
otherwise we get incorrect insn constraints as described in PR94538.

We also need to fix the pure-code alternative for thumb1_movsi_insn
because the assembler complains with instructions like
movs r0, #:upper8_15:1234
(Internal error in md_apply_fix)
We now generate movs r0, 4 instead.

2020-08-24  Christophe Lyon  <christophe.lyon@linaro.org>

PR target/94538
gcc/
* config/arm/thumb1.md: Disable set-constant splitter when
TARGET_HAVE_MOVT.
(thumb1_movsi_insn): Fix -mpure-code
alternative.

PR target/94538
gcc/testsuite/
* gcc.target/arm/pure-code/pr94538-1.c: New test.
* gcc.target/arm/pure-code/pr94538-2.c: New test.

(cherry picked from commit 259d072067997ab8f55afcf735c91b6740fd0425)

4 years agoDaily bump.
GCC Administrator [Thu, 27 Aug 2020 00:17:01 +0000 (00:17 +0000)]
Daily bump.

4 years agolibstdc++: Enable assertions in constexpr string_view members [PR 71960]
Jonathan Wakely [Wed, 26 Aug 2020 13:47:51 +0000 (14:47 +0100)]
libstdc++: Enable assertions in constexpr string_view members [PR 71960]

Since GCC 6.1 there is no reason we can't just use __glibcxx_assert in
constexpr functions in string_view. As long as the condition is true,
there will be no call to std::__replacement_assert that would make the
function ineligible for constant evaluation.

PR libstdc++/71960
* include/experimental/string_view (basic_string_view):
Enable debug assertions.
* include/std/string_view (basic_string_view):
Likewise.

(cherry picked from commit 3eefb302d2bd8502cb3d8fe44e672b11092ccaf6)

4 years agolibstdc++: Make variant_npos conversions explicit [PR 96766]
Jonathan Wakely [Mon, 24 Aug 2020 15:10:07 +0000 (16:10 +0100)]
libstdc++: Make variant_npos conversions explicit [PR 96766]

libstdc++-v3/ChangeLog:

PR libstdc++/96766
* include/std/variant (_Variant_storage): Replace implicit
conversions from size_t to __index_type with explicit casts.

(cherry picked from commit 074436cf8cdd2a9ce75cadd36deb8301f00e55b9)

4 years agohppa: PR middle-end/87256: Improved hppa_rtx_costs avoids synth_mult madness.
Roger Sayle [Wed, 26 Aug 2020 06:21:08 +0000 (07:21 +0100)]
hppa: PR middle-end/87256: Improved hppa_rtx_costs avoids synth_mult madness.

Backport from master:

2020-08-26  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR middle-end/87256
* config/pa/pa.c (hppa_rtx_costs_shadd_p): New helper function
to check for coefficients supported by shNadd and shladd,l.
(hppa_rtx_costs):  Rewrite to avoid using estimates based upon
FACTOR and enable recursing deeper into RTL expressions.
* config/pa/pa.md (shd_internal): Fix define_expand to provide
gen_shd_internal.

4 years agohppa: Improve expansion of ashldi3 when !TARGET_64BIT
Roger Sayle [Wed, 26 Aug 2020 06:15:15 +0000 (07:15 +0100)]
hppa: Improve expansion of ashldi3 when !TARGET_64BIT

Backport from master:

2020-08-26  Roger Sayle  <roger@nextmovesoftware.com>

* config/pa/pa.md (ashldi3): Additionally, on !TARGET_64BIT
generate a two instruction shd/zdep sequence when shifting
registers by suitable constants.
(shd_internal): New define_expand to provide gen_shd_internal.

4 years agoDaily bump.
GCC Administrator [Wed, 26 Aug 2020 00:17:09 +0000 (00:17 +0000)]
Daily bump.

4 years agogimple: Ignore *0 = {CLOBBER} in path isolation [PR96722]
Jakub Jelinek [Tue, 25 Aug 2020 11:49:40 +0000 (13:49 +0200)]
gimple: Ignore *0 = {CLOBBER} in path isolation [PR96722]

Clobbers of MEM_REF with NULL address are just fancy nops, something we just
ignore and don't emit any code for it (ditto for other clobbers), they just
mark end of life on something, so we shouldn't infer from those that there
is some UB.

2020-08-25  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/96722
* gimple.c (infer_nonnull_range): Formatting fix.
(infer_nonnull_range_by_dereference): Return false for clobber stmts.

* g++.dg/opt/pr96722.C: New test.

(cherry picked from commit a5b15fcb954ba63d58f0daa700281aba33b5f24a)

4 years agostrlen: Fix handle_builtin_string_cmp [PR96758]
Jakub Jelinek [Tue, 25 Aug 2020 11:47:10 +0000 (13:47 +0200)]
strlen: Fix handle_builtin_string_cmp [PR96758]

The following testcase is miscompiled, because handle_builtin_string_cmp
sees a strncmp call with constant last argument 4, where one of the strings
has an upper bound of 5 bytes (due to it being an array of that size) and
the other has a known string length of 1 and the result is used only in
equality comparison.
It is folded into __builtin_strncmp_eq (str1, str2, 4), which is
incorrect, because that means reading 4 bytes from both strings and
comparing that.  When one of the strings has known strlen of 1, we want to
compare just 2 bytes, not 4, as strncmp shouldn't compare any bytes beyond
the null.
So, the last argument to __builtin_strncmp_eq should be the minimum of the
provided strncmp last argument and the known string length + 1 (assuming
the other string has only a known upper bound due to array size).

Besides that, I've noticed the code has been written with the intent to also
support the case where we know exact string length of both strings (but not
the string content, so we can't compute it at compile time).  In that case,
both cstlen1 and cstlen2 are non-negative and both arysiz1 and arysiz2 are
negative.  We wouldn't optimize that, cmpsiz would be either the strncmp
last argument, or for strcmp the first string length, but varsiz would be
-1 and thus cmpsiz would be never < varsiz.  The patch fixes it by using the
correct length, in that case using the minimum of the two and for strncmp
also the last argument.

2020-08-25  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/96758
* tree-ssa-strlen.c (handle_builtin_string_cmp): If both cstlen1
and cstlen2 are set, set cmpsiz to their minimum, otherwise use the
one that is set.  If bound is used and smaller than cmpsiz, set cmpsiz
to bound.  If both cstlen1 and cstlen2 are set, perform the optimization.

* gcc.dg/strcmpopt_12.c: New test.

(cherry picked from commit f982a6ec9b6d98f5f37114b1d7455c54ce5056b8)

4 years agogimple-fold: Don't optimize wierdo floating point value reads [PR95450]
Jakub Jelinek [Tue, 25 Aug 2020 05:17:10 +0000 (07:17 +0200)]
gimple-fold: Don't optimize wierdo floating point value reads [PR95450]

My patch to introduce native_encode_initializer to fold_ctor_reference
apparently broke gnulib/m4 on powerpc64.
There it uses a const union with two doubles and corresponding IBM double
double long double which actually is the largest normalizable long double
value (1 ulp higher than __LDBL_MAX__).  The reason our __LDBL_MAX__ is
smaller is that we internally treat the double double type as one having
106-bit precision, but it actually has a variable 53-bit to 2000-ish bit precision
and for the
0x1.fffffffffffff7ffffffffffffc000p+1023L
value gnulib uses we need 107-bit precision, therefore for GCC __LDBL_MAX__
is
0x1.fffffffffffff7ffffffffffff8000p+1023L
Before my changes, we wouldn't be able to fold_ctor_reference it and it
worked fine at runtime, but with the change we are able to do that, but
because it is larger than anything we can handle internally, we treat it
weirdly.  Similar problem would be if somebody creates this way valid,
but much more than 106 bit precision e.g. 1.0 + 1.0e-768.
Now, I think similar problem could happen e.g. on i?86/x86_64 with long
double there, it also has some weird values in the format, e.g. the
unnormals, pseudo infinities and various other magic values.

This patch for floating point types (including vector and complex types
with such elements) will try to encode the returned value again and punt
if it has different memory representation from the original.  Note, this
is only done in the path where native_encode_initializer was used, in order
not to affect e.g. just reading an unpunned long double value; the value
should be compiler generated in that case and thus should be properly
representable.  It will punt also if e.g. the padding bits are initialized
to non-zero values.

I think the verification that what we encode can be interpreted back
woiuld be only an internal consistency check (so perhaps for ENABLE_CHECKING
if flag_checking only, but if both directions perform it, then we need
to avoid mutual recursion).
While for the other direction (interpretation), at least for the broken by
design long doubles we just know we can't represent in GCC all valid values.
The other floating point formats are just theoretical case, perhaps we would
canonicalize something to a value that wouldn't trigger invalid exception
when without canonicalization it would trigger it at runtime, so let's just
ignore those.

Adjusted (so far untested) patch to do it in native_interpret_real instead
and limit it to the MODE_COMPOSITE_P cases, for which e.g.
fold-const.c/simplify-rtx.c punts in several other places too because we just
know we can't represent everything.

E.g.
      /* Don't constant fold this floating point operation if the
         result may dependent upon the run-time rounding mode and
         flag_rounding_math is set, or if GCC's software emulation
         is unable to accurately represent the result.  */
      if ((flag_rounding_math
           || (MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations))
          && (inexact || !real_identical (&result, &value)))
        return NULL_TREE;
Or perhaps guard it with MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations
too, thus break what gnulib / m4 does with -ffast-math, but not normally?

2020-08-25  Jakub Jelinek  <jakub@redhat.com>

PR target/95450
* fold-const.c (native_interpret_real): For MODE_COMPOSITE_P modes
punt if the to be returned REAL_CST does not encode to the bitwise
same representation.

* gcc.target/powerpc/pr95450.c: New test.

(cherry picked from commit 9f2f79df19fbfaa1c4be313c2f2b5ce04646433e)

4 years agoc: Fix -Wunused-but-set-* warning with _Generic [PR96571]
Jakub Jelinek [Tue, 18 Aug 2020 05:51:58 +0000 (07:51 +0200)]
c: Fix -Wunused-but-set-* warning with _Generic [PR96571]

The following testcase shows various problems with -Wunused-but-set*
warnings and _Generic construct.  I think it is best to treat the selector
and the ignored expressions as (potentially) read, because when they are
parsed, the vars in there are already marked as TREE_USED.

2020-08-18  Jakub Jelinek  <jakub@redhat.com>

PR c/96571
* c-parser.c (c_parser_generic_selection): Change match_found from bool
to int, holding index of the match.  Call mark_exp_read on the selector
expression and on expressions other than the selected one.

* gcc.dg/Wunused-var-4.c: New test.

(cherry picked from commit 6d42cbe5ad7a7b46437f2576c9920e44dc14b386)

4 years agoFix up flag_cunroll_grow_size handling in presence of optimize attr [PR96535]
Jakub Jelinek [Wed, 12 Aug 2020 15:00:41 +0000 (17:00 +0200)]
Fix up flag_cunroll_grow_size handling in presence of optimize attr [PR96535]

As the testcase in the PR shows (not included in the patch, as
it seems quite fragile to observe unrolling in the IL), the introduction of
flag_cunroll_grow_size broke optimize attribute related to loop unrolling.
The problem is that the new option flag is set (if not set explicitly) only
in process_options and in rs6000_option_override_internal (and there only if
global_init_p).  So, this means that while it is Optimization option, it
will only be set based on the command line -funroll-loops/-O3/-fpeel-loops
or -funroll-all-loops, which means that if command line does include any of
those, it is enabled even for functions that will through optimize attribute
have all of those disabled, and if command line does not include those,
it will not be enabled for functions that will through optimize attribute
have any of those enabled.

process_options is called just once, so IMHO it should be handling only
non-Optimization option adjustments (various other options suffer from that
too, but as this is a regression from 10.1 on the 10 branch, changing those
is not appropriate).  Similarly, rs6000_option_override_internal is called
only once (with global_init_p) and then for target attribute handling, but
not for optimize attribute handling.

This patch moves the unrolling related handling from process_options into
finish_options which is invoked whenever the options are being finalized,
and the rs6000 specific parts into the override_options_after_change hook
which is called for optimize attribute handling (and unfortunately also
th cfun changes, but what the hook does is cheap) and I've added a call to
that from rs6000_override_options_internal, so it is also called on cmdline
processing and for target attribute.

Furthermore, it stops using AUTODETECT_VALUE, which can work only once,
and instead uses the global_options_set.x_... flags.

2020-08-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/96535
* toplev.c (process_options): Move flag_unroll_loops and
flag_cunroll_grow_size handling from here to ...
* opts.c (finish_options): ... here.  For flag_cunroll_grow_size,
don't check for AUTODETECT_VALUE, but instead check
opts_set->x_flag_cunroll_grow_size.
* common.opt (funroll-completely-grow-size): Default to 0.
* config/rs6000/rs6000.c (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE):
Redefine.
(rs6000_override_options_after_change): New function.
(rs6000_option_override_internal): Call it.  Move there the
flag_cunroll_grow_size, unroll_only_small_loops and
flag_rename_registers handling.

(cherry picked from commit fe9458c280dbd6e8b892db4ca3b64185049c376b)

4 years agoc-family: Fix ICE in get_atomic_generic_size [PR96545]
Jakub Jelinek [Tue, 11 Aug 2020 14:46:49 +0000 (16:46 +0200)]
c-family: Fix ICE in get_atomic_generic_size [PR96545]

As the testcase shows, we would ICE if the type of the first argument of
various atomic builtins was pointer to (non-void) incomplete type, we would
assume that TYPE_SIZE_UNIT must be non-NULL.  This patch diagnoses it
instead.  And also changes the TREE_CODE != INTEGER_CST check to
!tree_fits_uhwi_p, as we use tree_to_uhwi after this and at least in theory
the int could be too large and not fit.

2020-08-11  Jakub Jelinek  <jakub@redhat.com>

PR c/96545
* c-common.c (get_atomic_generic_size): Require that first argument's
type points to a complete type and use tree_fits_uhwi_p instead of
just INTEGER_CST TREE_CODE check for the TYPE_SIZE_UNIT.

* c-c++-common/pr96545.c: New test.

(cherry picked from commit 7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae)

4 years agotree: Fix up get_narrower [PR96549]
Jakub Jelinek [Tue, 11 Aug 2020 11:46:14 +0000 (13:46 +0200)]
tree: Fix up get_narrower [PR96549]

My changes to get_narrower to support COMPOUND_EXPRs apparently
used a wrong type for the COMPOUND_EXPRs, while e.g. the rhs
type was unsigned short, the COMPOUND_EXPR got int type as that was the
original type of op.  The type of COMPOUND_EXPR should be always the type
of the rhs.

2020-08-11  Jakub Jelinek  <jakub@redhat.com>

PR c/96549
* tree.c (get_narrower): Use TREE_TYPE (ret) instead of
TREE_TYPE (win) for COMPOUND_EXPRs.

* gcc.c-torture/execute/pr96549.c: New test.

(cherry picked from commit 6b815e113c9aec397a86d7194f66455eb189cc7a)

4 years agoc++: Fix constexpr evaluation of SPACESHIP_EXPR [PR96497]
Jakub Jelinek [Mon, 10 Aug 2020 15:53:46 +0000 (17:53 +0200)]
c++: Fix constexpr evaluation of SPACESHIP_EXPR [PR96497]

The following valid testcase is rejected, because cxx_eval_binary_expression
is called on the SPACESHIP_EXPR with lval = true, as the address of the
spaceship needs to be passed to a method call.
After recursing on the operands and calling genericize_spaceship which turns
it into a TARGET_EXPR with initialization, we call cxx_eval_constant_expression
on it which succeeds, but then we fall through into code that will
VERIFY_CONSTANT (r) which FAILs because it is an address of a variable.  Rather
than avoiding that for lval = true and SPACESHIP_EXPR, the patch just tail
calls cxx_eval_constant_expression - I believe that call should perform all
the needed verifications.

2020-08-10  Jakub Jelinek  <jakub@redhat.com>

PR c++/96497
* constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
call cxx_eval_constant_expression after genericize_spaceship to avoid
undesirable further VERIFY_CONSTANT.

* g++.dg/cpp2a/spaceship-constexpr3.C: New test.

(cherry picked from commit 5c64df80df274c753bfc8415bd902e1180e76f6a)

4 years agoopenmp: Handle clauses with gimple sequences in convert_nonlocal_omp_clauses properly
Jakub Jelinek [Sat, 8 Aug 2020 09:10:30 +0000 (11:10 +0200)]
openmp: Handle clauses with gimple sequences in convert_nonlocal_omp_clauses properly

If the walk_body on the various sequences of reduction, lastprivate and/or linear
clauses needs to create a temporary variable, we should declare that variable
in that sequence rather than outside, where it would need to be privatized inside of
the construct.

2020-08-08  Jakub Jelinek  <jakub@redhat.com>

PR fortran/93553
* tree-nested.c (convert_nonlocal_omp_clauses): For
OMP_CLAUSE_REDUCTION, OMP_CLAUSE_LASTPRIVATE and OMP_CLAUSE_LINEAR
save info->new_local_var_chain around walks of the clause gimple
sequences and declare_vars if needed into the sequence.

2020-08-08  Tobias Burnus  <tobias@codesourcery.com>

PR fortran/93553
* testsuite/libgomp.fortran/pr93553.f90: New test.

(cherry picked from commit 676b5525e8333005bdc1c596ed086f1da27a450f)

4 years agoopenmp: Handle reduction clauses on host teams construct [PR96459]
Jakub Jelinek [Wed, 5 Aug 2020 08:40:10 +0000 (10:40 +0200)]
openmp: Handle reduction clauses on host teams construct [PR96459]

As the new testcase shows, we weren't actually performing reductions on
host teams construct.  And fixing that revealed a flaw in the for-14.c testcase.
The problem is that the tests perform also initialization and checking around the
calls to the functions with the OpenMP constructs.  In that testcase, all the
tests have been spawned from a teams construct but only the tested loops were
distribute, which means the initialization and checking has been performed
redundantly and racily in each team.  Fixed by performing the initialization
and checking outside of host teams and only do the calls to functions with
the tested constructs inside of host teams.

2020-08-05  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/96459
* omp-low.c (lower_omp_taskreg): Call lower_reduction_clauses even in
for host teams.

* testsuite/libgomp.c/teams-3.c: New test.
* testsuite/libgomp.c-c++-common/for-2.h (OMPTEAMS): Define to nothing
if not defined yet.
(N(test)): Use it before all N(f*) calls.
* testsuite/libgomp.c-c++-common/for-14.c (DO_PRAGMA, OMPTEAMS): Define.
(main): Don't call all test_* functions from within
#pragma omp teams reduction(|:err), call them directly.

(cherry picked from commit 916c7a201a9a1dc94f2c056a773826a26d1daca9)

4 years agosra: Bail out when encountering accesses with negative offsets (PR 96730)
Martin Jambor [Tue, 25 Aug 2020 14:11:56 +0000 (16:11 +0200)]
sra: Bail out when encountering accesses with negative offsets (PR 96730)

I must admit I was quite surprised to see that SRA does not disqualify
an aggregate from any transformations when it encounters an offset for
which get_ref_base_and_extent returns a negative offset.  It may not
matter too much because I sure hope such programs always have
undefined behavior (SRA candidates are local variables on stack) but
it is probably better not to perform weird transformations on them as
build ref model with the new build_reconstructed_reference function
currently happily do for negative offsets (they just copy the existing
expression which is then used as the expression of a "propagated"
access) and of course the compiler must not ICE (as it currently does
because the SRA forest verifier does not like the expression).

gcc/ChangeLog:

2020-08-24  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/96730
* tree-sra.c (create_access): Disqualify any aggregate with negative
offset access.
(build_ref_for_model): Add assert that offset is non-negative.

gcc/testsuite/ChangeLog:

2020-08-24  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/96730
* gcc.dg/tree-ssa/pr96730.c: New test.

(cherry picked from commit 556600286dd312d3ddf3d673a8579576862663e3)

4 years agoDaily bump.
GCC Administrator [Tue, 25 Aug 2020 00:16:57 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: Emit as-base 'tor symbols for final class. [PR95428]
Jason Merrill [Fri, 21 Aug 2020 20:23:03 +0000 (16:23 -0400)]
c++: Emit as-base 'tor symbols for final class.  [PR95428]

For PR70462 I stopped emitting the as-base constructor and destructor
variants for final classes, because they can never be called.  Except that
it turns out that clang calls base variants from complete variants, even for
classes with virtual bases, and in some cases inlines them such that the
calls to the base variant are exposed.  So we need to continue to emit the
as-base symbols, even though they're unreachable by G++-compiled code.

gcc/cp/ChangeLog:

PR c++/95428
* optimize.c (populate_clone_array): Revert PR70462 change.
(maybe_clone_body): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/other/final8.C: Adjust expected output.

4 years agoFortran : get_environment_variable runtime error PR96486
Mark Eggleston [Mon, 10 Aug 2020 07:07:39 +0000 (08:07 +0100)]
Fortran  :  get_environment_variable runtime error PR96486

Runtime error occurs when the type of the value argument is
character(0):  "Zero-length string passed as value...".
The status argument, intent(out), will contain -1 if the value
of the environment is too large to fit in the value argument, this
is the case if the type is character(0) so there is no reason to
produce a runtime error if the value argument is zero length.

2020-08-24  Mark Eggleston  <markeggleston@gcc.gnu.org>

libgfortran/

PR fortran/96486
* intrinsics/env.c: If value_len is > 0 blank the string.
Copy the result only if its length is > 0.

2020-08-24  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/96486
* gfortran.dg/pr96486.f90: New test.

(cherry picked from commit de09e7ebc9d5555653745a103eef2b20c7f1dd76)

4 years agoDaily bump.
GCC Administrator [Mon, 24 Aug 2020 00:16:56 +0000 (00:16 +0000)]
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 23 Aug 2020 00:16:58 +0000 (00:16 +0000)]
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 22 Aug 2020 00:16:56 +0000 (00:16 +0000)]
Daily bump.

4 years agoUpdate links to Arm docs
Richard Sandiford [Fri, 21 Aug 2020 17:33:20 +0000 (18:33 +0100)]
Update links to Arm docs

gcc/
* doc/extend.texi: Update links to Arm docs.
* doc/invoke.texi: Likewise.

(cherry picked from commit 09698e44c766c4a05ee463d2e36bc1fdac21dce4)

4 years ago[LTO/offloading] Fix offloading-compilation ICE without -flto (PR84320)
Tobias Burnus [Tue, 26 May 2020 16:24:28 +0000 (18:24 +0200)]
[LTO/offloading] Fix offloading-compilation ICE without -flto (PR84320)

gcc/ChangeLog:
PR ipa/95320
* ipa-utils.h (odr_type_p): Also permit calls with
only flag_generate_offload set.

(cherry picked from commit c5ab336ba106a407a67e84d8faac5b0ea6f18310)

4 years agolibstdc++: Skip PSTL tests when installed TBB is too old [PR 96718]
Jonathan Wakely [Fri, 21 Aug 2020 11:01:05 +0000 (12:01 +0100)]
libstdc++: Skip PSTL tests when installed TBB is too old [PR 96718]

These tests do not actually require TBB, because they only inspect the
feature test macros present in the headers. However, if TBB is installed
then its headers will be included, and the version will be checked. If
the version is too old, compilation fails due to a #error directive.

This change disables the tests if TBB is not present, so that we skip
them instead of failing.

libstdc++-v3/ChangeLog:

PR libstdc++/96718
* testsuite/25_algorithms/pstl/feature_test-2.cc: Require
tbb-backend effective target.
* testsuite/25_algorithms/pstl/feature_test-3.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test-5.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test.cc: Likewise.

(cherry picked from commit 988fb2f597d67cdf3603654372c020c28448441f)

4 years agoDaily bump.
GCC Administrator [Fri, 21 Aug 2020 00:16:59 +0000 (00:16 +0000)]
Daily bump.

4 years agod: Adjust backport of PR96250 for front-end implementation.
Iain Buclaw [Thu, 20 Aug 2020 23:52:28 +0000 (01:52 +0200)]
d: Adjust backport of PR96250 for front-end implementation.

gcc/d/ChangeLog:

2020-08-21  Iain Buclaw  <ibuclaw@gdcproject.org>

PR d/96250
* dmd/expressionsem.c (ExpressionSemanticVisitor::visit(TypeExp)):
Fix cast from Expression to VarExp.

4 years agod: Field access in parentheses causes error: need 'this' for 'field' of type 'type'
Iain Buclaw [Tue, 21 Jul 2020 17:32:54 +0000 (19:32 +0200)]
d: Field access in parentheses causes error: need 'this' for 'field' of type 'type'

1. Fixes an ICE in the front-end if a struct symbol were to appear twice
in the compilation unit.

2. Fixes a rejects-valid bug in the front-end where `(symbol)' was being
resolved as a `var' expression, instead of `this.var'.

gcc/d/ChangeLog:

PR d/96250
* dmd/dstruct.c (StructDeclaration::semantic): Error if redefinition
of struct exists in compilation.
* dmd/expressionsem.c (ExpressionSemanticVisitor::visit(TypeExp)):
Rewrite resolved field variables as 'this.var' before semantic.
* dmd/parse.c (Parser::parseUnaryExp): Mark '(type) una_exp' as a
parenthesized expression.

gcc/testsuite/ChangeLog:

PR d/96250
* gdc.test/fail_compilation/fail17492.d: New test.
* gdc.test/compilable/b9490.d: New test.
* gdc.test/compilable/ice14739.d: New test.
* gdc.test/fail_compilation/ice21060.d: New test.
* gdc.test/fail_compilation/imports/ice21060a/package.d: New file.
* gdc.test/fail_compilation/imports/ice21060b/package.d: New file.
* gdc.test/fail_compilation/imports/ice21060c/package.d: New file.
* gdc.test/fail_compilation/imports/ice21060d/package.d: New file.
* gdc.test/runnable/b16278.d: New test.

4 years agod: Fix ICE in setValue at dmd/dinterpret.c:7046
Iain Buclaw [Thu, 20 Aug 2020 16:18:40 +0000 (18:18 +0200)]
d: Fix ICE in setValue at dmd/dinterpret.c:7046

This was originally seen when running the testsuite for a 16-bit target,
however, it could be reproduced on 32-bit using long[] as well.

gcc/d/ChangeLog:

* dmd/ctfeexpr.c (isCtfeValueValid): Return true for array literals as
well as structs.
* dmd/dinterpret.c: Don't reinterpret static arrays into dynamic.

gcc/testsuite/ChangeLog:

* gdc.test/compilable/interpret3.d: Add test.
* gdc.test/fail_compilation/reg6769.d: New test.

(cherry picked from commit c43db80477a95f69425f20e4b8f164081695d1e9)

4 years agod: Fix ICE using non-local variable: internal compiler error: Segmentation fault
Iain Buclaw [Tue, 21 Jul 2020 17:59:00 +0000 (19:59 +0200)]
d: Fix ICE using non-local variable: internal compiler error: Segmentation fault

Moves no frame access error to own function, adding use of it for both
when get_framedecl() cannot find a path to the outer function frame, and
guarding get_decl_tree() from recursively calling itself.

gcc/d/ChangeLog:

PR d/96254
* d-codegen.cc (error_no_frame_access): New.
(get_frame_for_symbol): Use fdparent name in error message.
(get_framedecl): Replace call to assert with error.
* d-tree.h (error_no_frame_access): Declare.
* decl.cc (get_decl_tree): Detect recursion and error.

gcc/testsuite/ChangeLog:

PR d/96254
* gdc.dg/pr96254a.d: New test.
* gdc.dg/pr96254b.d: New test.

(cherry picked from commit 2b1c2a4bd9fb555dccde5d67d6da64547064e0e6)

4 years agolibgomp: adjust nvptx_free callback context checking
Chung-Lin Tang [Thu, 20 Aug 2020 14:18:51 +0000 (07:18 -0700)]
libgomp: adjust nvptx_free callback context checking

Change test for CUDA callback context in nvptx_free() from using
GOMP_PLUGIN_acc_thread () into checking for CUDA_ERROR_NOT_PERMITTED,
for the former only works for OpenACC, but not OpenMP offloading.

2020-08-20  Chung-Lin Tang  <cltang@codesourcery.com>

libgomp/
* plugin/plugin-nvptx.c (nvptx_free):
Change "GOMP_PLUGIN_acc_thread () == NULL" test into check of
CUDA_ERROR_NOT_PERMITTED status for cuMemGetAddressRange. Adjust
comments.

(cherry picked from commit f9b9832837b65046a8f01c18597cf615ff61db40)

4 years agoDaily bump.
GCC Administrator [Thu, 20 Aug 2020 00:17:07 +0000 (00:17 +0000)]
Daily bump.

4 years agolibstdc++: Add deprecated attributes to old iostream members
Jonathan Wakely [Wed, 19 Aug 2020 12:41:26 +0000 (13:41 +0100)]
libstdc++: Add deprecated attributes to old iostream members

Back in 2017 I removed these prehistoric members (which were deprecated
since C++98) for C++17 mode. But I didn't add deprecated attributes to
most of them, so users didn't get any warning they would be going away.
Apparently some poor souls do actually use some of these names, and so
now that GCC 11 defaults to -std=gnu++17 some code has stopped
compiling.

This adds deprecated attributes to them, so that C++98/03/11/14 code
will get a warning if it uses them. I'll also backport this to the
release branches so that users can find out about the deprecation before
they start using C++17.

libstdc++-v3/ChangeLog:

* include/bits/c++config (_GLIBCXX_DEPRECATED_SUGGEST): New
macro for "use 'foo' instead" message in deprecated warnings.
* include/bits/ios_base.h (io_state, open_mode, seek_dir)
(streampos, streamoff): Use _GLIBCXX_DEPRECATED_SUGGEST.
* include/std/streambuf (stossc): Replace C++11 attribute
with _GLIBCXX_DEPRECATED_SUGGEST.
* include/std/type_traits (__is_nullptr_t): Use
_GLIBCXX_DEPRECATED_SUGGEST instead of _GLIBCXX_DEPRECATED.
* testsuite/27_io/types/1.cc: Check for deprecated warnings.
Also check for io_state, open_mode and seek_dir typedefs.

(cherry picked from commit eef9bf4ca8d90a1751bc4bff03722ee68999eb8e)

4 years agoarm: Enable no-writeback vldr.16/vstr.16.
Joe Ramsay [Wed, 29 Jul 2020 13:04:28 +0000 (14:04 +0100)]
arm: Enable no-writeback vldr.16/vstr.16.

There was previously no way to specify that a register operand cannot
have any writeback modifiers, and as a result the argument to vldr.16
and vstr.16 could be erroneously output with post-increment. This
change adds a constraint which forbids all writeback, and
selects it in the relevant case for vldr.16 and vstr.16

gcc/ChangeLog:

PR target/96682
* config/arm/arm-protos.h (arm_coproc_mem_operand_no_writeback):
Declare prototype.
(arm_mve_mode_and_operands_type_check): Declare prototype.
* config/arm/arm.c (arm_coproc_mem_operand): Refactor to use
_arm_coproc_mem_operand.
(arm_coproc_mem_operand_wb): New function to cover full, limited
and no writeback.
(arm_coproc_mem_operand_no_writeback): New constraint for memory
operand with no writeback.
(arm_print_operand): Extend 'E' specifier for memory operand
that does not support writeback.
(arm_mve_mode_and_operands_type_check): New constraint check for
MVE memory operands.
* config/arm/constraints.md: Add Uj constraint for VFP vldr.16
and vstr.16.
* config/arm/vfp.md (*mov_load_vfp_hf16): New pattern for
vldr.16.
(*mov_store_vfp_hf16): New pattern for vstr.16.
(*mov<mode>_vfp_<mode>16): Remove MVE moves.

gcc/testsuite/ChangeLog:

PR target/96682
* gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c: New test.

(cherry picked from commit 9f6abd2db90151c8966d2d2718ab8c299abf1105)

4 years agors6000: Rename instruction xvcvbf16sp to xvcvbf16spn
Peter Bergner [Tue, 18 Aug 2020 21:16:11 +0000 (16:16 -0500)]
rs6000: Rename instruction xvcvbf16sp to xvcvbf16spn

The xvcvbf16sp mnemonic, which was just added in ISA 3.1 has been renamed
to xvcvbf16spn, to make it consistent with the other non-signaling conversion
instructions which all end with "n".  The only use of this instruction is in
an MMA conversion built-in function, so there is little to no compatibility
issue.

2020-08-18  Peter Bergner  <bergner@linux.ibm.com>

gcc/
* config/rs6000/rs6000-builtin.def (BU_VSX_1): Rename xvcvbf16sp to
xvcvbf16spn.
* config/rs6000/rs6000-call.c (builtin_function_type): Likewise.
* config/rs6000/vsx.md: Likewise.
* doc/extend.texi: Likewise.

gcc/testsuite/
* gcc.target/powerpc/mma-builtin-3.c: Rename xvcvbf16sp to xvcvbf16spn.

(cherry picked from commit 94bedeaf694c728607a718d599edb4d74a2813c0)

4 years agors6000: ICE when using an MMA type as a function param or return value [PR96506]
Peter Bergner [Thu, 13 Aug 2020 18:40:39 +0000 (13:40 -0500)]
rs6000: ICE when using an MMA type as a function param or return value [PR96506]

PR96506 shows a problem where we ICE on illegal usage, namely using MMA
types for function arguments and return values.  The solution is to flag
these illegal usages as errors early, before we ICE.

2020-08-13  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96506
* config/rs6000/rs6000-call.c (rs6000_promote_function_mode): Disallow
MMA types as return values.
(rs6000_function_arg): Disallow MMA types as function arguments.

gcc/testsuite/
PR target/96506
* gcc.target/powerpc/pr96506.c: New test.

(cherry picked from commit 0ad7e730c142ef6cd0ddc1491a89a7f330caa887)

4 years agoDaily bump.
GCC Administrator [Wed, 19 Aug 2020 00:16:59 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: Handle enumerator in C++20 alias CTAD. [PR96199]
Jason Merrill [Thu, 6 Aug 2020 06:40:10 +0000 (02:40 -0400)]
c++: Handle enumerator in C++20 alias CTAD. [PR96199]

To form a deduction guide for an alias template, we substitute the template
arguments from the pattern into the deduction guide for the underlying
class.  In the case of B(A1<X>), that produces B(A1<B<T,1>::X>) -> B<T,1>.
But since an enumerator doesn't have its own template info, and B<T,1> is a
dependent scope, trying to look up B<T,1>::X fails and we crash.  So we need
to produce a SCOPE_REF instead.

And trying to use the members of the template class is wrong for other
members, as well, as it gives a nonsensical result if the class is
specialized.

gcc/cp/ChangeLog:

PR c++/96199
* pt.c (maybe_dependent_member_ref): New.
(tsubst_copy) [CONST_DECL]: Use it.
[VAR_DECL]: Likewise.
(tsubst_aggr_type): Handle nested type.

gcc/testsuite/ChangeLog:

PR c++/96199
* g++.dg/cpp2a/class-deduction-alias4.C: New test.

4 years agoi386: Fix restore_stack_nonlocal expander [PR96536].
Uros Bizjak [Tue, 18 Aug 2020 15:34:37 +0000 (17:34 +0200)]
i386: Fix restore_stack_nonlocal expander [PR96536].

-fcf-protection code in restore_stack_nonlocal uses a branch based on
a clobber result.  The patch adds missing compare.

2020-08-18  UroÅ¡ Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

PR target/96536
* config/i386/i386.md (restore_stack_nonlocal):
Add missing compare RTX.

4 years agod: Fix ICE Segmentation fault during RTL pass: expand on armhf/armel/s390x
Iain Buclaw [Fri, 24 Jul 2020 11:49:37 +0000 (13:49 +0200)]
d: Fix ICE Segmentation fault during RTL pass: expand on armhf/armel/s390x

gcc/d/ChangeLog:

PR d/96301
* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Only return
non-trivial structs by invisible reference.

gcc/testsuite/ChangeLog:

PR d/96301
* gdc.dg/pr96301a.d: New test.
* gdc.dg/pr96301b.d: New test.
* gdc.dg/pr96301c.d: New test.

(cherry picked from commit 6bebbc033d8bf2246745ffef7186b0424e08ba6b)

4 years agoDon't use pinsr/pextr for struct initialization/extraction.
liuhongt [Wed, 12 Aug 2020 02:48:17 +0000 (10:48 +0800)]
Don't use pinsr/pextr for struct initialization/extraction.

gcc/
PR target/96562
PR target/93897
* config/i386/i386-expand.c (ix86_expand_pinsr): Don't use
pinsr for TImode.
(ix86_expand_pextr): Don't use pextr for TImode.

gcc/testsuite/
* gcc.target/i386/pr96562-1.c: New test.

4 years agocompiler: export thunks referenced by inline functions
Ian Lance Taylor [Fri, 14 Aug 2020 22:27:15 +0000 (15:27 -0700)]
compiler: export thunks referenced by inline functions

The test case is https://golang.org/cl/248637.

Fixes golang/go#40252

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/248638

4 years agoDaily bump.
GCC Administrator [Tue, 18 Aug 2020 00:17:00 +0000 (00:17 +0000)]
Daily bump.

4 years agoDaily bump.
GCC Administrator [Mon, 17 Aug 2020 00:16:52 +0000 (00:16 +0000)]
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 16 Aug 2020 00:16:55 +0000 (00:16 +0000)]
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 15 Aug 2020 00:16:55 +0000 (00:16 +0000)]
Daily bump.

4 years agotestsuite: Fix up pr95548.C testcase.
Jakub Jelinek [Mon, 8 Jun 2020 08:30:48 +0000 (10:30 +0200)]
testsuite: Fix up pr95548.C testcase.

2020-06-08  Jakub Jelinek  <jakub@redhat.com>

PR lto/95548
* g++.dg/torture/pr95548.C: Change from dg-do compile to dg-do link,
add return type for main, for __SIZEOF_INT128__ test with __uint128_t
enumerator constants and add a test with unsigned long long
enumerators for all targets.

(cherry picked from commit 296d644b9f526e44fbe574426f24799c1d545fd3)

4 years agoFix streamer desynchornization caused by streamer debugging patch
Jan Hubicka [Fri, 29 May 2020 10:25:48 +0000 (12:25 +0200)]
Fix streamer desynchornization caused by streamer debugging patch

it turns out I lost one hunk in the patch disabling extra streaming
which causes streamer to go out of sync in the case non-trivial scc
containing the node being streamed appears in local stream (which seems
quite rare since it does not happen during bootstrap).

2020-05-29  Jan Hubicka  <hubicka@ucw.cz>

PR lto/95362
* lto-streamer-out.c (lto_output_tree): Disable redundant streaming.

(cherry picked from commit 11041c3151e30d197d1c2774721db24332eeccef)

4 years agoDaily bump.
GCC Administrator [Fri, 14 Aug 2020 00:16:58 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: constraints and address of template-id
Patrick Palka [Mon, 10 Aug 2020 13:39:29 +0000 (09:39 -0400)]
c++: constraints and address of template-id

When resolving the address of a template-id, we need to drop functions
whose associated constraints are not satisfied, as per [over.over].  We
do so in resolve_address_of_overloaded_function, but not in
resolve_overloaded_unification or resolve_nondeduced_context, which
seems like an oversight.

gcc/cp/ChangeLog:

* pt.c (resolve_overloaded_unification): Drop functions with
unsatisfied constraints.
(resolve_nondeduced_context): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-fn5.C: New test.
* g++.dg/concepts/fn8.C: Generalize dg-error directive to accept
"no matching function ..." diagnostic.
* g++.dg/cpp2a/concepts-fn1.C: Likewise.
* g++.dg/cpp2a/concepts-ts2.C: Likewise.
* g++.dg/cpp2a/concepts-ts3.C: Likewise.

(cherry picked from commit 41fd9d26108fc98bbffce3d99d218a6a09fa80c6)

4 years agoBump LTO version
Jan Hubicka [Thu, 13 Aug 2020 15:52:45 +0000 (17:52 +0200)]
Bump LTO version

* lto-streamer.h (LTO_minor_version): Bump version.

4 years agoFix ICE in ODR enum streaming [PR95548]
Jan Hubicka [Sat, 6 Jun 2020 20:19:46 +0000 (22:19 +0200)]
Fix ICE in ODR enum streaming [PR95548]

gcc/ChangeLog:

2020-06-06  Jan Hubicka  <hubicka@ucw.cz>

PR lto/95548
* ipa-devirt.c (struct odr_enum_val): Turn values to wide_int.
(ipa_odr_summary_write): Update streaming.
(ipa_odr_read_section): Update streaming.

gcc/testsuite/ChangeLog:

2020-06-06  Jan Hubicka  <hubicka@ucw.cz>

* g++.dg/torture/pr95548.C: New test.

(cherry picked from commit eca7a60bd24ebd91addd785e420a06d8f5086634)

4 years agoOptimize ODR enum streaming
Jan Hubicka [Wed, 3 Jun 2020 19:16:43 +0000 (21:16 +0200)]
Optimize ODR enum streaming

it turns out that half of the global decl stream of cc1 LTO build consits
TREE_LISTS, identifiers and integer cosntats representing TYPE_VALUES of enums.
Those are streamed only to produce ODR warning and used otherwise, so this
patch moves the info to a separate section that is represented and streamed
more effectively.

This also adds place for more info that may be used for ODR diagnostics
(i.e. at the moment we do not warn when the declarations differs i.e. by the
associated member functions and their types) and the type inheritance graph
rather then poluting the global stream.

I was bit unsure what enums we want to store into the section.  All parsed
enums is probably too expensive, only those enums streamed to represent IL is
bit hard to get, so I went for those seen by free lang data.

As a plus we now get bit more precise warning because also the location of
mismatched enum CONST_DECL is streamed.

It changes:
[WPA] read 4608466 unshared trees
[WPA] read 2942094 mergeable SCCs of average size 1.365328
[WPA] 8625389 tree bodies read in total
[WPA] tree SCC table: size 524287, 247652 elements, collision ratio: 0.383702
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 2694442 SCCs, 228 collisions (0.000085)
[WPA] Merged 2694419 SCCs
[WPA] Merged 3731982 tree bodies
[WPA] Merged 633335 types
[WPA] 122077 types prevailed (155548 associated trees)
...
[WPA] Compression: 110593119 input bytes, 287696614 uncompressed bytes (ratio: 2.601397)
[WPA] Size of mmap'd section decls: 85628556 bytes
[WPA] Size of mmap'd section function_body: 13842928 bytes

[WPA] read 1720989 unshared trees
[WPA] read 1252217 mergeable SCCs of average size 1.858507
[WPA] 4048243 tree bodies read in total
[WPA] tree SCC table: size 524287, 226524 elements, collision ratio: 0.491759
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 1025693 SCCs, 196 collisions (0.000191)
[WPA] Merged 1025670 SCCs
[WPA] Merged 2063373 tree bodies
[WPA] Merged 633497 types
[WPA] 122299 types prevailed (155827 associated trees)
...
[WPA] Compression: 103428770 input bytes, 281151423 uncompressed bytes (ratio: 2.718310)
[WPA] Size of mmap'd section decls: 49390917 bytes
[WPA] Size of mmap'd section function_body: 13858258 bytes
...
[WPA] Size of mmap'd section odr_types: 29054816 bytes

So number of SCCs streamed drops to 38% and the number of unshared trees (that
are bit misnamed since it is mostly integer_cst) to 37%.

Things speeds up correspondingly, but I did not save time report from previous
build.

The enum values are still quite surprisingly large.  I may take a look into
ways getting it smaller incrementally, but it streams reasonably fast:

Time variable                                   usr           sys          wall               GGC
 phase opt and generate             :  25.20 ( 68%)  10.88 ( 72%)  36.13 ( 69%)  868060 kB ( 52%)
 phase stream in                    :   4.46 ( 12%)   0.90 (  6%)   5.38 ( 10%)  790724 kB ( 48%)
 phase stream out                   :   6.69 ( 18%)   3.32 ( 22%)  10.03 ( 19%)       8 kB (  0%)
 ipa lto gimple in                  :   0.79 (  2%)   1.86 ( 12%)   2.39 (  5%)  252612 kB ( 15%)
 ipa lto gimple out                 :   2.48 (  7%)   0.78 (  5%)   3.26 (  6%)       0 kB (  0%)
 ipa lto decl in                    :   1.71 (  5%)   0.46 (  3%)   2.34 (  4%)  417883 kB ( 25%)
 ipa lto decl out                   :   3.28 (  9%)   0.07 (  0%)   3.27 (  6%)       0 kB (  0%)
 whopr wpa I/O                      :   0.40 (  1%)   2.24 ( 15%)   2.77 (  5%)       8 kB (  0%)
 lto stream decompression           :   1.38 (  4%)   0.31 (  2%)   1.36 (  3%)       0 kB (  0%)
 ipa ODR types                      :   0.18 (  0%)   0.02 (  0%)   0.25 (  0%)       0 kB (  0%)
 ipa inlining heuristics            :  11.64 ( 31%)   1.45 ( 10%)  13.12 ( 25%)  453160 kB ( 27%)
 ipa pure const                     :   1.74 (  5%)   0.00 (  0%)   1.76 (  3%)       0 kB (  0%)
 ipa icf                            :   1.72 (  5%)   5.33 ( 35%)   7.06 ( 13%)   16593 kB (  1%)
 whopr partitioning                 :   2.22 (  6%)   0.01 (  0%)   2.23 (  4%)    5689 kB (  0%)
 TOTAL                              :  37.17         15.20         52.46        1660886 kB

LTO-bootstrapped/regtested x86_64-linux, will comit it shortly.

gcc/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* ipa-devirt.c: Include data-streamer.h, lto-streamer.h and
streamer-hooks.h.
(odr_enums): New static var.
(struct odr_enum_val): New struct.
(class odr_enum): New struct.
(odr_enum_map): New hashtable.
(odr_types_equivalent_p): Drop code testing TYPE_VALUES.
(add_type_duplicate): Likewise.
(free_odr_warning_data): Do not free TYPE_VALUES.
(register_odr_enum): New function.
(ipa_odr_summary_write): New function.
(ipa_odr_read_section): New function.
(ipa_odr_summary_read): New function.
(class pass_ipa_odr): New pass.
(make_pass_ipa_odr): New function.
* ipa-utils.h (register_odr_enum): Declare.
* lto-section-in.c: (lto_section_name): Add odr_types section.
* lto-streamer.h (enum lto_section_type): Add odr_types section.
* passes.def: Add odr_types pass.
* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
TYPE_VALUES.
(hash_tree): Likewise.
* tree-streamer-in.c (lto_input_ts_type_non_common_tree_pointers):
Likewise.
* tree-streamer-out.c (write_ts_type_non_common_tree_pointers):
Likewise.
* timevar.def (TV_IPA_ODR): New timervar.
* tree-pass.h (make_pass_ipa_odr): Declare.
* tree.c (free_lang_data_in_type): Regiser ODR types.

gcc/lto/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (compare_tree_sccs_1): Do not compare TYPE_VALUES.

gcc/testsuite/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* g++.dg/lto/pr84805_0.C: Update.

(cherry picked from commit 3fb68f2e666d9de7e0326af9f43b12c9e98f19a6)

Fix typo.

4 years agoDo not stream redundant stuff
Jan Hubicka [Mon, 25 May 2020 12:41:33 +0000 (14:41 +0200)]
Do not stream redundant stuff

as discussed on IRC this adds knob to disable stuff we stream "just for fun"
(or to make it easier to debug streamer desychnonization).

Te size of .o files in gcc subdirectory is reduced form 506MB to 492MB

gcc/

* lto-streamer-out.c (lto_output_tree): Add streamer_debugging check.
* lto-streamer.h (streamer_debugging): New constant
* tree-streamer-in.c (streamer_read_tree_bitfields): Add
streamer_debugging check.
(streamer_get_pickled_tree): Likewise.
* tree-streamer-out.c (pack_ts_base_value_fields): Likewise.

(cherry picked from commit a746f952abb78af9db28a7f3bce442e113877c9c)
(cherry picked from commit 9d679bd7b621c93c000b7d548f34f3438e0d57a8)

4 years agoAvoid streaming stray references.
Jan Hubicka [Fri, 22 May 2020 14:37:06 +0000 (16:37 +0200)]
Avoid streaming stray references.

this patch avoids stremaing completely useless stray references to gobal decl
stream.  I am re-testing the patch (rebased to current tree) on x86_64-linux
and intend to commit once testing finishes.

gcc/ChangeLog:

2020-05-22  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-out.c (lto_output_tree): Do not stream final ref if
it is not needed.

gcc/lto/ChangeLog:

2020-05-22  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (lto_read_decls): Do not skip stray refs.

(cherry picked from commit bcb63eb2cbd3caf212b9cf42d8c218c09dc6ff8b)
(cherry picked from commit 57400cf273f8052c601d90d86a47705faa17aaa9)

4 years agoFix hashing of prestreamed nodes
Jan Hubicka [Fri, 22 May 2020 10:31:34 +0000 (12:31 +0200)]
Fix hashing of prestreamed nodes

this patch seems to solve basically all collisions while building cc1.
From:

[WPA] read 3312246 unshared trees
[WPA] read 1144381 mergeable SCCs of average size 4.833785
[WPA] 8843938 tree bodies read in total
[WPA] tree SCC table: size 524287, 197767 elements, collision ratio: 0.506446
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 946614 SCCs, 775077 collisions (0.818789)

to

[WPA] read 3314520 unshared trees
[WPA] read 1144763 mergeable SCCs of average size 4.835021
[WPA] 8849473 tree bodies read in total
[WPA] tree SCC table: size 524287, 200574 elements, collision ratio: 0.486418
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 944189 SCCs, 179 collisions (0.000190)

The problem is that preloaded nodes all have hash code 0 because
cache->nodes.length is not updated while streaming out.

I also added an arbitrary constant to avoid clash with constant of 0 used to
hash NULL pointers and 1 used to hash pointers inside SCC.

* tree-streamer.c (record_common_node): Fix hash value of pre-streamed
nodes.

(cherry picked from commit 1089a367c4b05b5e3f072adca8913904ed65928c)
(cherry picked from commit 5c7ed52a039cfafb63c27fa8c1535e02dfc1ae09)

4 years agoSimplify streaming of SCC components
Jan Hubicka [Fri, 22 May 2020 10:29:19 +0000 (12:29 +0200)]
Simplify streaming of SCC components

this patch saves few bytes from SCC streaming.  First we stream end markers
that are fully ignored at stream in.
Second I missed streaming of emtry_len in the previous change so it is
pointlessly streamed for LTO_trees. Moreover entry_len is almost always 1
(always during gcc bootstrap) and thus it makes sense to avoid stremaing it
in majority of cases.

gcc/ChangeLog:

2020-05-21  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-in.c (lto_read_tree): Do not stream end markers.
(lto_input_scc): Optimize streaming of entry lengths.
* lto-streamer-out.c (lto_write_tree): Do not stream end markers
(DFS::DFS): Optimize stremaing of entry lengths

(cherry picked from commit 47273df0bcdd552385f25049dce71943aac8321e)
(cherry picked from commit f55838d8ec18a499ff2f521bea66bbb54f70c56b)

4 years agoAvoid SCC hashing on unmergeable trees
Jan Hubicka [Wed, 20 May 2020 13:58:22 +0000 (15:58 +0200)]
Avoid SCC hashing on unmergeable trees

This is new incarantion of patch to identify unmergeable tree at streaming out
time rather than streaming in and to avoid pickling them to sccs with with hash
codes.

Building cc1 plus this patch reduces:

[WPA] read 4452927 SCCs of average size 1.986030
[WPA] 8843646 tree bodies read in total
[WPA] tree SCC table: size 524287, 205158 elements, collision ratio: 0.505204
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 947551 SCCs, 780270 collisions (0.823460)
[WPA] Merged 944038 SCCs
[WPA] Merged 5253521 tree bodies
[WPA] Merged 590027 types
...
[WPA] Size of mmap'd section decls: 99229066 bytes
[WPA] Size of mmap'd section function_body: 18398837 bytes
[WPA] Size of mmap'd section refs: 733678 bytes
[WPA] Size of mmap'd section jmpfuncs: 2965981 bytes
[WPA] Size of mmap'd section pureconst: 170248 bytes
[WPA] Size of mmap'd section profile: 17985 bytes
[WPA] Size of mmap'd section symbol_nodes: 3392736 bytes
[WPA] Size of mmap'd section inline: 2693920 bytes
[WPA] Size of mmap'd section icf: 435557 bytes
[WPA] Size of mmap'd section offload_table: 0 bytes
[WPA] Size of mmap'd section lto: 4320 bytes
[WPA] Size of mmap'd section ipa_sra: 651660 bytes

... to ...

[WPA] read 3312246 unshared trees
[WPA] read 1144381 mergeable SCCs of average size 4.833785
[WPA] 8843938 tree bodies read in total
[WPA] tree SCC table: size 524287, 197767 elements, collision ratio: 0.506446
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 946614 SCCs, 775077 collisions (0.818789)
[WPA] Merged 943798 SCCs
[WPA] Merged 5253336 tree bodies
[WPA] Merged 590105 types
....
[WPA] Size of mmap'd section decls: 81262144 bytes
[WPA] Size of mmap'd section function_body: 14702611 bytes
[WPA] Size of mmap'd section ext_symtab: 0 bytes
[WPA] Size of mmap'd section refs: 733695 bytes
[WPA] Size of mmap'd section jmpfuncs: 2332150 bytes
[WPA] Size of mmap'd section pureconst: 170292 bytes
[WPA] Size of mmap'd section profile: 17986 bytes
[WPA] Size of mmap'd section symbol_nodes: 3393358 bytes
[WPA] Size of mmap'd section inline: 2567939 bytes
[WPA] Size of mmap'd section icf: 435633 bytes
[WPA] Size of mmap'd section lto: 4320 bytes
[WPA] Size of mmap'd section ipa_sra: 651824 bytes

so results in about 22% reduction in global decl stream and 24% reduction on
function bodies stream (which is read mostly by ICF)

Martin, the zstd compression breaks the compression statistics (it works when
GCC is configured for zlib)

At first ltrans I get:

[LTRANS] Size of mmap'd section decls: 3734248 bytes
[LTRANS] Size of mmap'd section function_body: 4895962 bytes

... to ...

[LTRANS] Size of mmap'd section decls: 3479850 bytes
[LTRANS] Size of mmap'd section function_body: 3722935 bytes

So 7% reduction of global stream and 31% reduction of function bodies.

Stream in seems to get about 3% faster and stream out about 5% but it is
close to noise factor of my experiment.  I expect bigger speedups on
Firefox but I did not test it today since my Firefox setup broke again.
GCC is not very good example on the problem with anonymous namespace
types since we do not have so many of them.

Sice of object files in gcc directory is reduced by 11% (because hash
numbers do not compress well I guess).

The patch makes DFS walk to recognize trees that are not merged (anonymous
namespace, local function/variable decls, anonymous types etc).  As discussed
on IRC this is now done during the SCC walk rather than during the hash
computation.  When local tree is discovered we know that SCC components of everything that is on
the stack reffers to it and thus is also local. Moreover we mark trees into hash set in output block
so if we get a cross edge referring to local tree it gets marked too.

Patch also takes care of avoiding SCC wrappers around some trees. In particular
 1) singleton unmergeable SCCs are now streamed inline in global decl stream
    This includes INTEGER_CSTs and IDENTIFIER_NODEs that are shared by different
    code than rest of tree merging.
 2) We use LTO_trees instead of LTO_tree_scc to wrap unmergeable SCC components.
    It is still necessary to mark them because of forward references.  LTO_trees
    has simple header with number of trees and then things are streamed same way
    as for LTO_tree_scc. That is tree headers first followed by pickled references
    so things may point to future.

    Of course it is not necessary for LTO_tree_scc to be single component and
    streamer out may group more components together, but I decided to not snowball
    the patch even more
 3) In local streams when lto_output_tree is called and the topmost SCC components
    turns out to be singleton we stream the tree directly
    instead of LTO_tree_scc, hash code, pickled tree, reference to just stremaed tree.

    LTO_trees is used to wrap all trees needed to represent tree being streamed.
    It would make sense again to use only one LTO_trees rather than one per SCC
    but I think this can be done incrementally.

In general local trees are now recognized by new predicate local_tree_p

Bit subtle is handing of TRANLSATION_UNIT_DECL, INTEGER_CST and
IDENTIFIER_NODE.

TRANSLATION_UNIT_DECL a local tree but references to it does not make
other trees local (because we also understand local decls now).
So I check for it later after localness propagation is done.

INTEGER_CST and IDENTIFIER_NODEs are merged but not via the tree merging
machinery. So it makes sense to stream them as unmergeable trees but we
still need to compute their hashes so SCCs referring them do not get too
large collision chains.  For this reason they are checked just prior
stream out.

lto-bootstrapped/regteted x86_64-linux, OK?

gcc/ChangeLog:

2020-05-19  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-in.c (lto_input_scc): Add SHARED_SCC parameter.
(lto_input_tree_1): Strenghten sanity check.
(lto_input_tree): Update call of lto_input_scc.
* lto-streamer-out.c: Include ipa-utils.h
(create_output_block): Initialize local_trees if merigng is going
to happen.
(destroy_output_block): Destroy local_trees.
(DFS): Add max_local_entry.
(local_tree_p): New function.
(DFS::DFS): Initialize and maintain it.
(DFS::DFS_write_tree): Decide on streaming format.
(lto_output_tree): Stream inline singleton SCCs
* lto-streamer.h (enum LTO_tags): Add LTO_trees.
(struct output_block): Add local_trees.
(lto_input_scc): Update prototype.

gcc/lto/ChangeLog:

2020-05-19  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (compare_tree_sccs_1): Sanity check that we never
read TRANSLATION_UNIT_DECL.
(process_dref): Break out from ...
(unify_scc): ... here.
(process_new_tree): Break out from ...
(lto_read_decls): ... here; handle streaming of singleton trees.
(print_lto_report_1): Update statistics.

(cherry picked from commit 03d90a20a1afcbb9c30da8d4adf4922b0685061f)
(cherry picked from commit c6328b32770132efa004a3cad127cf74be84e911)

4 years agoipa: fix ICE in get_default_value
Martin Liska [Thu, 13 Aug 2020 07:38:41 +0000 (09:38 +0200)]
ipa: fix ICE in get_default_value

The patch aligns code with ipcp_bits_lattice::set_to_constant
where we properly mask m_value with m_mask. The same should
be done here.

gcc/ChangeLog:

PR ipa/96482
* ipa-cp.c (ipcp_bits_lattice::meet_with_1): Mask m_value
with m_mask.

gcc/testsuite/ChangeLog:

PR ipa/96482
* gcc.dg/ipa/pr96482-2.c: New test.

(cherry picked from commit f91770216eade83f068528c1e4f00e2ac3b23044)

4 years agoDaily bump.
GCC Administrator [Thu, 13 Aug 2020 00:16:59 +0000 (00:16 +0000)]
Daily bump.

4 years agoRe: PR96493, powerpc local call linkage failure
Alan Modra [Mon, 10 Aug 2020 13:31:12 +0000 (23:01 +0930)]
Re: PR96493, powerpc local call linkage failure

PR target/96525
* gcc.target/powerpc/pr96493.c: Make it a link test when no
power10_hw.  Require power10_ok.

(cherry picked from commit 2ba0674c657fb2089d8aae4f8c254ce0559c8f53)

4 years agoPR96493, powerpc local call linkage failure
Alan Modra [Thu, 6 Aug 2020 04:42:21 +0000 (14:12 +0930)]
PR96493, powerpc local call linkage failure

This corrects current_file_function_operand, an operand predicate used
to determine whether a symbol_ref is safe to use with the local_call
patterns.  Calls between pcrel and non-pcrel code need to go via
linker stubs.  In the case of non-pcrel code to pcrel the stub saves
r2 but there needs to be a nop after the branch for the r2 restore.
So the local_call patterns can't be used there.  For pcrel code to
non-pcrel the local_call patterns could still be used, but I thought
it better to not use them since the call isn't direct.  Code generated
by the corresponding call_nonlocal_aix for pcrel is identical anyway.

Incidentally, without the TREE_CODE () == FUNCTION_DECL test,
gcc.c-torture/compile/pr37433.c and pr37433-1.c ICE.  Also, if you
make the test more strict by disallowing an op without a
SYMBOL_REF_DECL then a bunch of go and split-stack tests fail.  That's
because a prologue call to __morestack can't have a following nop.
(__morestack calls its caller at a fixed offset from the __morestack
call!)

gcc/
PR target/96493
* config/rs6000/predicates.md (current_file_function_operand): Don't
accept functions that differ in r2 usage.

gcc/testsuite/
* gcc.target/powerpc/pr96493.c: New file.

(cherry picked from commit f8ac30f1653ff69706c35af6d725f1d330600f11)

4 years agoipa: fix bit CPP when combined with IPA bit CP
Martin Liska [Wed, 12 Aug 2020 07:21:51 +0000 (09:21 +0200)]
ipa: fix bit CPP when combined with IPA bit CP

As mentioned in the PR, let's consider the following example:

int
__attribute__((noinline))
foo(int arg)
{
  if (arg == 3)
    return 1;
  if (arg == 4)
    return 123;

  __builtin_unreachable ();
}

during WPA we find all calls of the function
(yes the call with value 5 is UBSAN):

  Node: foo/0:
    param [0]: 5 [loc_time: 4, loc_size: 2, prop_time: 0, prop_size: 0]
               3 [loc_time: 3, loc_size: 3, prop_time: 0, prop_size: 0]
         ctxs: VARIABLE
         Bits: value = 0x5, mask = 0x6

in LTRANS we have the following VRP info:

  # RANGE [3, 3] NONZERO 3

when we AND masks in get_default_value we end up with 6 & 3 = 2 (0x010).
That means the only second (least significant bit) is unknown and
value (5 = 0x101) & ~mask gives us either 7 (0x111) or 5 (0x101).

That's why if (arg_2(D) == 3) gets optimized to false.

gcc/ChangeLog:

PR ipa/96482
* ipa-cp.c (ipcp_bits_lattice::meet_with_1): Drop value bits
for bits that are unknown.
(ipcp_bits_lattice::set_to_constant): Likewise.
* tree-ssa-ccp.c (get_default_value): Add sanity check that
IPA CP bit info has all bits set to zero in bits that
are unknown.

gcc/testsuite/ChangeLog:

PR ipa/96482
* gcc.dg/ipa/pr96482.c: New test.

(cherry picked from commit d58f078ce2d53e5dab6b3d0d5f960504268e1894)

4 years agoipa/96291: don't crash on unoptimized lto functions
Sergei Trofimovich [Sat, 25 Jul 2020 18:26:50 +0000 (19:26 +0100)]
ipa/96291: don't crash on unoptimized lto functions

In PR ipa/96291 the test contained an SCC with one
unoptimized function. This tricked ipa-cp into NULL dereference.

has_undead_caller_from_outside_scc_p() did not take into account
that unoptimized funtions don't have IPA summary analysis. And
dereferenced NULL pointer causing an ICE.

gcc/
PR ipa/96291
* ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider
unoptimized callers as undead.

gcc/testsuite/
PR ipa/96291
* gcc.dg/lto/pr96291_0.c: New testcase.
* gcc.dg/lto/pr96291_1.c: Support file.
* gcc.dg/lto/pr96291_2.c: Likewise.
* gcc.dg/lto/pr96291.h: Likewise.

(cherry picked from commit cbf10ac51c0b889e930f260a3d1fb601332befdf)

4 years agobpf: remove trailing whitespaces from source files
Jose E. Marchesi [Wed, 12 Aug 2020 14:56:07 +0000 (16:56 +0200)]
bpf: remove trailing whitespaces from source files

This patch is a little cleanup that removes trailing whitespaces from
the bpf backend source files.

(cherry pick of commit e87c540fe43e29663140ed67b98ee437c25696bb)

2020-08-07  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.md: Remove trailing whitespaces.
* config/bpf/constraints.md: Likewise.
* config/bpf/predicates.md: Likewise.

gcc/testsuite/
* gcc.target/bpf/diag-funargs-2.c: Remove trailing whitespaces.
* gcc.target/bpf/skb-ancestor-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-meta.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-head.c: Likewise.
* gcc.target/bpf/helper-tcp-check-syncookie.c: Likewise.
* gcc.target/bpf/helper-sock-ops-cb-flags-set.c
* gcc.target/bpf/helper-sysctl-set-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-name.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-current-value.c: Likewise.
* gcc.target/bpf/helper-strtoul.c: Likewise.
* gcc.target/bpf/helper-strtol.c: Likewise.
* gcc.target/bpf/helper-sock-map-update.c: Likewise.
* gcc.target/bpf/helper-sk-storage-get.c: Likewise.
* gcc.target/bpf/helper-sk-storage-delete.c: Likewise.
* gcc.target/bpf/helper-sk-select-reuseport.c: Likewise.
* gcc.target/bpf/helper-sk-release.c: Likewise.
* gcc.target/bpf/helper-sk-redirect-map.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-upd.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-tcp.c: Likewise.
* gcc.target/bpf/helper-skb-change-head.c: Likewise.
* gcc.target/bpf/helper-skb-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-skb-adjust-room.c: Likewise.
* gcc.target/bpf/helper-set-hash.c: Likewise.
* gcc.target/bpf/helper-setsockopt.c: Likewise.
* gcc.target/bpf/helper-redirect-map.c: Likewise.
* gcc.target/bpf/helper-rc-repeat.c: Likewise.
* gcc.target/bpf/helper-rc-keydown.c: Likewise.
* gcc.target/bpf/helper-probe-read-str.c: Likewise.
* gcc.target/bpf/helper-perf-prog-read-value.c: Likewise.
* gcc.target/bpf/helper-perf-event-read-value.c: Likewise.
* gcc.target/bpf/helper-override-return.c: Likewise.
* gcc.target/bpf/helper-msg-redirect-map.c: Likewise.
* gcc.target/bpf/helper-msg-pull-data.c: Likewise.
* gcc.target/bpf/helper-msg-cork-bytes.c: Likewise.
* gcc.target/bpf/helper-msg-apply-bytes.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-store-bytes.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-adjust-srh.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-action.c: Likewise.
* gcc.target/bpf/helper-lwt-push-encap.c: Likewise.
* gcc.target/bpf/helper-get-socket-uid.c: Likewise.
* gcc.target/bpf/helper-get-socket-cookie.c: Likewise.
* gcc.target/bpf/helper-get-local-storage.c: Likewise.
* gcc.target/bpf/helper-get-current-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-getsockopt.c: Likewise.
* gcc.target/bpf/diag-funargs-3.c: Likewise.

This page took 0.203845 seconds and 5 git commands to generate.