gcc.git
4 years agoaarch64: Tweaks to the handling of fixed-length SVE types
Richard Sandiford [Tue, 25 Aug 2020 12:31:17 +0000 (13:31 +0100)]
aarch64: Tweaks to the handling of fixed-length SVE types

This patch is really four things rolled into one, since separating
them seemed artificial:

- Update the mangling of the fixed-length SVE ACLE types to match
  the upcoming spec.  The idea is to mangle:

    VLAT __attribute__((arm_sve_vector_bits(N)))

  as an instance __SVE_VLS<VLAT, N> of the template:

    __SVE_VLS<typename, unsigned>

- Give the fixed-length types their own TYPE_DECL.  This is needed
  to make the above mangling fix work, but should also be a minor
  QoI improvement for error reporting.  Unfortunately, the names are
  quite verbose, e.g.:

    svint8_t __attribute__((arm_sve_vector_bits(512)))

  but anything shorter would be ad-hoc syntax and so might be more
  confusing.

- Improve the error message reported when arm_sve_vector_bits is
  applied to tuples, such as:

    svint32x2_t __attribute__((arm_sve_vector_bits(N)))

  Previously we would complain that the type isn't an SVE type;
  now we complain that it isn't a vector type.

- Don't allow arm_sve_vector_bits(N) to be applied to existing
  fixed-length SVE types.

gcc/
* config/aarch64/aarch64-sve-builtins.cc (add_sve_type_attribute):
Take the ACLE name of the type as a parameter and add it as fourth
argument to the "SVE type" attribute.
(register_builtin_types): Update call accordingly.
(register_tuple_type): Likewise.  Construct the name of the type
earlier in order to do this.
(get_arm_sve_vector_bits_attributes): New function.
(handle_arm_sve_vector_bits_attribute): Report a more sensible
error message if the attribute is applied to an SVE tuple type.
Don't allow the attribute to be applied to an existing fixed-length
SVE type.  Mangle the new type as __SVE_VLS<type, vector-bits>.
Add a dummy TYPE_DECL to the new type.

gcc/testsuite/
* g++.target/aarch64/sve/acle/general-c++/attributes_2.C: New test.
* g++.target/aarch64/sve/acle/general-c++/mangle_6.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_7.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_8.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_9.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_10.C: Likewise.
* gcc.target/aarch64/sve/acle/general/attributes_7.c: Check the
error messages reported when arm_sve_vector_bits is applied to
SVE tuple types or to existing fixed-length SVE types.

4 years agoaarch64: Update the mangling of single SVE vectors and predicates
Richard Sandiford [Tue, 25 Aug 2020 12:31:16 +0000 (13:31 +0100)]
aarch64: Update the mangling of single SVE vectors and predicates

GCC was implementing an old mangling scheme for single SVE
vectors and predicates (based on the Advanced SIMD one).
The final definition instead put them in the vendor built-in
namespace via the "u" prefix.

gcc/
* config/aarch64/aarch64-sve-builtins.cc (DEF_SVE_TYPE): Add a
leading "u" to each mangled name.

gcc/testsuite/
* g++.target/aarch64/sve/acle/general-c++/mangle_1.C: Add a leading
"u" to the mangling of each SVE vector and predicate type.
* g++.target/aarch64/sve/acle/general-c++/mangle_2.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_3.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_5.C: Likewise.

4 years agotree-optimization/96548 - fix failure to recompute RPO after CFG change
Richard Biener [Tue, 25 Aug 2020 08:59:24 +0000 (10:59 +0200)]
tree-optimization/96548 - fix failure to recompute RPO after CFG change

This recomputes RPO after store-motion changes the CFG.

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

PR tree-optimization/96548
PR tree-optimization/96760
* tree-ssa-loop-im.c (tree_ssa_lim): Recompute RPO after
store-motion.

* gcc.dg/torture/pr96548.c: New testcase.
* gcc.dg/torture/pr96760.c: Likewise.

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.

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.

