Commit Graph

183986 Commits

Author SHA1 Message Date
Jakub Jelinek
0b86a64381 c++: Diagnose bare parameter packs in bitfield widths [PR99745]
The following invalid tests ICE because we don't diagnose (and drop) bare
parameter packs in bitfield widths.

2021-03-25  Jakub Jelinek  <jakub@redhat.com>

	PR c++/99745
	* decl2.c (grokbitfield): Diagnose bitfields containing bare parameter
	packs and don't set DECL_BIT_FIELD_REPRESENTATIVE in that case.

	* g++.dg/cpp0x/variadic181.C: New test.
2021-03-25 21:06:09 +01:00
Marek Polacek
9efd72d289 c++: -Wconversion vs value-dependent expressions [PR99331]
This PR complains that we issue a -Wconversion warning in

  template <int N> struct X {};
  template <class T> X<sizeof(T)> foo();

saying "conversion from 'long unsigned int' to 'int' may change value".
While it's not technically wrong, I suspect -Wconversion warnings aren't
all that useful for value-dependent expressions.  So this patch disables
them.  This is a regression that started with r241425:

@@ -7278,7 +7306,7 @@ convert_template_argument (tree parm,
          val = error_mark_node;
        }
    }
-      else if (!dependent_template_arg_p (orig_arg)
+      else if (!type_dependent_expression_p (orig_arg)
           && !uses_template_parms (t))
    /* We used to call digest_init here.  However, digest_init
       will report errors, which we don't want when complain

Here orig_arg is SIZEOF_EXPR<T>; dependent_template_arg_p (orig_arg) was
true, but type_dependent_expression_p (orig_arg) is false so we warn in
convert_nontype_argument.

gcc/cp/ChangeLog:

	PR c++/99331
	* call.c (build_converted_constant_expr_internal): Don't emit
	-Wconversion warnings.

gcc/testsuite/ChangeLog:

	PR c++/99331
	* g++.dg/warn/Wconversion5.C: New test.
2021-03-25 14:46:29 -04:00
Jonathan Wakely
15d649f79d libstdc++: Declare malloc for freestanding
For a target with none of aligned_alloc, memalign etc. we defined our
own aligned_alloc using malloc, so we need a declaration of malloc. As
in libsupc++/new_op.cc we need to declare it ourselves for freestanding
environments.

libstdc++-v3/ChangeLog:

	* libsupc++/new_opa.cc [!_GLIBCXX_HOSTED]: Declare malloc.
2021-03-25 18:25:40 +00:00
Jonathan Wakely
c7fc73ee45 libstdc++: Allow seeding random engines in testsuite
The testsuite utilities that use random numbers use a
default-constructed mersenne_twister_engine, meaning the values are
reproducable. This adds support for seeding them, controlledby an
environment variable. Defining GLIBCXX_SEED_TEST_RNG=val in the
environment will cause the engines to be seeded with atoi(val) if that
is non-zero, or with a value read from std::random_device otherwise.

Running with different seeds revealed some bugs in the tests, where a
randomly selected iterator was past-the-end (which can't be erased), or
where the randomly populated container was empty, and then we tried to
remove elements from it unconditionally.

libstdc++-v3/ChangeLog:

	* testsuite/util/exception/safety.h (setup_base::generate):
	Support seeding random engine.
	(erase_point, erase_range): Adjust range of random numbers to
	ensure dereferenceable iterators are used where required.
	(generation_prohibited::run): Do not try to erase from empty
	containers.
	* testsuite/util/testsuite_containergen.h (test_containers):
	Support seeding random engine.
2021-03-25 18:21:19 +00:00
Stam Markianos-Wright
aac12084fc tree-optimization/96974 - avoid ICE by replacing assert with standard failure
Minor patch to add a graceful exit in the rare case where an invalid
combination of TYPE_VECTOR_SUBPARTS for nunits_vectype and
*stmt_vectype_out is reached in vect_get_vector_types_for_stmt.

This resolves the ICE seen in PR tree-optimization/96974, however the issue
of correctly handling this rare vectorization combination is left for a
later patch.

Bootstrapped and reg-tested on aarch64-linux-gnu.

2021-03-25  Stam Markianos-Wright  <stam.markianos-wright@arm.com>

gcc/ChangeLog:

	PR tree-optimization/96974
	* tree-vect-stmts.c (vect_get_vector_types_for_stmt): Replace assert
	with graceful exit.

gcc/testsuite/ChangeLog:

	PR tree-optimization/96974
	* g++.target/aarch64/sve/pr96974.C: New test.
2021-03-25 15:29:41 +00:00
H.J. Lu
de00a7bda9 Revert "x86: Skip ISA check for always_inline in system headers"
This reverts commit 72982851d7.
2021-03-25 06:57:37 -07:00
Thomas Schwinge
7c1e856bed libgomp HSA/GCN plugins: don't prepend the 'HSA_RUNTIME_LIB' path to 'libhsa-runtime64.so'
For unknown reasons, this had gotten added for the libgomp HSA plugin in commit
b8d89b03db (r242749) "Remove build dependence on
HSA run-time", and later propagated into the GCN plugin.

	libgomp/
	* plugin/plugin-gcn.c (init_environment_variables): Don't prepend
	the 'HSA_RUNTIME_LIB' path to 'libhsa-runtime64.so'.
	* plugin/configfrag.ac (HSA_RUNTIME_LIB): Clean up.
	* config.h.in: Regenerate.
	* configure: Likewise.
2021-03-25 14:11:50 +01:00
Kewen Lin
068d02e896 vect: Init inside_cost in vect_model_reduction_cost
This patch is to initialize the inside_cost as zero, can avoid
to use its uninitialized value when some path doesn't assign it.

gcc/ChangeLog:

	* tree-vect-loop.c (vect_model_reduction_cost): Init inside_cost.
2021-03-25 07:58:24 -05:00
Jakub Jelinek
660eb7e9de c-family: Fix up -Wduplicated-branches for union members [PR99565]
Honza has fairly recently changed operand_equal_p to compare
DECL_FIELD_OFFSET for COMPONENT_REFs when comparing addresses.
As the first testcase in this patch shows, while that is very nice
for optimizations, for the -Wduplicated-branches warning it causes
regressions.  Pedantically a union in both C and C++ has only one
active member at a time, so using some other union member even if it has the
same type is UB, so I think the warning shouldn't warn when it sees access
to different fields that happen to have the same offset and should consider
them different.
In my first attempt to fix this I've keyed the old behavior on
OEP_LEXICOGRAPHIC, but unfortunately that has various problems, the warning
has a quick non-lexicographic compare in build_conditional_expr* and another
lexicographic more expensive one later during genericization and turning the
first one into lexicographic would mean wasting compile time on large
conditionals.
So, this patch instead introduces a new OEP_ flag and makes sure to pass it
to operand_equal_p in all -Wduplicated-branches cases.

The cvt.c changes are because on the other testcase we were warning with
UNKNOWN_LOCATION, so the user wouldn't really know where the questionable
code is.

2021-03-25  Jakub Jelinek  <jakub@redhat.com>

	PR c++/99565
	* tree-core.h (enum operand_equal_flag): Add OEP_ADDRESS_OF_SAME_FIELD.
	* fold-const.c (operand_compare::operand_equal_p): Don't compare
	field offsets if OEP_ADDRESS_OF_SAME_FIELD.

	* c-warn.c (do_warn_duplicated_branches): Pass also
	OEP_ADDRESS_OF_SAME_FIELD to operand_equal_p.

	* c-typeck.c (build_conditional_expr): Pass OEP_ADDRESS_OF_SAME_FIELD
	to operand_equal_p.

	* call.c (build_conditional_expr_1): Pass OEP_ADDRESS_OF_SAME_FIELD
	to operand_equal_p.
	* cvt.c (convert_to_void): Preserve location_t on COND_EXPR or
	or COMPOUND_EXPR.

	* g++.dg/warn/Wduplicated-branches6.C: New test.
	* g++.dg/warn/Wduplicated-branches7.C: New test.
2021-03-25 13:41:55 +01:00
H.J. Lu
72982851d7 x86: Skip ISA check for always_inline in system headers
For always_inline in system headers, we don't know if caller's ISAs are
compatible with callee's ISAs until much later.  Skip ISA check for
always_inline in system headers if caller has target attribute.

gcc/

	PR target/98209
	PR target/99744
	* config/i386/i386.c (ix86_can_inline_p): Don't check ISA for
	always_inline in system headers.

gcc/testsuite/

	PR target/98209
	PR target/99744
	* gcc.target/i386/pr98209.c: New test.
	* gcc.target/i386/pr99744-1.c: Likewise.
	* gcc.target/i386/pr99744-2.c: Likewise.
2021-03-25 05:30:07 -07:00
Thomas Schwinge
d99111fd8e Avoid OpenMP/nvptx execution-time hangs for simple nested OpenMP 'target'/'parallel'/'task' constructs [PR99555]
... awaiting proper resolution, of course.

	libgomp/
	PR target/99555
	* testsuite/lib/on_device_arch.c: New file.
	* testsuite/libgomp.c/pr99555-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/task-detach-6.c: Until resolved,
	skip for nvptx offloading, with error status.
	* testsuite/libgomp.fortran/task-detach-6.f90: Likewise.
2021-03-25 13:00:11 +01:00
Thomas Schwinge
8bafce1be1 'libgomp.oacc-fortran/derivedtypes-arrays-1.f90' OpenACC 'serial' construct diagnostic for nvptx offloading
Fixup for recent commit d28f3da11d "openacc: Fix
lowering for derived-type mappings through array elements".  With nvptx
offloading we see the usual:

    [...]/libgomp.oacc-fortran/derivedtypes-arrays-1.f90: In function 'MAIN__._omp_fn.0':
    [...]/libgomp.oacc-fortran/derivedtypes-arrays-1.f90:90:40: warning: using vector_length (32), ignoring 1

	libgomp/
	* testsuite/libgomp.oacc-fortran/derivedtypes-arrays-1.f90:
	OpenACC 'serial' construct diagnostic for nvptx offloading.
2021-03-25 12:49:44 +01:00
Richard Biener
a29124d282 tree-optimization/99746 - avoid confusing hybrid code
This avoids confusing the hybrid vectorization code with SLP
patterns by not marking SLP pattern covered stmts as patterns
(they are marked as SLP patterns already).  This means that loop
vectorization will vectorize the scalar stmt rather than the SLP
pattern stmt (which it can't anyway).

2021-03-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99746
	* tree-vect-slp-patterns.c (complex_pattern::build): Do not mark
	the scalar stmt as patterned.  Instead set up required things
	manually.

	* gfortran.dg/vect/pr99746.f90: New testcase.
2021-03-25 09:07:34 +01:00
Xionghu Luo
08103e4d6a rs6000: Correct Power8 cost of l2 cache size [PR97329]
l2 cache size for Power8 is 512kB, it was copied from Power7 before
public.  Tested no performance change for SPEC2017.

gcc/ChangeLog:

2021-03-24  Xionghu Luo  <luoxhu@linux.ibm.com>

	* config/rs6000/rs6000.c (power8_costs): Change l2 cache
	from 256 to 512.
2021-03-24 19:51:43 -05:00
David Malcolm
71fc4655ab analyzer; reset sm-state for SSA names at def-stmts [PR93695,PR99044,PR99716]
Various false positives from -fanalyzer involve SSA names in loops,
where sm-state associated with an SSA name from one iteration is
erroneously reused in a subsequent iteration.

For example, PR analyzer/99716 describes a false
  "double 'fclose' of FILE 'fp'"
on:

  for (i = 0; i < 2; ++i) {
    FILE *fp = fopen ("/tmp/test", "w");
    fprintf (fp, "hello");
    fclose (fp);
  }

where the gimple of the loop body is:

  fp_7 = fopen ("/tmp/test", "w");
  __builtin_fwrite ("hello", 1, 5, fp_7);
  fclose (fp_7);
  i_10 = i_1 + 1;

where fp_7 transitions to "closed" at the fclose, but is not
reset at the subsequent fopen, leading to the false positive
when the fclose is re-reached.

The fix is to reset sm-state for svalues that involve an SSA name
at the SSA name's def-stmt, since the def-stmt effectively changes
the meaning of those related svalues.

gcc/analyzer/ChangeLog:
	PR analyzer/93695
	PR analyzer/99044
	PR analyzer/99716
	* engine.cc (exploded_node::on_stmt): Clear sm-state involving
	an SSA name at the def-stmt of that SSA name.
	* program-state.cc (sm_state_map::purge_state_involving): New.
	* program-state.h (sm_state_map::purge_state_involving): New decl.
	* region-model.cc (selftest::test_involves_p): New.
	(selftest::analyzer_region_model_cc_tests): Call it.
	* svalue.cc (class involvement_visitor): New class
	(svalue::involves_p): New.
	* svalue.h (svalue::involves_p): New decl.

gcc/testsuite/ChangeLog:
	PR analyzer/93695
	PR analyzer/99044
	PR analyzer/99716
	* gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c: Remove
	xfail.
	* gcc.dg/analyzer/pr93695-1.c: New test.
	* gcc.dg/analyzer/pr99044-1.c: New test.
	* gcc.dg/analyzer/pr99044-2.c: New test.
	* gcc.dg/analyzer/pr99716-1.c: New test.
	* gcc.dg/analyzer/pr99716-2.c: New test.
	* gcc.dg/analyzer/pr99716-3.c: New test.
2021-03-24 20:47:57 -04:00
GCC Administrator
8bf52ffa92 Daily bump. 2021-03-25 00:16:48 +00:00
Martin Liska
4f00c4d40a i386: fix -march=amd crash
It started with g:3e2ae3ee285a57455d5a23bd352a68c289130186 where
new entry was added to processor_alias_table after generic node:

+  {"amdfam19h", PROCESSOR_GENERIC, CPU_GENERIC, 0,
+    M_CPU_TYPE (AMDFAM19H), P_NONE},

and then the following is violated:

/* NB: processor_alias_table stops at the "generic" entry.  */

gcc/ChangeLog:

	PR target/99753
	* common/config/i386/i386-common.c (ARRAY_SIZE): Fix off-by-one
	error.
	* config/i386/i386-options.c (ix86_option_override_internal):
	Add run-time assert.

gcc/testsuite/ChangeLog:

	PR target/99753
	* gcc.target/i386/pr99753.c: New test.
2021-03-24 20:45:26 +01:00
Martin Jambor
f225c6b0c5 ipa: Check that scalar types that IPA-CP comes up with are sane (PR99122)
This patch fixes the last bit of PR 99122 where various bits of IPA
infrastructure are presented with a program with type mismatches that
make it have undefined behavior, and when inlining or performing
IPA-CP, and encountering such mismatch, we basically try to
VIEW_CONVERT_EXPR whatever the caller has into whatever the callee has
or simply use an empty constructor if that cannot be done.  This
however does not work when the callee has VLA parameters because we
ICE in the process.

Richi has already disabled inlining for such cases, this patch avoids
the issue in IPA-CP.  It adds checks that whatever constant the
propagation arrived at is actually compatible or fold_convertible to
the callees formal parameer type.  Unlike in the past, we now have
types of all parameters of functions that we have analyzed, even with
LTO, and so can do it.

This should prevent only bogus propagations.  I have looked at the
effect of the patch on WPA of Firefox and did not have any.

I have bootstrapped and LTO bootstrapped and tested the patch on
x86_64-linux.  OK for trunk?  And perhaps later for GCC 10 too?

Thanks

gcc/ChangeLog:

2021-02-26  Martin Jambor  <mjambor@suse.cz>

	PR ipa/99122
	* ipa-cp.c (initialize_node_lattices): Mark as bottom all
	parameters with unknown type.
	(ipacp_value_safe_for_type): New function.
	(propagate_vals_across_arith_jfunc): Verify that the constant type
	can be used for a type of the formal parameter.
	(propagate_vals_across_ancestor): Likewise.
	(propagate_scalar_across_jump_function): Likewise.  Pass the type
	also to propagate_vals_across_ancestor.

gcc/testsuite/ChangeLog:

2021-02-26  Martin Jambor  <mjambor@suse.cz>

	PR ipa/99122
	* gcc.dg/pr99122-3.c: Remove -fno-ipa-cp from options.
2021-03-24 20:27:27 +01:00
Christophe Lyon
79cdbabbc4 arm: Fix MVE constraints for movmisalign [PR target/99727]
MVE has different constraints than Neon for load/store: we should use
the Ux constraint instead of Um.

2021-03-24  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/99727
	gcc/
	* config/arm/mve.md (movmisalign<mode>_mve_store): Use Ux
	constraint.
	(movmisalign<mode>_mve_load): Likewise.

	gcc/testsuite/
	* gcc.target/arm/pr99727.c: New test.
2021-03-24 14:22:48 +00:00
Matthias Klose
70b738f968 Fix installation of the jit header files
gcc/jit/

2021-03-24  Matthias Klose  <doko@ubuntu.com>

	* Make-lang.in (jit.sphinx.html, jit.sphinx.pdf): Use $(mkinstalldirs),
	(jit.install-headers): Depend on installdirs.
2021-03-24 12:28:21 +00:00
Jakub Jelinek
4f992de4f3 arm: Fix some more vec-common.md patterns for iwmmxt [PR99724]
The following patch fixes similar issues as in PR98849;
in older gcc versions, the expanders were present in neon.md guarded
with TARGET_NEON, but they got moved to vec-common.md and guarded with
ARM_HAVE_<MODE>_ARITH so that they handle both MVE and Neon.
The macros are enabled for some modes even for iwmmxt which has some
vector support for those modes, but only limited.  In particular,
neither the one_cmpl, nor neg, nor movmisalign patterns are present.
For some reason I've failed to construct something that ICEs with
movmisalign, so that is not covered by the testsuite, but both
one_cmpl and neg ICE.

2021-03-24  Jakub Jelinek  <jakub@redhat.com>

	PR target/99724
	* config/arm/vec-common.md (one_cmpl<mode>2, neg<mode>2,
	movmisalign<mode>): Disable expanders for TARGET_REALLY_IWMMXT.

	* gcc.target/arm/pr99724.c: New test.
2021-03-24 11:22:35 +01:00
Alexandre Oliva
65cfa2fed3 run sysconf-requiring test on systems that support it
Some gcc.target/i386 tests requires the mmap feature, but that's not
enough for the test to be able to call sysconf.

This patch introduces a sysconf feature, analogous to mmap, and adds
it to tests in gcc.target/i386 that call sysconf.

There are other tests within gcc.dg and g++.dg that call sysconf, but
I haven't added the tag to them, because they already cover it with
target triplets.  I was a little nervous about dropping the triplets,
and saw how they implied sysconf, so I left those alone.


for  gcc/ChangeLog

	* doc/sourcebuild.texi (sysconf): New effective target.

for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp (check_effective_target_sysconf): New.
	* gcc.target/i386/pr95443-1.c: Require it.
	* gcc.target/i386/pr95443-2.c: Likewise.
	* gcc.target/i386/sse2-mmx-maskmovq.c: Likewise.
	* gcc.target/i386/strncmp-1.c: Likewise.
2021-03-24 06:48:23 -03:00
Alexandre Oliva
9eec7c7686 require et feature pie for PIE tests
Both of these tests fail on platforms that reject -fPIC/-fPIE
altogether.

Other tests that perform PIE compilation or linking require the pie
feature, whether for -fpie/-fPIE compilation or for -pie linking.

This patch annotates both tests with the required target feature.


for  gcc/testsuite/ChangeLog

	* gcc.target/i386/pr97313.c: Require effective target feature pie.
	* g++.target/i386/pr94185.C: Likewise.
2021-03-24 05:48:33 -03:00
Alexandre Oliva
d42ab6885a tighten funcspec regexps
In -mcmodel=large, callee symbols are pulled ahead of the call insns.

The patterns in funcspec-[12].c tests in gcc.target/i386 match even
line breaks between 'call' and a function symbol expected to be
called, however, so it ends up unexpectedly matching a previous,
unrelated indirect call, up to the insn that loads the address of the
intended callee to a register, for all but the first callee, that
doesn't have a call insn before it.

All of these apparent passes are false positives.  We are NOT
generating the expected call insns.

This patch fixes only the patterns, so that they won't trigger false
positives any more.  There are several dozens of other tests that fail
with -mcmodel=large for similar reasons, but I'm still not sure about
how to deal with them.  I see no point in holding up this small
improvement over the lack of a larger solution of a different problem,
though.


for  gcc/testsuite/ChangeLog

	* gcc.target/i386/funcspec-2.c: Tighten regexps to avoid false
	positives with -mcmodel=large.
	* gcc.target/i386/funcspec-3.c: Likewise.
2021-03-24 05:44:36 -03:00
Alexandre Oliva
4be312862d fix ssse3_pshufbv8qi3 post-reload const pool load
The split in ssse3_pshufbv8qi3 forces a const vector into the constant
pool, and loads from it.  That runs after reload, so if the load
requires any reloading, we're out of luck.  Indeed, if the load
address is not legitimate, e.g. -mcmodel=large, the insn is no longer
recognized.

This patch turns the constant into an input operand, introduces an
expander to generate the constant unconditionally, and arranges for
this input operand to be retained as an unused immediate in the
alternatives that don't undergo splitting, and for it to be loaded
into the scratch register for those that do.

It is now the register allocator that arranges to load the const
vector into a register, so it deals with whatever legitimizing steps
needed for the target configuration.


for  gcc/ChangeLog

	* config/i386/predicates.md (reg_or_const_vec_operand): New.
	* config/i386/sse.md (ssse3_pshufbv8qi3): Add an expander for
	the now *-prefixed insn_and_split, turn the splitter const vec
	into an input for the insn, making it an ignored immediate for
	non-split cases, and loaded into the scratch register
	otherwise.

for  gcc/testsuite/ChangeLog

	* gcc.target/i386/pr94467-3.c: New.
2021-03-24 05:44:35 -03:00
Tobias Burnus
b179026a5d Fortran: Extend buffer, use snprintf to avoid overflows [PR99369]
gcc/fortran/ChangeLog:

	PR fortran/99369
	* resolve.c (resolve_operator): Make 'msg' buffer larger
	and use snprintf.

gcc/testsuite/ChangeLog:

	PR fortran/99369
	* gfortran.dg/longnames.f90: New test.
2021-03-24 07:50:22 +01:00
GCC Administrator
bf1f3168f4 Daily bump. 2021-03-24 00:16:25 +00:00
Vladimir N. Makarov
be70bb5e4b [PR99581] Use relaxed memory for more aarch64 memory constraints
The original patch for PR99581 resulted in GCC testsuite regression as
some constraints were not declared as relaxed memory ones.  This patch
fixes this.

gcc/ChangeLog:

	PR target/99581
	* config/aarch64/constraints.md (Utq, UOb, UOh, UOw, UOd, UOty):
	Use define_relaxed_memory_constraint for them.
2021-03-23 17:58:57 -04:00
Joseph Myers
e5c2ac584a Update gcc .po files.
* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
	ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
	zh_TW.po: Update.
2021-03-23 20:50:53 +00:00
Iain Sandoe
7af8ec508f Darwin : Address a translation comment.
Add a ':' to make the diagnostic read 'pch_address_space': xxx.

gcc/ChangeLog:

	PR target/99733
	* config/host-darwin.c (darwin_gt_pch_use_address): Add a
	colon to the diagnostic message.
2021-03-23 19:42:36 +00:00
Nathan Sidwell
bd71889b90 c++: Note duplicates in symbol table [PR 99283]
I ran into this reducing 99283, we were failing to mark binding
vectors when the current TU declares a duplicate decl (as opposed to
an import introduces a duplicate).

	PR c++/99283
	gcc/cp/
	* name-lookup.c (check_module_override): Set global or partition
	DUP on the binding vector.
	gcc/testsuite/
	* g++.dg/modules/pr99283-1_a.H: New.
	* g++.dg/modules/pr99283-1_b.H: New.
2021-03-23 12:29:14 -07:00
Ilya Leoshkevich
b61461ac7f fwprop: Fix single_use_p calculation
Commit efb6bc55a9 ("fwprop: Allow (subreg (mem)) simplifications")
introduced a check that was supposed to look at the propagated def's
number of uses.  It uses insn_info::num_uses (), which in reality
returns the number of uses def's insn has.  The whole change therefore
works only by accident.

Fix by looking at set_info's uses instead of insn_info's uses.  This
requires passing around set_info instead of insn_info.

gcc/ChangeLog:

2021-03-02  Ilya Leoshkevich  <iii@linux.ibm.com>

	* fwprop.c (fwprop_propagation::fwprop_propagation): Look at
	set_info's uses.
	(try_fwprop_subst_note): Use set_info instead of insn_info.
	(try_fwprop_subst_pattern): Likewise.
	(try_fwprop_subst_notes): Likewise.
	(try_fwprop_subst): Likewise.
	(forward_propagate_subreg): Likewise.
	(forward_propagate_and_simplify): Likewise.
	(forward_propagate_into): Likewise.
	* rtl-ssa/accesses.h (set_info::single_nondebug_use) New
	method.
	(set_info::single_nondebug_insn_use): Likewise.
	(set_info::single_phi_use): Likewise.
	* rtl-ssa/member-fns.inl (set_info::single_nondebug_use) New
	method.
	(set_info::single_nondebug_insn_use): Likewise.
	(set_info::single_phi_use): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/vector/long-double-asm-abi.c: New test.
2021-03-23 19:44:22 +01:00
Jonathan Wakely
d1aa5f57db libstdc++: Improve test for views::reverse
libstdc++-v3/ChangeLog:

	* testsuite/std/ranges/adaptors/reverse.cc: Replace duplicated
	line with a check that uses the const being/end overloads.
2021-03-23 18:24:39 +00:00
David Malcolm
1959955104 MAINTAINERS: add myself as static analyzer maintainer
ChangeLog:
	* MAINTAINERS: Add myself as static analyzer maintainer.
2021-03-23 13:09:07 -04:00
Moritz Sichert
09f08fef71 libstdc++: Avoid accidental ADL when calling make_reverse_iterator
std::ranges::reverse_view uses make_reverse_iterator in its
implementation as described in [range.reverse.view]. This accidentally
allows ADL as an unqualified name is used in the call. According to
[contents], however, this should be treated as a qualified lookup into
the std namespace.

This leads to errors due to ambiguous name lookups when another
make_reverse_iterator function is found via ADL.

libstdc++-v3/Changelog:

	* include/std/ranges (reverse_view::begin, reverse_view::end):
	Qualify make_reverse_iterator calls to avoid ADL.
	* testsuite/std/ranges/adaptors/reverse.cc: Test that
	views::reverse works when make_reverse_iterator is defined
	in an associated namespace.
2021-03-23 16:34:42 +00:00
Jakub Jelinek
6b1f841ce0 Add forgotten attribution on PR target/99593 testcase. 2021-03-23 16:29:47 +01:00
Christophe Lyon
3c3c004273 testsuite/arm: Add arm_dsp_ok effective target and use it in arm/acle/dsp_arith.c
gcc.target/arm/acle/dsp_arith.c uses DSP intrinsics, which arm_acle.h
defines only with __ARM_FEATURE_DSP, so make the test check for that
property rather than arm_qbit_ok.

However, the existing arm_dsp effective target only checks if DSP
features are supported with the current multilib rather than trying
-march and -mfloat-abi options. Thus we introduce a similar effective
target, arm_dsp_ok and associated dg-add-options.

This makes dsp_arith.c unsupported rather than failed when no option
combination is suitable, for instance when running the tests with
-mcpu=cortex-m3.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* doc/sourcebuild.texi (arm_dsp_ok, arm_dsp): Document.

	gcc/testsuite/
	* lib/target-supports.exp
	(check_effective_target_arm_dsp_ok_nocache)
	(check_effective_target_arm_dsp_ok, add_options_for_arm_dsp): New.
	* gcc.target/arm/acle/dsp_arith.c: Use arm_dsp_ok effective target
	and add arm_dsp options.
2021-03-23 15:11:52 +00:00
Christophe Lyon
165bc67beb testsuite/arm: Fix -mfloat-abi order in arm_v8_1m_mve_ok_nocache and arm_v8_1m_mve_fp_ok_nocache
Make the order in which we try -mfloat-abi options consistent with the
other similar effective targets: try softfp first, then hard.

This shows that a few tests implicitly rely on -mfloat-abi=hard, so we
add this option via dg-additional-options so that it comes after any
potential -mfloat-abi option that the preceding effective-targets
might have added.

armv8_1m-fpXX-move-1.c tests don't need arm_hard_ok because they don't
include arm_mve.h: adding -mfloat-abi=hard when using a soft/softfp
toolchain does not lead to the missing include gnu/stubs-*.h error.

This patch makes armv8_1m-fpXX-move-1.c pass on arm-linux-gnueabi, and
the other tests become unsupported (instead of fail) on this target.

On arm-eabi with default cpu/fpu/mode and a+rm multilibs, the same
mve/intrinsics/* tests become unsupported instead of pass because
arm_hard_ok fails with "selected processor lacks an FPU". Since we
also override the fpu via dg-options, we'd need another effective
target (say arm_hard_mve_ok) that would check -mfloat-abi=hard
-mfpu=auto -march=armv8.1-m.main+mve.fp at the same time. But we have
already so many arm effective targets, it doesn't seem like a good way
forward.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* lib/target-supports.exp
	(check_effective_target_arm_v8_1m_mve_fp_ok_nocache): Fix
	-mfloat-abi= options order.
	(check_effective_target_arm_v8_1m_mve_ok_nocache): Likewise
	* gcc.target/arm/mve/intrinsics/mve_vector_float2.c: Add
	arm_hard_ok effective target and -mfloat-abi=hard additional
	option.
	* gcc.target/arm/mve/intrinsics/mve_vector_int.c: Likewise.
	* gcc.target/arm/mve/intrinsics/mve_vector_uint.c: Likewise.
	* gcc.target/arm/mve/intrinsics/mve_vector_uint1.c: Likewise.
	* gcc.target/arm/mve/intrinsics/mve_vector_uint2.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c: Likewise.
	* gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c: Likewise.
	* gcc.target/arm/armv8_1m-fp16-move-1.c: Add -mfloat-abi=hard
	additional option.
	* gcc.target/arm/armv8_1m-fp32-move-1.c: Likewise.
	* gcc.target/arm/armv8_1m-fp64-move-1.c: Likewise.
2021-03-23 15:11:51 +00:00
Christophe Lyon
bed1736f3a testsuite/arm: Fix -mfloat-abi order in arm_v8_2a_bf16_neon_ok_nocache and arm_v8_2a_i8mm_ok_nocache
Make the order in which we try -mfloat-abi options consistent with the
other similar effective targets: try softfp first, then hard.

This shows that a few tests implicitly rely on -mfloat-abi=hard, so we
now check arm_hard_ok where needed.

This makes these tests unsupported rather than fail on
arm-linux-gnueabi.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* lib/target-supports.exp
	(check_effective_target_arm_v8_2a_i8mm_ok_nocache): Fix
	-mfloat-abi= options order.
	(check_effective_target_arm_v8_2a_bf16_neon_ok_nocache): Likewise.
	* gcc.target/arm/bfloat16_scalar_1_1.c: Add arm_hard_ok effective
	target and -mfloat-abi=hard additional option.
	* gcc.target/arm/bfloat16_simd_1_1.c: Likewise.
	* gcc.target/arm/simd/bf16_ma_1.c: Likewise.
	* gcc.target/arm/simd/bf16_mmla_1.c: Likewise.
	* gcc.target/arm/simd/vdot-2-1.c: Likewise.
	* gcc.target/arm/simd/vdot-2-2.c: Likewise.
2021-03-23 15:11:50 +00:00
Christophe Lyon
1843341b12 testsuite/arm: Add arm_hard_ok check in armv8_2-fp16-scalar-2.c
This test relies on -mfloat-abi=hard to pass (otherwise
test_mov_imm_[12] directly build the 1.0 fp16 representation via movw
r0, #15360 rather than using vmov.f16 s0, #1.0e+0 as expected by
scan-assembler-times)

Adding the arm_hard_ok check makes the test unsupported eg. on
arm-linux-gnueabi instead of reporting a failure.

2021-03-20  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/armv8_2-fp16-scalar-2.c: Add arm_hard_ok.
2021-03-23 15:11:49 +00:00
Christophe Lyon
fcfad74515 testsuite/arm: Add arm_softfp_ok or arm_hard_ok as needed.
Several tests override the -mfloat-abi option detected by their
effective targets. Make sure it is supported, so that these tests are
unsupported rather than failures (the inclusion of arm_neon.h
otherwise fails for lack of gnu/stubs-*.h)

This avoids failures with
bfloat16_simd_2_1.c
bfloat16_simd_3_1.c
bf16_vldn_1.c
bf16_vstn_1.c on arm-linux-gnueabi
and
pr51968.c
bfloat16_simd_1_2.c
bfloat16_simd_2_2.c
bfloat16_simd_3_2.c on arm-linux-gnueabihf.

On arm-eabi with default cpu/fpu/mode and a+rm multilibs,
bfloat16_simd_2_1.c, bfloat16_simd_3_1.c, bf16_vstn_1.c and
bf16_vldn_1.c become unsupported instead of pass because arm_hard_ok
fails with "selected processor lacks an FPU". Since we also override
the fpu in dg-additional-options, we'd need another effective target
(say arm_hard_neon_ok) that would check -mfloat-abi=hard -mfpu=neon at
the same time. But we have already so many arm effective targets, it
doesn't seem like a good way forward.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/bfloat16_simd_1_2.c: Add arm_softfp_ok.
	* gcc.target/arm/bfloat16_simd_2_2.c: Likewise.
	* gcc.target/arm/bfloat16_simd_3_2.c: Likewise.
	* gcc.target/arm/pr51968.c: Likewise.
	* gcc.target/arm/bfloat16_simd_2_1.c: arm_hard_ok.
	* gcc.target/arm/bfloat16_simd_3_1.c: Likewise.
	* gcc.target/arm/simd/bf16_vldn_1.c: Likewise.
	* gcc.target/arm/simd/bf16_vstn_1.c: Likewise.
2021-03-23 15:11:48 +00:00
Christophe Lyon
451c51e8ed testsuite/arm: Remove useless -mfloat-abi option
These tests pass with their current dg-add-options, no need to force
-mfloat=abi.

I've noticed no impact on armv8_1m-shift-imm-1.c and
armv8_1m-shift-reg-1.c, bf16_reinterpret.c now passes on
arm-linux-gnueabi and bf16_dup.c now passes on arm-linux-gnueabihf.

This allows pr51534.c to pass when forcing -mfloat-abi=soft in
runtestflags, otherwise we get an error '-mfloat-abi=soft and
-mfloat-abi=hard may not be used together' because we try to compile
with both flags.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/armv8_1m-shift-imm-1.c: Remove -mfloat=abi option.
	* gcc.target/arm/armv8_1m-shift-reg-1.c: Likewise.
	* gcc.target/arm/bf16_dup.c: Likewise.
	* gcc.target/arm/bf16_reinterpret.c: Likewise.
	* gcc.target/arm/pr51534.c: Remove -mfloat=abi option.
2021-03-23 15:11:48 +00:00
Christophe Lyon
aa706c4636 testsuite/arm: Add arm_v8_2a_i8mm options in gcc.target/arm/simd/vmmla_1.c
We need to add the options corresponding to the arm_v8_2a_i8mm_ok
effective target in order to use the right float-abi option:
-mfloat-abi=softfp makes the test pass for arm-linux-gnueabi,
while no -mfloat-abi option is needed for arm-linux-gnueabihf.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/simd/vmmla_1.c: Add arm_v8_2a_i8mm options.
2021-03-23 15:11:46 +00:00
Christophe Lyon
3c0351f287 testsuite/arm: Add arm_v8_2a_fp16_neon and arm_v8_2a_bf16_neon options
A few tests lack the dg-add-options directives associated with the
dg-require-effective-target they are using. Adding them enables to
pass the right float-abi option, and thus make the tests pass instead
of emit an error.

For instance, we now pass -mfloat-abi=softfp on arm-linux-gnueabi
targets and the tests pass.

2021-03-19  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/bfloat16_scalar_typecheck.c: Add
	arm_v8_2a_fp16_neon and arm_v8_2a_bf16_neon.
	* gcc.target/arm/bfloat16_vector_typecheck_1.c: Likewise.
	* gcc.target/arm/bfloat16_vector_typecheck_2.c: Likewise.
2021-03-23 15:11:45 +00:00
Jonathan Wakely
baef0cffb5 libstdc++: Disable "ALT128" long double support for Clang
Clang does not currently support the __ibm128 type [1] and only supports
the __ieee128 type in the unreleased 12.0.0 version [2]. That means it
is not possible to provide support for -mabi=ieeelongdouble with Clang
in an ABI compatible way (as we do for GCC by defining new facets and
other types in the __gnu_cxx_ldbl128 namespace).

By preventing the definition of _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT when
compiling with Clang, all uses of __ibm128 and __ieee128 types will be
disabled. This can be revisited in future when Clang supports the types
(and provides a way to detect that support using the preprocessor).

[1] https://reviews.llvm.org/D93377
[2] https://reviews.llvm.org/D97846

libstdc++-v3/ChangeLog:

	* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT):
	Do not define when compiling with Clang.
2021-03-23 15:00:43 +00:00
Marek Polacek
831f9f768e c++: Fix bogus warning in deprecated namespace [PR99318]
In GCC 10, I introduced cp_warn_deprecated_use_scopes so that we can
handle attribute deprecated on a namespace declaration.  This
function walks the decl's contexts so that we warn for code like

  namespace [[deprecated]] N { struct S { }; }
  N::S s;

We call cp_warn_deprecated_use_scopes when we encounter a TYPE_DECL.
But in the following testcase we have a TYPE_DECL whose context is
a deprecated function; that itself is not a reason to warn.  This
patch limits for which entities we call cp_warn_deprecated_use;
essentially it's what can follow ::.

I noticed that we didn't test that

  struct [[deprecated]] S { static void fn(); };
  S::fn();

produces the expected warning, so I've added gen-attrs-73.C.

gcc/cp/ChangeLog:

	PR c++/99318
	* decl2.c (cp_warn_deprecated_use_scopes): Only call
	cp_warn_deprecated_use when decl is a namespace, class, or enum.

gcc/testsuite/ChangeLog:

	PR c++/99318
	* g++.dg/cpp0x/attributes-namespace6.C: New test.
	* g++.dg/cpp0x/gen-attrs-73.C: New test.
2021-03-23 10:54:27 -04:00
Tobias Burnus
212f4988f3 Fortran: Fix func decl mismatch [PR93660]
gcc/fortran/ChangeLog:

	PR fortran/93660
	* trans-decl.c (build_function_decl): Add comment;
	increment hidden_typelist for caf_token/caf_offset.
	* trans-types.c (gfc_get_function_type): Add comment;
	add missing caf_token/caf_offset args.

gcc/testsuite/ChangeLog:

	PR fortran/93660
	* gfortran.dg/gomp/declare-simd-coarray-lib.f90: New test.
2021-03-23 15:45:36 +01:00
Richard Sandiford
d7cea7ceff aarch64: Make aarch64_add_offset work with -ftrapv [PR99540]
aarch64_add_offset uses expand_mult to multiply the SVE VL by an
out-of-range constant.  expand_mult takes an argument to indicate
whether the multiplication is signed or unsigned, but in this
context the multiplication is effectively signless and so the
choice seemed arbitrary.

However, one of the things that the signedness input does is
indicate whether signed overflow should be trapped for -ftrapv.
We don't want that here, so we must treat the multiplication
as unsigned.

gcc/
2021-03-23  Jakub Jelinek  <jakub@redhat.com>

	PR target/99540
	* config/aarch64/aarch64.c (aarch64_add_offset): Tell
	expand_mult to perform an unsigned rather than a signed
	multiplication.

gcc/testsuite/
2021-03-23  Richard Sandiford  <richard.sandiford@arm.com>

	PR target/99540
	* gcc.dg/vect/pr99540.c: New test.
2021-03-23 14:02:03 +00:00
H.J. Lu
9c89c9e9c6 x86: Add __volatile__ to __cpuid and __cpuid_count
Since CPUID instruction may return different values on hybrid core.
volatile is needed on asm statements in <cpuid.h>.

	PR target/99704
	* config/i386/cpuid.h (__cpuid): Add __volatile__.
	(__cpuid_count): Likewise.
2021-03-23 05:25:45 -07:00
Nathan Sidwell
6acd6692f1 c++: Over-zealous assert [PR 99239]
This was simply an overzealous assert.  Possibly correct thinking at
the time that code was written, but not true now.  Of course we can
have imported artificial decls.

	PR c++/99239
	gcc/cp/
	* decl.c (duplicate_decls): Remove assert about maybe-imported
	artificial decls.
	gcc/testsuite/
	* g++.dg/modules/pr99239_a.H: New.
	* g++.dg/modules/pr99239_b.H: New.
2021-03-23 05:21:13 -07:00