4 years agosra: Bail out when encountering accesses with negative offsets (PR 96730)
Martin Jambor [Tue, 25 Aug 2020 11:33:44 +0000 (13:33 +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.

4 years agoFix a typo in rtl.def
Wei Wentao [Tue, 25 Aug 2020 10:41:24 +0000 (11:41 +0100)]
Fix a typo in rtl.def

gcc/
* rtl.def: Fix typo in comment.

4 years agomiddle-end: PR tree-optimization/21137: STRIP_NOPS avoids missed optimization.
Roger Sayle [Tue, 25 Aug 2020 09:50:48 +0000 (10:50 +0100)]
middle-end: PR tree-optimization/21137: STRIP_NOPS avoids missed optimization.

PR tree-optimization/21137 is now an old enhancement request pointing out
that an optimization I added back in 2006, to optimize "((x>>31)&64) != 0"
as "x < 0", doesn't fire in the presence of unanticipated type conversions.
The fix is to call STRIP_NOPS at the appropriate point.

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

gcc/ChangeLog
PR tree-optimization/21137
* fold-const.c (fold_binary_loc) [NE_EXPR/EQ_EXPR]: Call
STRIP_NOPS when checking whether to simplify ((x>>C1)&C2) != 0.

gcc/testsuite/ChangeLog
PR tree-optimization/21137
* gcc.dg/pr21137.c: New test.

4 years agoMIPS: Fix __builtin_longjmp (PR 64242)
Andrew Pinski [Tue, 25 Aug 2020 06:17:52 +0000 (14:17 +0800)]
MIPS: Fix __builtin_longjmp (PR 64242)

The problem here is mips has its own builtin_longjmp
pattern and it was not fixed when expand_builtin_longjmp
was fixed.  We need to read the new fp and gp before
restoring the stack as the buffer might be a local
variable.

2020-08-25  Andrew Pinski  <apinski@marvell.com>

gcc/ChangeLog:

PR middle-end/64242
* config/mips/mips.md (builtin_longjmp): Restore the frame
pointer and stack pointer and gp.

4 years agodebug/96690 - mangle symbols eventually used by late dwarf output
Richard Biener [Mon, 24 Aug 2020 12:12:01 +0000 (14:12 +0200)]
debug/96690 - mangle symbols eventually used by late dwarf output

The following makes sure to, at early debug generation time, mangle
symbols we eventually end up outputting during late finish.

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

PR debug/96690
* dwarf2out.c (reference_to_unused): Make FUNCTION_DECL
processing more consistent with respect to
symtab->global_info_ready.
(tree_add_const_value_attribute): Unconditionally call
rtl_for_decl_init to do all mangling early but throw
away the result if early_dwarf.

* g++.dg/lto/pr96690_0.C: New testcase.

4 years agoRefine typo to fix ICE.
liuhongt [Mon, 24 Aug 2020 12:52:20 +0000 (20:52 +0800)]
Refine typo to fix ICE.

2020-08-24  Hongtao Liu  <hongtao.liu@intel.com>

gcc/ChangeLog:
PR target/96755
* config/i386/sse.md: Correct the mode of NOT operands to
SImode.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr96755.c: New test.

4 years agomatch.pd: Simplify copysign (x, -x) to -x [PR96715]
Jakub Jelinek [Tue, 25 Aug 2020 05:21:26 +0000 (07:21 +0200)]
match.pd: Simplify copysign (x, -x) to -x [PR96715]

The following patch implements an optimization suggested in the PR,
copysign(x,-x) can be optimized into -x (even without -ffast-math,
should work fine even for signed zeros and infinities or nans).

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

PR tree-optimization/96715
* match.pd (copysign(x,-x) -> -x): New simplification.

* gcc.dg/tree-ssa/copy-sign-3.c: New test.

4 years agoc++: Fix up ptr.~PTR () handling [PR96721]
Jakub Jelinek [Tue, 25 Aug 2020 05:19:41 +0000 (07:19 +0200)]
c++: Fix up ptr.~PTR () handling [PR96721]

The following testcase is miscompiled, because build_trivial_dtor_call
handles the case when instance is a pointer by adding a clobber to what
the pointer points to (which is desirable e.g. for delete) rather than the
pointer itself.  That is I think always desirable behavior for references,
but for pointers for the pseudo dtor case it is not.

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

PR c++/96721
* cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
to false.
* call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument.  If
instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
rather than what it points to.
* semantics.c (finish_call_expr): Call build_trivial_dtor_call with
true as NO_PTR_DEREF.

* g++.dg/opt/flifetime-dse8.C: New test.

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.

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 agoDaily bump.
GCC Administrator [Tue, 25 Aug 2020 00:16:24 +0000 (00:16 +0000)]
Daily bump.

4 years agolibbacktrace: add Mach-O 64-bit FAT support
Ian Lance Taylor [Mon, 24 Aug 2020 20:06:52 +0000 (13:06 -0700)]
libbacktrace: add Mach-O 64-bit FAT support

libbacktrace/:
* macho.c (MACH_O_MH_MAGIC_FAT_64): Define.
(MACH_O_MH_CIGAM_FAT_64): Define.
(struct macho_fat_arch_64): Define.
(macho_add_fat): Add and use is_64 parameter.
(macho_add): Recognize 64-bit fat files.

4 years agodoc: Switch valgrind.com to https
Gerald Pfeifer [Mon, 24 Aug 2020 17:07:25 +0000 (19:07 +0200)]
doc: Switch valgrind.com to https

gcc/ChangeLog:
* doc/install.texi (Configuration): Switch valgrind.com to https.

4 years agolibstdc++: Add deduction guide for std::ranges::join_view [LWG 3474]
Jonathan Wakely [Mon, 24 Aug 2020 15:18:32 +0000 (16:18 +0100)]
libstdc++: Add deduction guide for std::ranges::join_view [LWG 3474]

This implements the proposed resolution for LWG 3474.

libstdc++-v3/ChangeLog:

* include/std/ranges (join_view): Add deduction guide (LWG 3474).
* testsuite/std/ranges/adaptors/join_lwg3474.cc: New test.

4 years agolibstdc++: Fix std::indirectly_readable ambiguity [LWG 3446]
Jonathan Wakely [Mon, 24 Aug 2020 15:18:31 +0000 (16:18 +0100)]
libstdc++: Fix std::indirectly_readable ambiguity [LWG 3446]

This implements the proposed resolution of LWG 3446. I'm also adding
another new constrained specialization which isn't proposed by 3446, to
resolve the ambiguity when a type has both value_type and element_type
but denoting different types.

libstdc++-v3/ChangeLog:

* include/bits/iterator_concepts.h (indirectly_readable): Add
partial specializations to resolve ambiguities (LWG 3446).
* testsuite/24_iterators/associated_types/readable.traits.cc:
Check types with both value_type and element_type.

4 years agolibstdc++: Fix iota_view::size() to avoid overflow
Jonathan Wakely [Mon, 24 Aug 2020 15:17:04 +0000 (16:17 +0100)]
libstdc++: Fix iota_view::size() to avoid overflow

This avoids the overflow that occurs when negating the most negative
value of an integral type.

Also prevent returning signed int when the values have lower rank and
promote to int.

libstdc++-v3/ChangeLog:

* include/std/ranges (ranges::iota_view::size()): Perform all
calculations in the right unsigned types.
* testsuite/std/ranges/iota/size.cc: New test.

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.

4 years agolibstdc++: Fix 30_threads/packaged_task/cons/alloc.cc regression
Jonathan Wakely [Mon, 24 Aug 2020 15:06:25 +0000 (16:06 +0100)]
libstdc++: Fix 30_threads/packaged_task/cons/alloc.cc regression

libstdc++-v3/ChangeLog:

* testsuite/30_threads/packaged_task/cons/alloc.cc: Run for
C++11 and skip for C++17 or later.

4 years agoc++: overload dumper
Nathan Sidwell [Mon, 24 Aug 2020 13:28:37 +0000 (06:28 -0700)]
c++: overload dumper

I frequently need to look at overload sets, and debug_node spews more
information than is useful, most of the time.  Here's a dumper for
overloads, that just tells you their full name and where they came from.

gcc/cp
* ptree.c (debug_overload): New.

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.

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.

4 years agoSLP: support entire BB.
Martin Liska [Fri, 31 Jul 2020 08:53:39 +0000 (10:53 +0200)]
SLP: support entire BB.

gcc/ChangeLog:

* tree-vect-data-refs.c (dr_group_sort_cmp): Work on
data_ref_pair.
(vect_analyze_data_ref_accesses): Work on groups.
(vect_find_stmt_data_reference): Add group_id argument and fill
up dataref_groups vector.
* tree-vect-loop.c (vect_get_datarefs_in_loop): Pass new
arguments.
(vect_analyze_loop_2): Likewise.
* tree-vect-slp.c (vect_slp_analyze_bb_1): Pass argument.
(vect_slp_bb_region): Likewise.
(vect_slp_region): Likewise.
(vect_slp_bb):Work on the entire BB.
* tree-vectorizer.h (vect_analyze_data_ref_accesses): Add new
argument.
(vect_find_stmt_data_reference): Likewise.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/bb-slp-38.c: Adjust pattern as now we only process
a single vectorization and now 2 partial.
* gcc.dg/vect/bb-slp-45.c: New test.

4 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.

4 years agoFix libstdc++ testsuite to handle VxWorks gthreads implementation
Corentin Gay [Mon, 24 Aug 2020 02:18:48 +0000 (23:18 -0300)]
Fix libstdc++ testsuite to handle VxWorks gthreads implementation

When implementing the support for gthreads in VxWorks, we stumbled on
a problem in the testsuite. In the libstdc++ testsuite, we
indiscriminately add the `-pthread` switch to the tests that require
linking against the pthread library. In certain cases, such as
VxWorks, the gthread interface relies on the system native threads
lilbrary and the `-pthread` switch does not exist.

This patch adds a condition for the use of the `-pthread` switch. It
adds it only if the target supports it. The patch also adds
`dg-require-gthreads` in tests that were lacking it.

for libstdc++-v3/ChangeLog

* testsuite/20_util/shared_ptr/atomic/3.cc: Do not require POSIX
threads and add -pthread only on targets supporting them.
* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
Likewise.
* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc:
Likewise.
* testsuite/30_threads/async/42819.cc: Likewise.
* testsuite/30_threads/async/49668.cc: Likewise.
* testsuite/30_threads/async/54297.cc: Likewise.
* testsuite/30_threads/async/any.cc: Likewise.
* testsuite/30_threads/async/async.cc: Likewise.
* testsuite/30_threads/async/except.cc: Likewise.
* testsuite/30_threads/async/launch.cc: Likewise.
* testsuite/30_threads/async/lwg2021.cc: Likewise.
* testsuite/30_threads/async/sync.cc: Likewise. : Likewise.
* testsuite/30_threads/call_once/39909.cc: Likewise.
* testsuite/30_threads/call_once/49668.cc: Likewise.
* testsuite/30_threads/call_once/60497.cc: Likewise.
* testsuite/30_threads/call_once/call_once1.cc: Likewise.
* testsuite/30_threads/call_once/dr2442.cc: Likewise.
* testsuite/30_threads/condition_variable/54185.cc: Likewise.
* testsuite/30_threads/condition_variable/cons/1.cc: Likewise.
* testsuite/30_threads/condition_variable/members/1.cc: Likewise.
* testsuite/30_threads/condition_variable/members/2.cc: Likewise.
* testsuite/30_threads/condition_variable/members/3.cc: Likewise.
* testsuite/30_threads/condition_variable/members/53841.cc: Likewise.
* testsuite/30_threads/condition_variable/members/68519.cc: Likewise.
* testsuite/30_threads/condition_variable/native_handle/typesizes.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/50862.cc: Likewise.
* testsuite/30_threads/condition_variable_any/53830.cc: Likewise.
* testsuite/30_threads/condition_variable_any/cond.cc: Likewise.
* testsuite/30_threads/condition_variable_any/cons/1.cc: Likewise.
* testsuite/30_threads/condition_variable_any/members/1.cc: Likewise.
* testsuite/30_threads/condition_variable_any/members/2.cc: Likewise.
* testsuite/30_threads/future/cons/move.cc: Likewise.
* testsuite/30_threads/future/members/45133.cc: Likewise.
* testsuite/30_threads/future/members/get.cc: Likewise.
* testsuite/30_threads/future/members/get2.cc: Likewise.
* testsuite/30_threads/future/members/share.cc: Likewise.
* testsuite/30_threads/future/members/valid.cc: Likewise.
* testsuite/30_threads/future/members/wait.cc: Likewise.
* testsuite/30_threads/future/members/wait_for.cc: Likewise.
* testsuite/30_threads/future/members/wait_until.cc: Likewise.
* testsuite/30_threads/lock/1.cc: Likewise.
* testsuite/30_threads/lock/2.cc: Likewise.
* testsuite/30_threads/lock/3.cc: Likewise.
* testsuite/30_threads/lock/4.cc: Likewise.
* testsuite/30_threads/mutex/cons/1.cc: Likewise.
* testsuite/30_threads/mutex/dest/destructor_locked.cc: Likewise.
* testsuite/30_threads/mutex/lock/1.cc: Likewise.
* testsuite/30_threads/mutex/native_handle/1.cc: Likewise.
* testsuite/30_threads/mutex/native_handle/typesizes.cc: Likewise.
* testsuite/30_threads/mutex/try_lock/1.cc: Likewise.
* testsuite/30_threads/mutex/try_lock/2.cc: Likewise.
* testsuite/30_threads/mutex/unlock/1.cc: Likewise.
* testsuite/30_threads/mutex/unlock/2.cc: Likewise.
* testsuite/30_threads/packaged_task/49668.cc: Likewise.
* testsuite/30_threads/packaged_task/60564.cc: Likewise.
* testsuite/30_threads/packaged_task/cons/1.cc: Likewise.
* testsuite/30_threads/packaged_task/cons/2.cc: Likewise.
* testsuite/30_threads/packaged_task/cons/3.cc: Likewise.
* testsuite/30_threads/packaged_task/cons/56492.cc: Likewise.
* testsuite/30_threads/packaged_task/cons/alloc.cc: Likewise.
* testsuite/30_threads/packaged_task/cons/move.cc: Likewise.
* testsuite/30_threads/packaged_task/cons/move_assign.cc: Likewise.
* testsuite/30_threads/packaged_task/members/at_thread_exit.cc:
Likewise.
* testsuite/30_threads/packaged_task/members/get_future.cc: Likewise.
* testsuite/30_threads/packaged_task/members/get_future2.cc: Likewise.
* testsuite/30_threads/packaged_task/members/invoke.cc: Likewise.
* testsuite/30_threads/packaged_task/members/invoke2.cc: Likewise.
* testsuite/30_threads/packaged_task/members/invoke3.cc: Likewise.
* testsuite/30_threads/packaged_task/members/invoke4.cc: Likewise.
* testsuite/30_threads/packaged_task/members/invoke5.cc: Likewise.
* testsuite/30_threads/packaged_task/members/reset.cc: Likewise.
* testsuite/30_threads/packaged_task/members/reset2.cc: Likewise.
* testsuite/30_threads/packaged_task/members/swap.cc: Likewise.
* testsuite/30_threads/packaged_task/members/valid.cc: Likewise.
* testsuite/30_threads/promise/60966.cc: Likewise.
* testsuite/30_threads/promise/cons/1.cc: Likewise.
* testsuite/30_threads/promise/cons/alloc.cc: Likewise.
* testsuite/30_threads/promise/cons/move.cc: Likewise.
* testsuite/30_threads/promise/cons/move_assign.cc: Likewise.
* testsuite/30_threads/promise/members/at_thread_exit.cc: Likewise.
* testsuite/30_threads/promise/members/at_thread_exit2.cc: Likewise.
* testsuite/30_threads/promise/members/get_future.cc: Likewise.
* testsuite/30_threads/promise/members/get_future2.cc: Likewise.
* testsuite/30_threads/promise/members/set_exception.cc: Likewise.
* testsuite/30_threads/promise/members/set_exception2.cc: Likewise.
* testsuite/30_threads/promise/members/set_value.cc: Likewise.
* testsuite/30_threads/promise/members/set_value2.cc: Likewise.
* testsuite/30_threads/promise/members/set_value3.cc: Likewise.
* testsuite/30_threads/promise/members/swap.cc: Likewise.
* testsuite/30_threads/recursive_mutex/cons/1.cc: Likewise.
* testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc:
Likewise.
* testsuite/30_threads/recursive_mutex/lock/1.cc: Likewise.
* testsuite/30_threads/recursive_mutex/native_handle/1.cc: Likewise.
* testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc:
Likewise.
* testsuite/30_threads/recursive_mutex/try_lock/1.cc: Likewise.
* testsuite/30_threads/recursive_mutex/try_lock/2.cc: Likewise.
* testsuite/30_threads/recursive_mutex/unlock/1.cc: Likewise.
* testsuite/30_threads/recursive_mutex/unlock/2.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise.
* testsuite/30_threads/recursive_timed_mutex/unlock/2.cc: Likewise.
* testsuite/30_threads/shared_future/cons/move.cc: Likewise.
* testsuite/30_threads/shared_future/members/45133.cc: Likewise.
* testsuite/30_threads/shared_future/members/get.cc: Likewise.
* testsuite/30_threads/shared_future/members/get2.cc: Likewise.
* testsuite/30_threads/shared_future/members/valid.cc: Likewise.
* testsuite/30_threads/shared_future/members/wait.cc: Likewise.
* testsuite/30_threads/shared_future/members/wait_for.cc: Likewise.
* testsuite/30_threads/shared_future/members/wait_until.cc: Likewise.
* testsuite/30_threads/shared_lock/cons/1.cc: Likewise.
* testsuite/30_threads/shared_lock/cons/2.cc: Likewise.
* testsuite/30_threads/shared_lock/cons/3.cc: Likewise.
* testsuite/30_threads/shared_lock/cons/4.cc: Likewise.
* testsuite/30_threads/shared_lock/cons/5.cc: Likewise.
* testsuite/30_threads/shared_lock/cons/6.cc: Likewise.
* testsuite/30_threads/shared_lock/locking/1.cc: Likewise.
* testsuite/30_threads/shared_lock/locking/2.cc: Likewise.
* testsuite/30_threads/shared_lock/locking/3.cc: Likewise.
* testsuite/30_threads/shared_lock/locking/4.cc: Likewise.
* testsuite/30_threads/shared_lock/modifiers/1.cc: Likewise.
* testsuite/30_threads/shared_mutex/cons/1.cc: Likewise.
* testsuite/30_threads/shared_mutex/try_lock/1.cc: Likewise.
* testsuite/30_threads/shared_mutex/try_lock/2.cc: Likewise.
* testsuite/30_threads/shared_mutex/unlock/1.cc: Likewise.
* testsuite/30_threads/shared_timed_mutex/cons/1.cc: Likewise.
* testsuite/30_threads/shared_timed_mutex/try_lock/1.cc: Likewise.
* testsuite/30_threads/shared_timed_mutex/try_lock/2.cc: Likewise.
* testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: Likewise.
* testsuite/30_threads/shared_timed_mutex/unlock/1.cc: Likewise.
* testsuite/30_threads/this_thread/1.cc: Likewise.
* testsuite/30_threads/this_thread/sleep_for-mt.cc: Likewise.
* testsuite/30_threads/this_thread/sleep_until-mt.cc: Likewise.
* testsuite/30_threads/thread/cons/1.cc: Likewise.
* testsuite/30_threads/thread/cons/2.cc: Likewise.
* testsuite/30_threads/thread/cons/3.cc: Likewise.
* testsuite/30_threads/thread/cons/4.cc: Likewise.
* testsuite/30_threads/thread/cons/49668.cc: Likewise.
* testsuite/30_threads/thread/cons/5.cc: Likewise.
* testsuite/30_threads/thread/cons/6.cc: Likewise.
* testsuite/30_threads/thread/cons/7.cc: Likewise.
* testsuite/30_threads/thread/cons/8.cc: Likewise.
* testsuite/30_threads/thread/cons/9.cc: Likewise.
* testsuite/30_threads/thread/cons/moveable.cc: Likewise.
* testsuite/30_threads/thread/cons/terminate.cc: Likewise.
* testsuite/30_threads/thread/members/1.cc: Likewise.
* testsuite/30_threads/thread/members/2.cc: Likewise.
* testsuite/30_threads/thread/members/3.cc: Likewise.
* testsuite/30_threads/thread/members/4.cc: Likewise.
* testsuite/30_threads/thread/members/5.cc: Likewise.
* testsuite/30_threads/thread/members/hardware_concurrency.cc:
Likewise.
* testsuite/30_threads/thread/native_handle/typesizes.cc: Likewise.
* testsuite/30_threads/thread/swap/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/cons/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/dest/destructor_locked.cc:
Likewise.
* testsuite/30_threads/timed_mutex/lock/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/native_handle/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/native_handle/typesizes.cc:
Likewise.
* testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Likewise.
* testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise.
* testsuite/30_threads/timed_mutex/unlock/2.cc: Likewise.
* testsuite/30_threads/try_lock/1.cc: Likewise.
* testsuite/30_threads/try_lock/2.cc: Likewise.
* testsuite/30_threads/try_lock/3.cc: Likewise.
* testsuite/30_threads/try_lock/4.cc: Likewise.
* testsuite/30_threads/unique_lock/cons/1.cc: Likewise.
* testsuite/30_threads/unique_lock/cons/2.cc: Likewise.
* testsuite/30_threads/unique_lock/cons/3.cc: Likewise.
* testsuite/30_threads/unique_lock/cons/4.cc: Likewise.
* testsuite/30_threads/unique_lock/cons/5.cc: Likewise.
* testsuite/30_threads/unique_lock/cons/6.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/1.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/3.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/4.cc: Likewise.
* testsuite/30_threads/unique_lock/modifiers/1.cc: Likewise.

4 years agoreorg.c (fill_slots_from_thread): Improve for TARGET_FLAGS_REGNUM
Hans-Peter Nilsson [Mon, 24 Aug 2020 01:15:21 +0000 (03:15 +0200)]
reorg.c (fill_slots_from_thread): Improve for TARGET_FLAGS_REGNUM

This handles TARGET_FLAGS_REGNUM clobbering insns as delay-slot
fillers using a method similar to that in commit 33c2207d3fda,
where care was taken for fill_simple_delay_slots to allow such
insns when scanning for delay-slot fillers *backwards* (before
the insn).

A TARGET_FLAGS_REGNUM target is typically a former cc0 target.
For cc0 targets, insns don't mention clobbering cc0, so the
clobbers are mentioned in the "resources" only as a special
entity and only for compare-insns and branches, where the cc0
value matters.

In contrast, with TARGET_FLAGS_REGNUM, most insns clobber it and
the register liveness detection in reorg.c / resource.c treats
that as a blocker (for other insns mentioning it, i.e. most)
when looking for delay-slot-filling candidates.  This means that
when comparing core and performance for a delay-slot cc0 target
before and after the de-cc0 conversion, the inability to fill a
delay slot after conversion manifests as a regression.  This was
one such case, for CRIS, with random_bitstring in
gcc.c-torture/execute/arith-rand-ll.c as well as the target
libgcc division function.

After this, all known performance regressions compared to cc0
are fixed.

gcc:
PR target/93372
* reorg.c (fill_slots_from_thread): Allow trial insns that clobber
TARGET_FLAGS_REGNUM as delay-slot fillers.

gcc/testsuite:
PR target/93372
* gcc.target/cris/pr93372-47.c: New test.

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

4 years agox86: Add target("general-regs-only") function attribute
H.J. Lu [Fri, 21 Aug 2020 16:42:49 +0000 (09:42 -0700)]
x86: Add target("general-regs-only") function attribute

gcc/

PR target/96744
* config/i386/i386-options.c (IX86_ATTR_IX86_YES): New.
(IX86_ATTR_IX86_NO): Likewise.
(ix86_opt_type): Add ix86_opt_ix86_yes and ix86_opt_ix86_no.
(ix86_valid_target_attribute_inner_p): Handle general-regs-only,
ix86_opt_ix86_yes and ix86_opt_ix86_no.
(ix86_option_override_internal): Check opts->x_ix86_target_flags
instead of opts->x_ix86_target_flags.
* doc/extend.texi: Document target("general-regs-only") function
attribute.

gcc/testsuite/

PR target/96744
* gcc.target/i386/pr96744-1.c: New test.
* gcc.target/i386/pr96744-2.c: Likewise.
* gcc.target/i386/pr96744-3a.c: Likewise.
* gcc.target/i386/pr96744-3b.c: Likewise.
* gcc.target/i386/pr96744-4.c: Likewise.
* gcc.target/i386/pr96744-5.c: Likewise.
* gcc.target/i386/pr96744-6.c: Likewise.
* gcc.target/i386/pr96744-7.c: Likewise.
* gcc.target/i386/pr96744-8a.c: Likewise.
* gcc.target/i386/pr96744-8b.c: Likewise.
* gcc.target/i386/pr96744-9.c: Likewise.

4 years agoChanged to STOP 1 in unlimited_polymorphic_31.f03.
Paul Thomas [Sun, 23 Aug 2020 14:48:36 +0000 (15:48 +0100)]
Changed to STOP 1 in unlimited_polymorphic_31.f03.

2020-08-23  Paul Thomas  <pault@gcc.gnu.org>

gcc/testsuite/
PR fortran/92785
* gfortran.dg/unlimited_polymorphic_31.f03: Change to stop 1.

4 years agoAdding option -g to pr96737.f90.
Paul Thomas [Sun, 23 Aug 2020 14:37:21 +0000 (15:37 +0100)]
Adding option -g to pr96737.f90.

2020-08-23  Paul Thomas  <pault@gcc.gnu.org>

gcc/testsuite/
PR fortran/96737
* gfortran.dg/pr96737.f90: Add option -g.

4 years agoThis patch fixes PR96737. See the explanatory comment in the testcase.
Paul Thomas [Sun, 23 Aug 2020 14:34:27 +0000 (15:34 +0100)]
This patch fixes PR96737. See the explanatory comment in the testcase.

2020-08-23  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/96737
* trans-types.c (gfc_get_derived_type): Derived types that are
used in submodules are not compatible with TYPE_CANONICAL from
any of the global namespaces.

gcc/testsuite/
PR fortran/96737
* gfortran.dg/pr96737.f90: New test.

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

4 years agoanalyzer: fix NULL deref false positives [PR94851]
David Malcolm [Sat, 22 Aug 2020 10:30:17 +0000 (06:30 -0400)]
analyzer: fix NULL deref false positives [PR94851]

PR analyzer/94851 reports various false "NULL dereference" diagnostics.
The first case (comment #1) affects GCC 10.2 but no longer affects
trunk; I believe it was fixed by the state rewrite of
r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d.

The patch adds a regression test for this case.

The other cases (comment #3 and comment #4) still affect trunk.
In both cases, the && in a conditional is optimized to bitwise &
  _1 = p_4 != 0B;
  _2 = p_4 != q_6(D);
  _3 = _1 & _2;
and the analyzer fails to fold this for the case where one (or both) of
the conditionals is false, and thus erroneously considers the path where
"p" is non-NULL despite being passed a NULL value.

Fix this by implementing folding for this case.

gcc/analyzer/ChangeLog:
PR analyzer/94851
* region-model-manager.cc
(region_model_manager::maybe_fold_binop): Fold bitwise "& 0" to 0.

gcc/testsuite/ChangeLog:
PR analyzer/94851
* gcc.dg/analyzer/pr94851-1.c: New test.
* gcc.dg/analyzer/pr94851-3.c: New test.
* gcc.dg/analyzer/pr94851-4.c: New test.

4 years agoanalyzer: simplify store::eval_alias
David Malcolm [Fri, 21 Aug 2020 22:55:11 +0000 (18:55 -0400)]
analyzer: simplify store::eval_alias

I have followup patches that add new conditions to store::eval_alias.
Rather than duplicate all conditions for symmetry, split it up and
call it on both (A, B) and (B, A).

gcc/analyzer/ChangeLog:
* store.cc (store::eval_alias): Make const.  Split out 2nd half
into store::eval_alias_1 and call it twice for symmetry, avoiding
test duplication.
(store::eval_alias_1): New function, split out from the above.
* store.h (store::eval_alias): Make const.
(store::eval_alias_1): New decl.

4 years agoanalyzer: simplify region_model::push_frame
David Malcolm [Fri, 21 Aug 2020 21:19:15 +0000 (17:19 -0400)]
analyzer: simplify region_model::push_frame

region_model::push_frame was binding arguments for both the default SSA
name for each parameter, and the underlying parameter.

Simplify the generated states by only binding the default SSA name if
it exists, or the parameter if there is no default SSA name.

gcc/analyzer/ChangeLog:
* region-model.cc (region_model::push_frame): Bind the default
SSA name for each parm if it exists, falling back to the parm
itself otherwise, rather than doing both.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/malloc-ipa-8-double-free.c: Drop
-fanalyzer-verbose-state-changes.

4 years agolibgccjit: Update comments for gcc_jit_context_new_rvalue_from* functions
Andrea Corallo [Thu, 6 Aug 2020 08:25:40 +0000 (10:25 +0200)]
libgccjit: Update comments for gcc_jit_context_new_rvalue_from* functions

gcc/jit/ChangeLog

2020-08-06  Andrea Corallo  <andrea.corallo@arm.com>

* libgccjit.c:
(gcc_jit_context_new_rvalue_from_int)
(gcc_jit_context_new_rvalue_from_long)
(gcc_jit_context_new_rvalue_from_double)
(gcc_jit_context_new_rvalue_from_ptr): Update function heading
comments.

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

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

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

4 years agolibstdc++: Do not check "cold" name on darwin [PR 96736]
Jonathan Wakely [Fri, 21 Aug 2020 17:23:22 +0000 (18:23 +0100)]
libstdc++: Do not check "cold" name on darwin [PR 96736]

libstdc++-v3/ChangeLog:

PR libstdc++/96736
* testsuite/17_intro/headers/c++1998/all_attributes.cc: Do not
test "cold" on darwin.
* testsuite/17_intro/headers/c++2011/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2014/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2020/all_attributes.cc:
Likewise.

4 years agoUsing gen_int_mode instead of GEN_INT to avoid ICE caused by type promotion.
liuhongt [Wed, 22 Jul 2020 06:37:24 +0000 (14:37 +0800)]
Using gen_int_mode instead of GEN_INT to avoid ICE caused by type promotion.

2020-07-22  Hongtao Liu  <hongtao.liu@intel.com>

gcc/
PR target/96262
* config/i386/i386-expand.c
(ix86_expand_vec_shift_qihi_constant): Refine.

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

4 years agodriver: Fix several memory leaks [PR63854]
Alex Coplan [Fri, 21 Aug 2020 13:26:11 +0000 (14:26 +0100)]
driver: Fix several memory leaks [PR63854]

This patch fixes several memory leaks in the driver, all of which relate
to the handling of static specs. We introduce functions
set_static_spec_{shared,owned}() which are used to enforce proper memory
management when updating the strings in the static_specs table.

This is achieved by making use of the alloc_p field in the table
entries. Similarly to set_spec(), each time we update an entry, we check
whether alloc_p is set, and free the old value if so. We then set
alloc_p correctly based on whether we "own" this memory or whether we're
just taking a pointer to a shared string which we shouldn't free.

The following table shows the number of leaks found by AddressSanitizer
when running a minimal libgccjit program on AArch64. The test program
does the whole libgccjit compilation cycle in a loop (including acquiring
and releasing the context), and the table below shows the number of leaks
for different iterations of that loop.

+--------------+-----+-----+------+---------------+
| # of runs >  | 1   | 2   | 3    | Leaks per run |
+--------------+-----+-----+------+---------------+
| Before patch | 463 | 940 | 1417 | 477           |
+--------------+-----+-----+------+---------------+
| After patch  | 416 | 846 | 1276 | 430           |
+--------------+-----+-----+------+---------------+

gcc/ChangeLog:

PR jit/63854
* gcc.c (set_static_spec): New.
(set_static_spec_owned): New.
(set_static_spec_shared): New.
(driver::maybe_putenv_COLLECT_LTO_WRAPPER): Use
set_static_spec_owned() to take ownership of lto_wrapper_file
such that it gets freed in driver::finalize.
(driver::maybe_run_linker): Use set_static_spec_shared() to
ensure that we don't try and free() the static string "ld",
also ensuring that any previously-allocated string in
linker_name_spec is freed. Likewise with argv0.
(driver::finalize): Use set_static_spec_shared() when resetting
specs that previously had allocated strings; remove if(0)
around call to free().

4 years agoAllow try_split to split RTX_FRAME_RELATED_P insns
Senthil Kumar Selvaraj [Thu, 13 Aug 2020 07:49:26 +0000 (13:19 +0530)]
Allow try_split to split RTX_FRAME_RELATED_P insns

Instead of rejecting RTX_FRAME_RELATED_P insns, allow try_split to split
such insns, provided the split is after reload, and the result of the split
is a single insn.

recog.c:peep2_attempt already splits an RTX_FRAME_RELATED_P insn splitting
to a single insn. This patch refactors existing code copying frame related
info to a separate function (copy_frame_info_to_split_insn) and calls it
from both peep2_attempt and try_split.

2020-08-21  Senthil Kumar Selvaraj  <saaadhu@gcc.gnu.org>

gcc/ChangeLog:

* emit-rtl.c (try_split): Call copy_frame_info_to_split_insn
to split certain RTX_FRAME_RELATED_P insns.
* recog.c (copy_frame_info_to_split_insn): New function.
(peep2_attempt): Split copying of frame related info of
RTX_FRAME_RELATED_P insns into above function and call it.
* recog.h (copy_frame_info_to_split_insn): Declare it.

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.

4 years agoEnable bitwise operation for type mask.
liuhongt [Thu, 13 Aug 2020 06:20:43 +0000 (14:20 +0800)]
Enable bitwise operation for type mask.

Enable operator or/xor/and/andn/not for mask register, kxnor is not
enabled since there's no corresponding instruction for general
registers.

gcc/
PR target/88808
* config/i386/i386.c (ix86_preferred_reload_class): Allow
QImode data go into mask registers.
* config/i386/i386.md: (*movhi_internal): Adjust constraints
for mask registers.
(*movqi_internal): Ditto.
(*anddi_1): Support mask register operations
(*and<mode>_1): Ditto.
(*andqi_1): Ditto.
(*andn<mode>_1): Ditto.
(*<code><mode>_1): Ditto.
(*<code>qi_1): Ditto.
(*one_cmpl<mode>2_1): Ditto.
(*one_cmplsi2_1_zext): Ditto.
(*one_cmplqi2_1): Ditto.
(define_peephole2): Move constant 0/-1 directly into mask
registers.
* config/i386/predicates.md (mask_reg_operand): New predicate.
* config/i386/sse.md (define_split): Add post-reload splitters
that would convert "generic" patterns to mask patterns.
(*knotsi_1_zext): New define_insn.

gcc/testsuite/
* gcc.target/i386/bitwise_mask_op-1.c: New test.
* gcc.target/i386/bitwise_mask_op-2.c: New test.
* gcc.target/i386/bitwise_mask_op-3.c: New test.
* gcc.target/i386/avx512bw-pr88465.c: New testcase.
* gcc.target/i386/avx512bw-kunpckwd-1.c: Adjust testcase.
* gcc.target/i386/avx512bw-kunpckwd-3.c: Ditto.
* gcc.target/i386/avx512dq-kmovb-5.c: Ditto.
* gcc.target/i386/avx512f-kmovw-5.c: Ditto.
* gcc.target/i386/pr55342.c: Ditto.

4 years agoAccording to instruction_tables.pdf
liuhongt [Thu, 24 Oct 2019 03:13:00 +0000 (11:13 +0800)]
According to instruction_tables.pdf

1. Set cost of movement inside mask registers a bit higher than gpr's.
2. Set cost of movement between mask register and gpr much higher than movement
   inside gpr, but still less equal than load/store.
3. Set cost of mask register load/store a bit higher than gpr load/store.

gcc/
* config/i386/x86-tune-costs.h (skylake_cost): Adjust cost
model.

4 years agoEnable direct movement between gpr and mask registers in pass_reload.
liuhongt [Thu, 6 Aug 2020 05:48:38 +0000 (13:48 +0800)]
Enable direct movement between gpr and mask registers in pass_reload.

Changelog
gcc/
* config/i386/i386.c (inline_secondary_memory_needed):
No memory is needed between mask regs and gpr.
(ix86_hard_regno_mode_ok): Add condition TARGET_AVX512F for
mask regno.
* config/i386/i386.h (enum reg_class): Add INT_MASK_REGS.
(REG_CLASS_NAMES): Ditto.
(REG_CLASS_CONTENTS): Ditto.
* config/i386/i386.md: Exclude mask register in
define_peephole2 which is avaiable only for gpr.

gcc/testsuite/
* gcc.target/i386/spill_to_mask-1.c: New tests.
* gcc.target/i386/spill_to_mask-2.c: New tests.
* gcc.target/i386/spill_to_mask-3.c: New tests.
* gcc.target/i386/spill_to_mask-4.c: New tests.

4 years agox86: Add cost model for operation of mask registers.
H.J. Lu [Tue, 3 Sep 2019 21:41:02 +0000 (14:41 -0700)]
x86: Add cost model for operation of mask registers.

gcc/

PR target/71453
* config/i386/i386.h (struct processor_costs): Add member
mask_to_integer, integer_to_mask, mask_load[3], mask_store[3],
mask_move.
* config/i386/x86-tune-costs.h (ix86_size_cost, i386_cost,
i386_cost, pentium_cost, lakemont_cost, pentiumpro_cost,
geode_cost, k6_cost, athlon_cost, k8_cost, amdfam10_cost,
bdver_cost, znver1_cost, znver2_cost, skylake_cost,
btver1_cost, btver2_cost, pentium4_cost, nocona_cost,
atom_cost, slm_cost, intel_cost, generic_cost, core_cost):
Initialize mask_load[3], mask_store[3], mask_move,
integer_to_mask, mask_to_integer for all target costs.
* config/i386/i386.c (ix86_register_move_cost): Using cost
model of mask registers.
(inline_memory_move_cost): Ditto.
(ix86_register_move_cost): Ditto.

4 years agoanalyzer: add regression tests [PR95152]
David Malcolm [Thu, 20 Aug 2020 21:50:14 +0000 (17:50 -0400)]
analyzer: add regression tests [PR95152]

PR analyzer/95152 reports various ICEs in
region_model::get_or_create_mem_ref.

I removed this function as part of the state rewrite in
r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d.
I've verified that these two test cases reproduce the issue with 10.2
and don't ICE with trunk; adding them as regression tests.

gcc/testsuite/ChangeLog:
PR analyzer/95152
* gcc.dg/analyzer/pr95152-4.c: New test.
* gcc.dg/analyzer/pr95152-5.c: New test.

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

4 years agod: Merge upstream dmd 1b5a53d01.
Iain Buclaw [Thu, 20 Aug 2020 16:18:40 +0000 (18:18 +0200)]
d: Merge upstream dmd 1b5a53d01.

Fixes an 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.

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

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 1b5a53d01.

4 years agoanalyzer: fix infinite recursion ICE on unions [PR96723]
David Malcolm [Thu, 20 Aug 2020 14:00:49 +0000 (10:00 -0400)]
analyzer: fix infinite recursion ICE on unions [PR96723]

Attempts to store sm-state into a union in C++ triggered an infinite
recursion when trying to generate a representative tree, due to
erroneously trying to use the dtor of the union as a field.

Fix it by filtering out non-FIELD_DECLs when walking TYPE_FIELDs
in region::get_subregions_for_binding.

gcc/analyzer/ChangeLog:
PR analyzer/96723
* region-model-manager.cc
(region_model_manager::get_field_region): Assert that field is a
FIELD_DECL.
* region.cc (region::get_subregions_for_binding): In
union-handling, filter the TYPE_FIELDS traversal to just FIELD_DECLs.

gcc/testsuite/ChangeLog:
PR analyzer/96723
* g++.dg/analyzer/pr96723.C: New test.

4 years agolibstdc++: Fix typo in ChangeLog
Jonathan Wakely [Thu, 20 Aug 2020 20:56:43 +0000 (21:56 +0100)]
libstdc++: Fix typo in ChangeLog

4 years agoconfigure: Also check C++11 (flags) for ${build} compiler not only for ${host}
Tobias Burnus [Thu, 20 Aug 2020 19:59:00 +0000 (21:59 +0200)]
configure: Also check C++11 (flags) for ${build} compiler not only for ${host}

config/ChangeLog:

PR bootstrap/96612
* ax_cxx_compile_stdcxx.m4: Add fourth argument to check also
the CXX_FOR_BUILD compiler.

ChangeLog:

PR bootstrap/96612
* configure.ac: Run AX_CXX_COMPILE_STDCXX also for ${build} compiler,
if not the same as ${host}.
* configure: Regenerate.

4 years agolibstdc++: Make incrementable<__int128> satisfied in strict mode
Jonathan Wakely [Thu, 20 Aug 2020 18:41:15 +0000 (19:41 +0100)]
libstdc++: Make incrementable<__int128> satisfied in strict mode

This adds specializations of std::incrementable_traits so that 128-bit
integers are always considered incrementable (and therefore usable with
std::ranges::iota_view) even when they don't satisfy std::integral.

libstdc++-v3/ChangeLog:

* include/bits/iterator_concepts.h [__STRICT_ANSI__]
(incrementable_traits<__int128>): Define specialization.
(incrementable_traits<unsigned __int128>): Likewise.
* testsuite/std/ranges/iota/96042.cc: Test iota_view with
__int128.

4 years agoThis patch fixes PRs 96100 and 96101.
Paul Thomas [Thu, 20 Aug 2020 17:17:59 +0000 (18:17 +0100)]
This patch fixes PRs 96100 and 96101.

2020-08-20  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/96100
PR fortran/96101
* trans-array.c (get_array_charlen): Tidy up the evaluation of
the string length for array constructors. Avoid trailing array
references. Ensure string lengths of deferred length components
are set. For parentheses operator apply string  length to both
the primary expression and the enclosed expression.

gcc/testsuite/
PR fortran/96100
PR fortran/96101
* gfortran.dg/char_length_23.f90: New test.

4 years agovxworks: Fix GCC selftests for *-wrs-vxworks7-* targets
Iain Buclaw [Thu, 20 Aug 2020 16:02:58 +0000 (18:02 +0200)]
vxworks: Fix GCC selftests for *-wrs-vxworks7-* targets

Currently when building a cross-compiler targeting arm-wrs-vxworks7, the
self-tests fail unless the VSB_DIR environment variable is set.

This prevents attempts at designating the location of runtime header
files, libraries or startfiles, which would fail on unset environment
variables and aren't needed for such tests.

gcc/ChangeLog:

* config/vxworks.h (VXWORKS_ADDITIONAL_CPP_SPEC): Don't include
VxWorks header files if -fself-test is used.
(STARTFILE_PREFIX_SPEC): Avoid using VSB_DIR if -fself-test is used.

4 years agoFix obvious typo were errmsg_len was assigned to errmsg.
Andre Vehreschild [Thu, 20 Aug 2020 15:50:16 +0000 (17:50 +0200)]
Fix obvious typo were errmsg_len was assigned to errmsg.

gcc/fortran/ChangeLog:

2020-08-20  Andre Vehreschild  <vehre@gcc.gnu.org>

PR fortran/94958
* trans-array.c (gfc_bcast_alloc_comp): Use the correct variable.

4 years agoarm: Require MVE memory operand for destination of vst1q intrinsic
Joe Ramsay [Wed, 19 Aug 2020 12:34:06 +0000 (12:34 +0000)]
arm: Require MVE memory operand for destination of vst1q intrinsic

Previously, the machine description patterns for vst1q accepted a generic memory
operand for the destination, which could lead to an unrecognised builtin when
expanding vst1q* intrinsics. This change fixes the pattern to only accept MVE
memory operands.

gcc/ChangeLog:

PR target/96683
* config/arm/mve.md (mve_vst1q_f<mode>): Require MVE memory operand for
destination.
(mve_vst1q_<supf><mode>): Likewise.

gcc/testsuite/ChangeLog:

PR target/96683
* gcc.target/arm/mve/intrinsics/vst1q_f16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_s16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_s8.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_u16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_u8.c: New test.

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.

4 years agoFortran: Fix OpenMP's 'if(simd:' etc. conditions
Tobias Burnus [Thu, 20 Aug 2020 11:33:21 +0000 (13:33 +0200)]
Fortran: Fix OpenMP's 'if(simd:' etc. conditions

gcc/fortran/ChangeLog:

* openmp.c (gfc_match_omp_clauses): Re-order 'if' clause pasing
to avoid creating spurious symbols.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/lastprivate-conditional-10.f90: New test.

4 years agotestsuite: Remove test for arm32 in arm_soft_ok
Christophe Lyon [Thu, 20 Aug 2020 09:03:10 +0000 (09:03 +0000)]
testsuite: Remove test for arm32 in arm_soft_ok

There is no reason to check for arm32 when checking for
-mfloat=abi-soft support. Instead this implies skipping some tests
when targetting a thumb-1 cpu, while they pass.

This patch removes the arm32 check, and uses the same skeleton as
arm_softfp_ok and arm_hard_ok.

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

gcc/testsuite/
* lib/target-supports.exp (arm_soft_ok): Remove arm32 check.

4 years agotestsuite: Skip arm/pure-code tests for arm*-*-uclinuxfdpiceabi
Christophe Lyon [Thu, 20 Aug 2020 08:51:01 +0000 (08:51 +0000)]
testsuite: Skip arm/pure-code tests for arm*-*-uclinuxfdpiceabi

FDPIC it uses PIC code, which is incompatible with -mpure-code, so we
want to skip these tests for arm*-*-uclinuxfdpiceabi.

This patch also fixes a typo where the final closing bracket was
commented out.

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

gcc/testsuite/
* gcc.target/arm/pure-code/pure-code.exp: Skip for
arm*-*-uclinuxfdpiceabi. Fix missing closing bracket.

4 years agoFortran : rejected f0.d edit descriptor PR96436
Mark Eggleston [Tue, 4 Aug 2020 13:10:08 +0000 (14:10 +0100)]
Fortran  : rejected f0.d edit descriptor PR96436

Zero length f format descriptors are valid for Fortran 95 and
later.  For g format descriptors from Fortran 2008 and later.
Finally for D, E, EN and ES for Fortran 2018 and later.

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

libgfortran/

PR fortran/96436
* io/format.c (parse_format_list):  Add new local variable
"standard" to hold the required standard to check. If the
format width is zero select standard depending on descriptor.
Call notification_std using the new standard variable.

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

gcc/testsuite/

PR fortran/96436
* gfortran.dg/pr96436_1.f90: New test.
* gfortran.dg/pr96436_2.f90: New test.
* gfortran.dg/pr96436_3.f90: New test.
* gfortran.dg/pr96436_4.f90: New test.
* gfortran.dg/pr96436_5.f90: New test.
* gfortran.dg/pr96436_6.f90: New test.
* gfortran.dg/pr96436_7.f90: New test.
* gfortran.dg/pr96436_8.f90: New test.
* gfortran.dg/pr96436_9.f90
* gfortran.dg/pr96436_10.f90

4 years agoanalyzer: fix ICE on vector comparisons [PR96713]
David Malcolm [Wed, 19 Aug 2020 21:36:53 +0000 (17:36 -0400)]
analyzer: fix ICE on vector comparisons [PR96713]

gcc/analyzer/ChangeLog:
PR analyzer/96713
* region-model.cc (region_model::get_gassign_result): For
comparisons, only use eval_condition when the lhs has boolean
type, and use get_or_create_constant_svalue on the boolean
constants directly rather than via get_rvalue.

gcc/testsuite/ChangeLog:
PR analyzer/96713
* gcc.dg/analyzer/pr96713.c: New test.

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

4 years agoc++: Check satisfaction before non-dep convs. [CWG2369]
Jason Merrill [Mon, 17 Aug 2020 20:36:33 +0000 (16:36 -0400)]
c++: Check satisfaction before non-dep convs. [CWG2369]

It's very hard to use concepts to protect a template from hard errors due to
unwanted instantiation if constraints aren't checked until after doing all
substitution and checking of non-dependent conversions.

It was pretty straightforward to insert the satisfaction check into the
logic, but I needed to make the 3-parameter version of
satisfy_declaration_constraints call push_tinst_level like the 2-parameter
version already does.  For simplicity, I also made it add any needed outer
template arguments from the TEMPLATE_DECL to the args.

The testsuite changes are mostly because this change causes unsatisfaction
to cause deduction to fail rather than reject the candidate later in
overload resolution.

gcc/cp/ChangeLog:

DR 2369
* cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
* constraint.cc (satisfy_declaration_constraints):
Use add_outermost_template_args and push_tinst_level.
* pt.c (add_outermost_template_args): Handle getting
a TEMPLATE_DECL as the first argument.
(push_tinst_level, push_tinst_level_loc): No longer static.
(fn_type_unification): Check satisfaction before non-dependent
conversions.

gcc/testsuite/ChangeLog:

DR 2369
* g++.dg/concepts/diagnostic10.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic13.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic2.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic3.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic4.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic5.C: Adjust expexcted errors.
* g++.dg/concepts/diagnostic9.C: Adjust expexcted errors.
* g++.dg/concepts/expression2.C: Adjust expexcted errors.
* g++.dg/concepts/fn5.C: Adjust expexcted errors.
* g++.dg/concepts/placeholder5.C: Adjust expexcted errors.
* g++.dg/concepts/pr67595.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-pr78752-2.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-pr84140.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-recursive-sat3.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-requires18.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-requires19.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts3.C: Adjust expexcted errors.
* g++.dg/cpp2a/concepts-nondep1.C: New test.
* g++.dg/cpp2a/concepts-nondep1a.C: New test.

4 years agolibstdc++: Make make-unsigned-like-t<__int128> work [PR 96042]
Jonathan Wakely [Wed, 19 Aug 2020 19:36:10 +0000 (20:36 +0100)]
libstdc++: Make make-unsigned-like-t<__int128> work [PR 96042]

As well as ensuring that numeric_limits<__int128> is defined, we need to
ensure that make-unsigned-like-t and to-unsigned-like work correctly for
128-bit integers in strict mode. This ensures that a subrange created
from an iota_view's iterator and sentinel can represent its size.

Co-authored-by: Patrick Palka <ppalka@redhat.com>
libstdc++-v3/ChangeLog:

2020-08-19  Jonathan Wakely  <jwakely@redhat.com>
    Patrick Palka  <ppalka@redhat.com>

PR libstdc++/96042
* include/bits/range_access.h (__detail::__to_unsigned_like):
Do not use make_unsigned_t<T> in the return type, as it can
result in an error before the integral<T> constraint is checked.
[__STRICT_ANSI__]: Add overloads for 128-bit integer types.
(__detail::__make_unsigned_like_t): Define as the return type
of __to_unsigned_like.
* testsuite/std/ranges/subrange/96042.cc: New test.

4 years agoanalyzer: fix ICE on deref_rvalue on SK_COMPOUND [PR96643]
David Malcolm [Wed, 19 Aug 2020 17:21:47 +0000 (13:21 -0400)]
analyzer: fix ICE on deref_rvalue on SK_COMPOUND [PR96643]

gcc/analyzer/ChangeLog:
PR analyzer/96643
* region-model.cc (region_model::deref_rvalue): Rather than
attempting to handle all svalue kinds in the switch, only cover
the special cases, and move symbolic-region handling to after
the switch, thus implicitly handling the missing case SK_COMPOUND.

gcc/testsuite/ChangeLog:
PR analyzer/96643
* g++.dg/analyzer/pr96643.C: New test.

4 years agoanalyzer: fix ICE on folding vector 0 [PR96705]
David Malcolm [Wed, 19 Aug 2020 13:27:16 +0000 (09:27 -0400)]
analyzer: fix ICE on folding vector 0 [PR96705]

gcc/analyzer/ChangeLog:
* region-model-manager.cc
PR analyzer/96705
(region_model_manager::maybe_fold_binop): Check that we have an
integral type before calling build_int_cst.

gcc/testsuite/ChangeLog:
PR analyzer/96705
* gcc.dg/analyzer/pr96705.c: New test.

4 years agoanalyzer: fix ICE converting float to int [PR96699]
David Malcolm [Wed, 19 Aug 2020 09:00:52 +0000 (05:00 -0400)]
analyzer: fix ICE converting float to int [PR96699]

gcc/analyzer/ChangeLog:
PR analyzer/96699
* region-model-manager.cc
(region_model_manager::get_or_create_cast): Use FIX_TRUNC_EXPR for
casting from REAL_TYPE to INTEGER_TYPE.

gcc/testsuite/ChangeLog:
PR analyzer/96699
* gcc.dg/analyzer/pr96699.c: New test.

4 years agors6000, restrict bfloat convert intrinsic to Power 10. Fix BU_P10V macro definitions.
Carl Love [Tue, 11 Aug 2020 00:37:41 +0000 (19:37 -0500)]
rs6000, restrict bfloat convert intrinsic to Power 10. Fix BU_P10V macro definitions.

gcc/ChangeLog

    2020-08-19  Carl Love  <cel@us.ibm.com>
* config/rs6000/rs6000-builtin.def (BU_P10V_0, BU_P10V_1,
BU_P10V_2, BU_P10V_3): Rename BU_P10V_VSX_0, BU_P10V_VSX_1,
BU_P10V_VSX_2, BU_P10V_VSX_3 respectively.
(BU_P10V_4): Remove.
(BU_P10V_AV_0, BU_P10V_AV_1, BU_P10V_AV_2, BU_P10V_AV_3, BU_P10V_AV_4):
New definitions for Power 10 Altivec macros.
(VSTRIBR, VSTRIHR, VSTRIBL, VSTRIHL, VSTRIBR_P, VSTRIHR_P,
VSTRIBL_P, VSTRIHL_P, MTVSRBM, MTVSRHM, MTVSRWM, MTVSRDM, MTVSRQM,
VEXPANDMB, VEXPANDMH, VEXPANDMW, VEXPANDMD, VEXPANDMQ, VEXTRACTMB,
VEXTRACTMH, VEXTRACTMW, VEXTRACTMD, VEXTRACTMQ): Replace macro
expansion BU_P10V_1 with BU_P10V_AV_1.
(VCLRLB, VCLRRB, VCFUGED, VCLZDM, VCTZDM, VPDEPD, VPEXTD, VGNB,
VCNTMBB, VCNTMBH, VCNTMBW, VCNTMBD): Replace macro expansion
BU_P10V_2 with BU_P10V_AV_2.
(VEXTRACTBL, VEXTRACTHL, VEXTRACTWL, VEXTRACTDL, VEXTRACTBR, VEXTRACTHR,
VEXTRACTWR, VEXTRACTDR, VINSERTGPRBL, VINSERTGPRHL, VINSERTGPRWL,
VINSERTGPRDL, VINSERTVPRBL, VINSERTVPRHL, VINSERTVPRWL, VINSERTGPRBR,
VINSERTGPRHR, VINSERTGPRWR, VINSERTGPRDR, VINSERTVPRBR, VINSERTVPRHR,
VINSERTVPRWR, VREPLACE_ELT_V4SI, VREPLACE_ELT_UV4SI, VREPLACE_ELT_V2DF,
VREPLACE_ELT_V4SF, VREPLACE_ELT_V2DI, VREPLACE_ELT_UV2DI, VREPLACE_UN_V4SI,
VREPLACE_UN_UV4SI, VREPLACE_UN_V4SF, VREPLACE_UN_V2DI, VREPLACE_UN_UV2DI,
VREPLACE_UN_V2DF, VSLDB_V16QI, VSLDB_V8HI, VSLDB_V4SI, VSLDB_V2DI,
VSRDB_V16QI, VSRDB_V8HI, VSRDB_V4SI, VSRDB_V2DI): Replace macro expansion
BU_P10V_3 with BU_P10V_AV_3.
(VXXSPLTIW_V4SI, VXXSPLTIW_V4SF, VXXSPLTID): Replace macro expansion
BU_P10V_1 with BU_P10V_AV_1.
(XXGENPCVM_V16QI, XXGENPCVM_V8HI, XXGENPCVM_V4SI, XXGENPCVM_V2DI):
Replace macro expansion BU_P10V_2 with BU_P10V_VSX_2.
(VXXSPLTI32DX_V4SI, VXXSPLTI32DX_V4SF, VXXBLEND_V16QI, VXXBLEND_V8HI,
VXXBLEND_V4SI, VXXBLEND_V2DI, VXXBLEND_V4SF, VXXBLEND_V2DF): Replace macor
expansion BU_P10V_3 with BU_P10V_VSX_3.
(XXEVAL, VXXPERMX): Replace macro expansion BU_P10V_4 with BU_P10V_VSX_4.
(XVCVBF16SP, XVCVSPBF16): Replace macro expansion BU_VSX_1 with
BU_P10V_VSX_1. Also change MISC to CONST.
* config/rs6000/rs6000-c.c: (P10_BUILTIN_VXXPERMX): Replace with
P10V_BUILTIN_VXXPERMX.
(P10_BUILTIN_VCLRLB, P10_BUILTIN_VCLRLB, P10_BUILTIN_VCLRRB,
P10_BUILTIN_VGNB, P10_BUILTIN_XXEVAL, P10_BUILTIN_VXXPERMX,
P10_BUILTIN_VEXTRACTBL, P10_BUILTIN_VEXTRACTHL, P10_BUILTIN_VEXTRACTWL,
P10_BUILTIN_VEXTRACTDL, P10_BUILTIN_VINSERTGPRHL,
P10_BUILTIN_VINSERTGPRWL, P10_BUILTIN_VINSERTGPRDL,
P10_BUILTIN_VINSERTVPRBL, P10_BUILTIN_VINSERTVPRHL,
P10_BUILTIN_VEXTRACTBR, P10_BUILTIN_VEXTRACTHR,
P10_BUILTIN_VEXTRACTWR, P10_BUILTIN_VEXTRACTDR,
P10_BUILTIN_VINSERTGPRBR, P10_BUILTIN_VINSERTGPRHR,
P10_BUILTIN_VINSERTGPRWR, P10_BUILTIN_VINSERTGPRDR,
P10_BUILTIN_VINSERTVPRBR, P10_BUILTIN_VINSERTVPRHR,
P10_BUILTIN_VINSERTVPRWR, P10_BUILTIN_VREPLACE_ELT_UV4SI,
P10_BUILTIN_VREPLACE_ELT_V4SI, P10_BUILTIN_VREPLACE_ELT_UV2DI,
P10_BUILTIN_VREPLACE_ELT_V2DI, P10_BUILTIN_VREPLACE_ELT_V2DF,
P10_BUILTIN_VREPLACE_UN_UV4SI, P10_BUILTIN_VREPLACE_UN_V4SI,
P10_BUILTIN_VREPLACE_UN_V4SF, P10_BUILTIN_VREPLACE_UN_UV2DI,
P10_BUILTIN_VREPLACE_UN_V2DI, P10_BUILTIN_VREPLACE_UN_V2DF,
P10_BUILTIN_VSLDB_V16QI, P10_BUILTIN_VSLDB_V16QI,
P10_BUILTIN_VSLDB_V8HI, P10_BUILTIN_VSLDB_V4SI,
P10_BUILTIN_VSLDB_V2DI, P10_BUILTIN_VXXSPLTIW_V4SI,
P10_BUILTIN_VXXSPLTIW_V4SF, P10_BUILTIN_VXXSPLTID,
P10_BUILTIN_VXXSPLTI32DX_V4SI, P10_BUILTIN_VXXSPLTI32DX_V4SF,
P10_BUILTIN_VXXBLEND_V16QI, P10_BUILTIN_VXXBLEND_V8HI,
P10_BUILTIN_VXXBLEND_V4SI, P10_BUILTIN_VXXBLEND_V2DI,
P10_BUILTIN_VXXBLEND_V4SF, P10_BUILTIN_VXXBLEND_V2DF,
P10_BUILTIN_VSRDB_V16QI, P10_BUILTIN_VSRDB_V8HI,
P10_BUILTIN_VSRDB_V4SI, P10_BUILTIN_VSRDB_V2DI,
P10_BUILTIN_VSTRIBL, P10_BUILTIN_VSTRIHL,
P10_BUILTIN_VSTRIBL_P, P10_BUILTIN_VSTRIHL_P,
P10_BUILTIN_VSTRIBR, P10_BUILTIN_VSTRIHR,
P10_BUILTIN_VSTRIBR_P, P10_BUILTIN_VSTRIHR_P,
P10_BUILTIN_MTVSRBM, P10_BUILTIN_MTVSRHM,
P10_BUILTIN_MTVSRWM, P10_BUILTIN_MTVSRDM,
P10_BUILTIN_MTVSRQM, P10_BUILTIN_VCNTMBB,
P10_BUILTIN_VCNTMBH, P10_BUILTIN_VCNTMBW,
P10_BUILTIN_VCNTMBD, P10_BUILTIN_VEXPANDMB,
P10_BUILTIN_VEXPANDMH, P10_BUILTIN_VEXPANDMW,
P10_BUILTIN_VEXPANDMD, P10_BUILTIN_VEXPANDMQ,
P10_BUILTIN_VEXTRACTMB, P10_BUILTIN_VEXTRACTMH,
P10_BUILTIN_VEXTRACTMW, P10_BUILTIN_VEXTRACTMD,
P10_BUILTIN_VEXTRACTMQ, P10_BUILTIN_XVTLSBB_ZEROS,
P10_BUILTIN_XVTLSBB_ONES): Replace with
P10V_BUILTIN_VCLRLB, P10V_BUILTIN_VCLRLB, P10V_BUILTIN_VCLRRB,
P10V_BUILTIN_VGNB, P10V_BUILTIN_XXEVAL, P10V_BUILTIN_VXXPERMX,
P10V_BUILTIN_VEXTRACTBL, P10V_BUILTIN_VEXTRACTHL, P10V_BUILTIN_VEXTRACTWL,
P10V_BUILTIN_VEXTRACTDL, P10V_BUILTIN_VINSERTGPRHL,
P10V_BUILTIN_VINSERTGPRWL, P10V_BUILTIN_VINSERTGPRDL,
P10V_BUILTIN_VINSERTVPRBL,P10V_BUILTIN_VINSERTVPRHL,
P10V_BUILTIN_VEXTRACTBR, P10V_BUILTIN_VEXTRACTHR
P10V_BUILTIN_VEXTRACTWR, P10V_BUILTIN_VEXTRACTDR,
P10V_BUILTIN_VINSERTGPRBR, P10V_BUILTIN_VINSERTGPRHR,
P10V_BUILTIN_VINSERTGPRWR, P10V_BUILTIN_VINSERTGPRDR,
P10V_BUILTIN_VINSERTVPRBR, P10V_BUILTIN_VINSERTVPRHR,
P10V_BUILTIN_VINSERTVPRWR, P10V_BUILTIN_VREPLACE_ELT_UV4SI,
P10V_BUILTIN_VREPLACE_ELT_V4SI, P10V_BUILTIN_VREPLACE_ELT_UV2DI,
P10V_BUILTIN_VREPLACE_ELT_V2DI, P10V_BUILTIN_VREPLACE_ELT_V2DF,
P10V_BUILTIN_VREPLACE_UN_UV4SI, P10V_BUILTIN_VREPLACE_UN_V4SI,
P10V_BUILTIN_VREPLACE_UN_V4SF, P10V_BUILTIN_VREPLACE_UN_UV2DI,
P10V_BUILTIN_VREPLACE_UN_V2DI, P10V_BUILTIN_VREPLACE_UN_V2DF,
P10V_BUILTIN_VSLDB_V16QI, P10V_BUILTIN_VSLDB_V16QI,
P10V_BUILTIN_VSLDB_V8HI, P10V_BUILTIN_VSLDB_V4SI,
P10V_BUILTIN_VSLDB_V2DI, P10V_BUILTIN_VXXSPLTIW_V4SI,
P10V_BUILTIN_VXXSPLTIW_V4SF, P10V_BUILTIN_VXXSPLTID,
P10V_BUILTIN_VXXSPLTI32DX_V4SI, P10V_BUILTIN_VXXSPLTI32DX_V4SF,
P10V_BUILTIN_VXXBLEND_V16QI, P10V_BUILTIN_VXXBLEND_V8HI,
P10V_BUILTIN_VXXBLEND_V4SI, P10V_BUILTIN_VXXBLEND_V2DI,
P10V_BUILTIN_VXXBLEND_V4SF, P10V_BUILTIN_VXXBLEND_V2DF,
P10V_BUILTIN_VSRDB_V16QI, P10V_BUILTIN_VSRDB_V8HI,
P10V_BUILTIN_VSRDB_V4SI, P10V_BUILTIN_VSRDB_V2DI,
P10V_BUILTIN_VSTRIBL, P10V_BUILTIN_VSTRIHL,
P10V_BUILTIN_VSTRIBL_P, P10V_BUILTIN_VSTRIHL_P,
P10V_BUILTIN_VSTRIBR, P10V_BUILTIN_VSTRIHR,
P10V_BUILTIN_VSTRIBR_P, P10V_BUILTIN_VSTRIHR_P,
P10V_BUILTIN_MTVSRBM, P10V_BUILTIN_MTVSRHM,
P10V_BUILTIN_MTVSRWM, P10V_BUILTIN_MTVSRDM,
P10V_BUILTIN_MTVSRQM, P10V_BUILTIN_VCNTMBB,
P10V_BUILTIN_VCNTMBH, P10V_BUILTIN_VCNTMBW,
P10V_BUILTIN_VCNTMBD, P10V_BUILTIN_VEXPANDMB,
P10V_BUILTIN_VEXPANDMH, P10V_BUILTIN_VEXPANDMW,
P10V_BUILTIN_VEXPANDMD, P10V_BUILTIN_VEXPANDMQ,
P10V_BUILTIN_VEXTRACTMB, P10V_BUILTIN_VEXTRACTMH,
P10V_BUILTIN_VEXTRACTMW, P10V_BUILTIN_VEXTRACTMD,
P10V_BUILTIN_VEXTRACTMQ, P10V_BUILTIN_XVTLSBB_ZEROS,
P10V_BUILTIN_XVTLSBB_ONES respectively.
* config/rs6000/rs6000-call.c: Ditto above, change P10_BUILTIN_name to
P10V_BUILTIN_name.
(P10_BUILTIN_XVCVSPBF16, P10_BUILTIN_XVCVBF16SP): Change to
P10V_BUILTIN_XVCVSPBF16, P10V_BUILTIN_XVCVBF16SP respectively.

4 years agors6000: Enable more sibcalls when TOC is not preserved
Bill Schmidt [Wed, 19 Aug 2020 18:43:55 +0000 (13:43 -0500)]
rs6000: Enable more sibcalls when TOC is not preserved

A function compiled with the PC-relative addressing model does not
require r2 to contain a TOC pointer, and does not guarantee that r2
will be preserved for its caller.  Such a function can make sibcalls
without restriction based on TOC preservation rules.  However, a
caller that does preserve r2 cannot make a sibcall to a callee that
does not.

2020-08-19  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* config/rs6000/rs6000-logue.c (rs6000_decl_ok_for_sibcall):
Sibcalls are always legal when the caller doesn't preserve r2.

gcc/testsuite/
* gcc.target/powerpc/pcrel-sibcall-1.c: Adjust.

4 years agolibstdc++: Remove deprecated comparison operators for RB trees
Jonathan Wakely [Wed, 19 Aug 2020 16:04:49 +0000 (17:04 +0100)]
libstdc++: Remove deprecated comparison operators for RB trees

These functions were deprecated in GCC 9.1.0 because they are never used
by the library. This patch removes them for GCC 11.

libstdc++-v3/ChangeLog:

* include/bits/stl_tree.h (operator!=, operator>, operator<=)
(operator>=): Remove deprecated functions.

4 years agolibstdc++: Make __int128 meet integer-class requirements [PR 96042]
Jonathan Wakely [Wed, 19 Aug 2020 15:27:25 +0000 (16:27 +0100)]
libstdc++: Make __int128 meet integer-class requirements [PR 96042]

Because __int128 can be used as the difference type for iota_view, we
need to ensure that it meets the requirements of an integer-class type.
The requirements in [iterator.concept.winc] p10 include numeric_limits
being specialized and giving meaningful answers. Currently we only
specialize numeric_limits for non-standard integer types in non-strict
modes.  However, nothing prevents us from defining an explicit
specialization for any implementation-defined type, so it doesn't matter
whether std::is_integral<__int128> is true or not.

This patch ensures that the numeric_limits specializations for signed
and unsigned __int128 are defined whenever __int128 is available. It
also makes the __numeric_traits and __int_limits helpers work for
__int128, via a new __gnu_cxx::__is_integer_nonstrict trait.

libstdc++-v3/ChangeLog:

PR libstdc++/96042
* include/ext/numeric_traits.h (__is_integer_nonstrict): New
trait which is true for 128-bit integers even in strict modes.
(__numeric_traits_integer, __numeric_traits): Use
__is_integer_nonstrict instead of __is_integer.
* include/std/limits [__STRICT_ANSI__ && __SIZEOF_INT128__]
(numeric_limits<__int128>, (numeric_limits<unsigned __int128>):
Define.
* testsuite/std/ranges/iota/96042.cc: New test.

4 years agoi386: Use code_for_ instead of gen_ for parameterized names more.
Uros Bizjak [Wed, 19 Aug 2020 15:14:13 +0000 (17:14 +0200)]
i386: Use code_for_ instead of gen_ for parameterized names more.

Some builtins are better expanded to patterns with
parametrized names via code_for_ than gen_ helpers.

No functional changes.

2020-08-19  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

* config/i386/i386-expand.c (ix86_expand_builtin)
[case IX86_BUILTIN_ENQCMD, case IX86_BUILTIN_ENQCMDS]:
Rewrite expansion to use code_for_enqcmd.
[case IX86_BUILTIN_WRSSD, case IX86_BUILTIN_WRSSQ]:
Rewrite expansion to use code_for_wrss.
[case IX86_BUILTIN_WRUSSD, case IX86_BUILTIN_WRUSSD]:
Rewrite expansion to use code_for_wrss.

4 years agotree-optimization/94234 - add pattern for ptr-diff on addresses with same offset
Feng Xue [Mon, 1 Jun 2020 03:57:35 +0000 (11:57 +0800)]
tree-optimization/94234 - add pattern for ptr-diff on addresses with same offset

2020-08-19  Feng Xue  <fxue@os.amperecomputing.com>

gcc/
PR tree-optimization/94234
* match.pd ((PTR_A + OFF) - (PTR_B + OFF)) -> (PTR_A - PTR_B): New
simplification.

gcc/testsuite/
PR tree-optimization/94234
* gcc.dg/pr94234-1.c: New test.

4 years agolibstdc++: Mention new macros in comments
Jonathan Wakely [Wed, 19 Aug 2020 11:42:02 +0000 (12:42 +0100)]
libstdc++: Mention new macros in comments

libstdc++-v3/ChangeLog:

* include/bits/c++config (_GLIBCXX_DEPRECATED_SUGGEST)
(_GLIBCXX11_DEPRECATED, _GLIBCXX11_DEPRECATED_SUGGEST)
(_GLIBCXX17_DEPRECATED_SUGGEST, _GLIBCXX20_DEPRECATED_SUGGEST):
Add new macros to comment.

4 years agolibstdc++: integer-class types as per [iterator.concept.winc]
Patrick Palka [Wed, 19 Aug 2020 13:12:55 +0000 (09:12 -0400)]
libstdc++: integer-class types as per [iterator.concept.winc]

This implements signed and unsigned integer-class types, whose width is
one bit larger than the widest supported signed and unsigned integral
type respectively.  In our case this is either __int128 and unsigned
__int128, or long long and unsigned long long.

Internally, the two integer-class types are represented as a largest
supported unsigned integral type plus one extra bit.  The signed
integer-class type is represented in two's complement form with the
extra bit acting as the sign bit.

libstdc++-v3/ChangeLog:

* include/Makefile.am (bits_headers): Add new header
<bits/max_size_type.h>.
* include/Makefile.in: Regenerate.
* include/bits/iterator_concepts.h
(ranges::__detail::__max_diff_type): Remove definition, replace
with forward declaration of class __max_diff_type.
(__detail::__max_size_type): Remove definition, replace with
forward declaration of class __max_size_type.
(__detail::__is_unsigned_int128, __is_signed_int128)
(__is_int128): New concepts.
(__detail::__is_integer_like): Accept __int128 and unsigned
__int128.
(__detail::__is_signed_integer_like): Accept __int128.
* include/bits/max_size_type.h: New header.
* include/bits/range_access.h: Include <bits/max_size_type.h>.
(__detail::__to_unsigned_like): Two new overloads.
* testsuite/std/ranges/iota/difference_type.cc: New test.
* testsuite/std/ranges/iota/max_size_type.cc: New test.

4 years agox86: Detect Rocket Lake and Alder Lake
H.J. Lu [Sun, 16 Aug 2020 13:14:25 +0000 (06:14 -0700)]
x86: Detect Rocket Lake and Alder Lake

From arch/x86/include/asm/intel-family.h on Linux kernel master branch:

 #define INTEL_FAM6_ROCKETLAKE           0xA7
 #define INTEL_FAM6_ALDERLAKE            0x97

* common/config/i386/cpuinfo.h (get_intel_cpu): Detect Rocket
Lake and Alder Lake.

4 years agolibstdc++: Add deprecated attributes to old iostream members
Jonathan Wakely [Wed, 19 Aug 2020 11:13:03 +0000 (12:13 +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.

In order to give deprecated warnings even in C++98 mode this patch makes
_GLIBCXX_DEPRECATED work even for C++98, adds _GLIBCXX11_DEPRECATED for
the old meaning of _GLIBCXX_DEPRECATED, and adds new macros such as
_GLIBCXX_DEPRECATED_SUGGEST for suggesting alternatives to deprecated
features.

libstdc++-v3/ChangeLog:

* include/bits/c++config (_GLIBCXX_DEPRECATED): Define for all
standard modes.
(_GLIBCXX_DEPRECATED_SUGGEST): New macro for "use 'foo' instead"
message in deprecated warnings.
(_GLIBCXX11_DEPRECATED, _GLIBCXX11_DEPRECATED_SUGGEST): New
macros for marking features derpecated in C++11.
(_GLIBCXX17_DEPRECATED_SUGGEST, _GLIBCXX20_DEPRECATED_SUGGEST):
New macros.
* include/backward/auto_ptr.h (auto_ptr_ref, auto_ptr<void>):
Use _GLIBCXX11_DEPRECATED instead of _GLIBCXX_DEPRECATED.
(auto_ptr): Use _GLIBCXX11_DEPRECATED_SUGGEST.
* include/backward/binders.h (binder1st, binder2nd): Likewise.
* 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.

4 years agolibstdc++: assert that type traits are not misused with incomplete types [PR 71579]
Antony Polukhin [Wed, 19 Aug 2020 11:10:57 +0000 (12:10 +0100)]
libstdc++: assert that type traits are not misused with incomplete types [PR 71579]

libstdc++-v3/ChangeLog:

2020-08-19  Antony Polukhin  <antoshkka@gmail.com>

PR libstdc++/71579
* include/std/type_traits (invoke_result, is_nothrow_invocable_r)
Add static_asserts to make sure that the argument of the type
trait is not misused with incomplete types.
(is_swappable_with, is_nothrow_swappable_with): Add static_asserts
to make sure that the first and second arguments of the type trait
are not misused with incomplete types.
* testsuite/20_util/invoke_result/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_swappable/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_swappable_with/incomplete_neg.cc: New
test.
* testsuite/20_util/is_swappable_with/incomplete_neg.cc: New test.

4 years agoAArch64: Remove "fndecl && TREE_PUBLIC (fndecl)" in aarch64_init_cumulative_args
Peixin Qiao [Wed, 19 Aug 2020 09:55:19 +0000 (10:55 +0100)]
AArch64: Remove "fndecl && TREE_PUBLIC (fndecl)" in aarch64_init_cumulative_args

This check will prevent the function type check of static funtion or calling
via a funtion pointer. The function type should be checked no matter if the
function has external linkage.

gcc/ChangeLog:

* config/aarch64/aarch64.c (aarch64_init_cumulative_args): Remove
"fndecl && TREE_PUBLIC (fndecl)" check since it prevents the funtion
type check when calling via a function pointer or when calling a static
function.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/mgeneral-regs_7.c: New test.

4 years agotestsuite: require c99 runtime for trigonometric optimisation tests
Pat Bernardi [Wed, 19 Aug 2020 09:05:21 +0000 (10:05 +0100)]
testsuite: require c99 runtime for trigonometric optimisation tests

A number of optimisation that simplify trigonometric expressions are only
performed when the compiler knows the target has a C99 libm available.
Since targets like *-elf may not have such a libm, a C99 runtime requirement
is added to these tests.

2020-08-19  Pat Bernardi  <bernardi@adacore.com>

gcc/testsuite/ChangeLog

* gcc.dg/sinatan-2.c: Add dg-require-effective-target c99_runtime.
* gcc.dg/sinhovercosh-1.c: Likewise.
* gcc.dg/tanhbysinh.c: Likewise.

4 years ago[testsuite, nvptx] Add effective target sync_int_long_stack
Tom de Vries [Mon, 10 Aug 2020 13:42:38 +0000 (15:42 +0200)]
[testsuite, nvptx] Add effective target sync_int_long_stack

The nvptx target currently doesn't support effective target sync_int_long,
although it has support for 32-bit and 64-bit atomic.

When enabling sync_int_long for nvptx, we run into a failure in
gcc.dg/pr86314.c:
...
 nvptx-run: error getting kernel result: operation not supported on \
   global/shared address space
...
due to a ptx restriction:  accesses to local memory are illegal, and the
test-case does an atomic operation on a stack address, which is mapped to
local memory.

Fix this by adding a target sync_int_long_stack, wich returns false for nvptx,
which can be used to mark test-cases that require sync_int_long support for
stack addresses.

Build on nvptx and tested with make check-gcc.

gcc/testsuite/ChangeLog:

PR target/96494
* lib/target-supports.exp (check_effective_target_sync_int_long):
Return 1 for nvptx.
(check_effective_target_sync_int_long_stack): New proc.
* gcc.dg/pr86314.c: Require effective target sync_int_long_stack.

4 years agooptions: Make --help= see overridden values
Kewen Lin [Wed, 19 Aug 2020 02:37:39 +0000 (21:37 -0500)]
options: Make --help= see overridden values

Options "-Q --help=params" don't show the final values after
target option overriding, instead it emits the default values
in params.opt (without any explicit param settings).

This patch makes it see overridden values.

gcc/ChangeLog:

* opts-global.c (decode_options): Call target_option_override_hook
before it prints for --help=*.

4 years agoanalyzer: consider initializers for globals [PR96651]
David Malcolm [Mon, 17 Aug 2020 20:35:10 +0000 (16:35 -0400)]
analyzer: consider initializers for globals [PR96651]

PR analyzer/96651 reports a false positive in which a global
that can't have been touched yet is checked in "main".  The analyzer
fails to reject code paths in which the initial value of the global
makes the path condition impossible.

This patch detects cases where the code path begins at the entrypoint
of "main", and extracts values from initializers for globals that
can't have been touched yet, rather than using a symbolic
"INIT_VAL(REG)", fixing the false positive.

gcc/analyzer/ChangeLog:
PR analyzer/96651
* region-model.cc (region_model::called_from_main_p): New.
(region_model::get_store_value): Move handling for globals into...
(region_model::get_initial_value_for_global): ...this new
function, and add logic for extracting values from decl
initializers.
* region-model.h (decl_region::get_svalue_for_constructor): New
decl.
(decl_region::get_svalue_for_initializer): New decl.
(region_model::called_from_main_p): New decl.
(region_model::get_initial_value_for_global): New.
* region.cc (decl_region::maybe_get_constant_value): Move logic
for getting an svalue from a CONSTRUCTOR node to...
(decl_region::get_svalue_for_constructor): ...this new function.
(decl_region::get_svalue_for_initializer): New.
* store.cc (get_svalue_for_ctor_val): Rewrite in terms of
region_model::get_rvalue.
* store.h (binding_cluster::get_map): New accessor.

gcc/testsuite/ChangeLog:
PR analyzer/96651
* gcc.dg/analyzer/pr96651-1.c: New test.
* gcc.dg/analyzer/pr96651-2.c: New test.

4 years agoanalyzer: fix ICE with negative bit offsets [PR96648]
David Malcolm [Tue, 18 Aug 2020 01:12:35 +0000 (21:12 -0400)]
analyzer: fix ICE with negative bit offsets [PR96648]

PR analyzer/96648 reports an ICE within get_field_at_bit_offset due
to a negative bit offset, arising due to pointer arithmetic.

This patch replaces an assertion with handling for this case, fixing the
ICE.

gcc/analyzer/ChangeLog:
PR analyzer/96648
* region.cc (get_field_at_bit_offset): Gracefully handle negative
values for bit_offset.

gcc/testsuite/ChangeLog:
PR analyzer/96648
* gcc.dg/analyzer/pr96648.c: New test.

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

4 years agoc++: alias template template_info setting
Nathan Sidwell [Tue, 18 Aug 2020 21:48:58 +0000 (14:48 -0700)]
c++: alias template template_info setting

During the construction of alias templates we can alter its
template_info.  This is really weird, because that's morally immutable
data.  In this case it's ok, but let's not create a duplicate
template_info, and add asserts to make sure it is changing in exactly
the way we expect.

gcc/cp/
* cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
* pt.c (lookup_template_class_1): Special-case alias template
template_info setting.

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.

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.

4 years agoaix: Support libsupc++ as a FAT library
David Edelsohn [Tue, 18 Aug 2020 00:19:38 +0000 (20:19 -0400)]
aix: Support libsupc++ as a FAT library

Build libstdc++++ static library libsupc++.a as a FAT 32/64 bit library.

libstdc++-v3/ChangeLog:

2020-08-18  David Edelsohn  <dje.gcc@gmail.com>
    Clement Chigot  <clement.chigot@atos.net>

* config/os/aix/t-aix: Add complementary mode object files to
libsupc++.a

4 years agoc++: Rewrite members for all deduction guides. [PR96199]
Jason Merrill [Fri, 14 Aug 2020 22:01:27 +0000 (18:01 -0400)]
c++: Rewrite members for all deduction guides. [PR96199]

After the last patch, it occurred to me that we could run into the
specialization issue with non-alias deduction guides as well, so this patch
extends the rewriting to C++17 mode.

Doing this revealed that we weren't properly pushing into class scope for
normalization.

gcc/cp/ChangeLog:

PR c++/96199
* pt.c (tsubst_aggr_type): Rewrite in C++17, too.
(maybe_dependent_member_ref): Likewise.
(build_deduction_guide): Re-substitute template parms.
* cp-tree.h (struct push_nested_class_guard): New.
* constraint.cc (get_normalized_constraints_from_decl): Use it.

gcc/testsuite/ChangeLog:

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

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 agoPR fortran/96613,96686 - Fix type/kind issues, temporaries evaluating MIN/MAX
Harald Anlauf [Tue, 18 Aug 2020 19:48:56 +0000 (21:48 +0200)]
PR fortran/96613,96686 - Fix type/kind issues, temporaries evaluating MIN/MAX

When evaluating functions of the MIN/MAX variety inline, use a temporary
of appropriate type and kind, and convert to the result type at the end.
In the case of allowing for the GNU extensions to MIN/MAX, derive the
result kind consistently during simplificaton.

Furthermore, the Fortran standard requires type and kind of arguments to
the MIN/MAX intrinsics to all have the same type and kind.  While a GNU
extension accepts kind differences for integer and real arguments which
seems to have been used in legacy code, there is no reason to allow
different character kinds.  We now reject the latter unconditionally.

gcc/fortran/ChangeLog:

* check.c (check_rest): Reject MIN/MAX character arguments of
different kind.
* simplify.c (min_max_choose): The simplification result shall
have the highest kind value of the arguments.
* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Choose type and
kind of intermediate by looking at all arguments, not the result.

gcc/testsuite/ChangeLog:

* gfortran.dg/minmax_char_3.f90: New test.
* gfortran.dg/min_max_kind.f90: New test.
* gfortran.dg/pr96613.f90: New test.

4 years agors6000: unaligned VSX in memcpy/memmove expansion
Aaron Sawdey [Sat, 8 Aug 2020 00:02:20 +0000 (19:02 -0500)]
rs6000: unaligned VSX in memcpy/memmove expansion

This patch adds a few new instructions to inline expansion of
memcpy/memmove. Generation of all these are controlled by
the option -mblock-ops-unaligned-vsx which is set on by default if the
target has TARGET_EFFICIENT_UNALIGNED_VSX.
 * unaligned vsx load/store (V2DImode)
 * unaligned vsx pair load/store (POImode) which is also controlled
   by -mblock-ops-vector-pair in case it is not wanted at some point.
   The default for -mblock-ops-vector-pair is for it to be on if the
   target has TARGET_MMA and TARGET_EFFICIENT_UNALIGNED_VSX. This is
   redundant, but nice for the future to clearly specify what is
   required.
 * unaligned vsx lxvl/stxvl but generally only to do the remainder
   of a copy/move we stated with some vsx loads/stores, and also prefer
   to use lb/lh/lw/ld if the remainder is 1/2/4/8 bytes.

Testing of this is actually accomplished by gcc.dg/memcmp-1.c which does
two memcpy() for each memcmp(). If the memcpy() calls don't do the right
thing then the memcmp() will fail unexpectedly.

gcc/ChangeLog:

* config/rs6000/rs6000-string.c (gen_lxvl_stxvl_move):
Helper function.
(expand_block_move): Add lxvl/stxvl, vector pair, and
unaligned VSX.
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Default value for -mblock-ops-vector-pair.
* config/rs6000/rs6000.opt: Add -mblock-ops-vector-pair.

4 years agoDecouple adjust_range_from_scev from vr_values and value_range_equiv.
Aldy Hernandez [Tue, 4 Aug 2020 10:31:23 +0000 (12:31 +0200)]
Decouple adjust_range_from_scev from vr_values and value_range_equiv.

gcc/ChangeLog:

* vr-values.c (check_for_binary_op_overflow): Change type of store
to range_query.
(vr_values::adjust_range_with_scev): Abstract most of the code...
(range_of_var_in_loop): ...here.  Remove value_range_equiv uses.
(simplify_using_ranges::simplify_using_ranges): Change type of store
to range_query.
* vr-values.h (class range_query): New.
(class simplify_using_ranges): Use range_query.
(class vr_values): Add OVERRIDE to get_value_range.
(range_of_var_in_loop): New.