Commit Graph

183995 Commits

Author SHA1 Message Date
Tobias Burnus
9d45e848d0 Fortran: Fix intrinsic null() handling [PR99651]
gcc/fortran/ChangeLog:

	PR fortran/99651
	* intrinsic.c (gfc_intrinsic_func_interface): Set
	attr.proc = PROC_INTRINSIC if FL_PROCEDURE.

gcc/testsuite/ChangeLog:

	PR fortran/99651
	* gfortran.dg/null_11.f90: New test.
2021-03-26 08:39:24 +01:00
GCC Administrator
4493b1c1ad Daily bump. 2021-03-26 00:16:25 +00:00
Martin Sebor
e88ca9f423 PR tree-optimization/55060 - False un-initialized variable warnings
gcc/testsuite/ChangeLog:
	PR tree-optimization/55060
	* gcc.dg/uninit-pr55060.c: New.
2021-03-25 17:23:06 -06:00
Martin Sebor
26e80a4968 PR tree-optimization/48483 - Construct from yourself w/o warning
gcc/testsuite/ChangeLog:
	PR tree-optimization/48483
	* g++.dg/warn/uninit-pr48483.C: New test.
2021-03-25 16:08:00 -06:00
Martin Sebor
1b229a3050 New test for PR tree-optimization/44547 - -Wuninitialized reports false warning in nested switch statements.
gcc/testsuite/ChangeLog:
	* gcc.dg/uninit-pr44547.c: New.
2021-03-25 15:31:46 -06:00
François Dumont
50bb46e4d2 libstdc++: Fix and complete __gnu_debug::basic_string implementation
Fix and complete __gnu_debug::basic_string so that it can be used as a transparent
replacement of std::basic_string.

libstdc++-v3/ChangeLog:

	* include/debug/string
	(basic_string(const basic_string&, const _Alloc&)): Define even if !_GLIBCXX_USE_CXX11_ABI.
	(basic_string(basic_string&&, const _Alloc&)): Likewise and add noexcept qualification.
	(basic_string<>::erase): Adapt to take __const_iterator.
	(basic_string(const _CharT*, const _Allocator&)): Remove assign call.
	(basic_string<>::insert(const_iterator, _InputIte, _InputIte)): Try to
	remove iterator debug layer even if !_GLIBCXX_USE_CXX11_ABI.
	[_GLIBCXX_USE_CHAR8_T] (__gnu_debug::u8string): New.
	(__gnu_debug::u16string, __gnu_debug::u32string): New.
	(std::hash<__gnu_debug::basic_string<>>): New partial specialization.
	(std::__is_fast_hash<__gnu_debug::basic_string<>>): Likewise.
	* testsuite/util/exception/safety.h
	(erase_base<__gnu_debug::basic_string<>>): New partial specialization.
	(insert_base<__gnu_debug::basic_string<>>): Likewise.
	* testsuite/util/testsuite_container_traits.h (traits<__gnu_debug::basic_string<>>):
	New partial specialization.
	* testsuite/21_strings/basic_string/hash/debug.cc: New test.
	* testsuite/21_strings/basic_string/requirements/citerators.cc:
	Add test on __gnu_debug::string.
	* testsuite/21_strings/basic_string/requirements/dr438/constructor.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/exception/basic.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/exception/generation_prohibited.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/exception/propagation_consistent.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char8_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/typedefs.cc: Likewise.
2021-03-25 21:56:14 +01:00
Joseph Myers
990a123ef7 Update gcc fr.po.
* fr.po: Update.
2021-03-25 20:43:27 +00:00
Jakub Jelinek
2132a36370 c++: Fix source_location inconsistency between calls from templates and non-templates [PR99672]
The srcloc19.C testcase shows inconsistency in
std::source_location::current() locations between calls from
templates and non-templates.  The location used by __builtin_source_location
comes in both cases from input_location which is set on it by bot_manip
when handling the default argument, called during finish_call_expr.
The problem is that in templates that input_location comes from the
CALL_EXPR we built earlier and that has the combined locus with
range between first character of the function name and closing paren
with caret on the opening paren, so something printed as caret as:
foobar ();
~~~~~~^~
But outside of templates, finish_call_expr is called when input_location
is just the closing paren token, i.e.
foobar ();
        ^
and only after that returns we create the combined location and set
the CALL_EXPR location to that.  So, it means std::source_location::current()
reports in templates the column of opening (, while outside of templates
closing ).

The following patch makes it consistent by creating the combined location
already before calling finish_call_expr and temporarily overriding
input_location to that.

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

	PR c++/99672
	* parser.c (cp_parser_postfix_expression): For calls, create
	combined_loc and temporarily set input_location to it before
	calling finish_call_expr.

	* g++.dg/concepts/diagnostic2.C: Adjust expected caret line.
	* g++.dg/cpp1y/builtin_location.C (f4, n6): Move #line directives
	to match locus changes.
	* g++.dg/cpp2a/srcloc1.C: Adjust expected column numbers.
	* g++.dg/cpp2a/srcloc2.C: Likewise.
	* g++.dg/cpp2a/srcloc15.C: Likewise.
	* g++.dg/cpp2a/srcloc16.C: Likewise.
	* g++.dg/cpp2a/srcloc19.C: New test.
	* g++.dg/modules/adhoc-1_b.C: Adjust expected column numbers
	and caret line.
	* g++.dg/modules/macloc-1_c.C: Adjust expected column numbers.
	* g++.dg/modules/macloc-1_d.C: Likewise.
	* g++.dg/plugin/diagnostic-test-expressions-1.C: Adjust expected
	caret line.

	* testsuite/18_support/source_location/consteval.cc (main): Adjust
	expected column numbers.
	* testsuite/18_support/source_location/1.cc (main): Likewise.
2021-03-25 21:35:11 +01:00
Marek Polacek
d4e0bdbc03 c++: ICE on invalid with inheriting constructors [PR94751]
This is an ICE on invalid where we crash because since r269032 we
keep error_mark_node around instead of using noexcept_false_spec
when things go wrong; see the walk_field_subobs hunk.

We crash in deduce_inheriting_ctor which calls synthesized_method_walk
to deduce the exception-specification, but fails to do so in this case,
because the testcase is invalid so get_nsdmi returns error_mark_node for
the member 'c', and per r269032 the error_mark_node propagates back to
deduce_inheriting_ctor which subsequently calls build_exception_variant
whereon we crash.  I think we should return early if the deduction fails
and I decided to call mark_used to get an error right away instead of
hoping that it would get called later.  My worry is that we could forget
that there was an error and think that we just deduced noexcept(false).

And then I noticed that the test still crashes in C++98.  Here again we
failed to deduce the exception-specification in implicitly_declare_fn,
but nothing reported an error between synthesized_method_walk and the
assert.  Well, not much we can do except calling synthesized_method_walk
again, this time in the verbose mode and making sure that we did get an
error.

gcc/cp/ChangeLog:

	PR c++/94751
	* call.c (build_over_call): Maybe call mark_used in case
	deduce_inheriting_ctor fails and return error_mark_node.
	* cp-tree.h (deduce_inheriting_ctor): Adjust declaration.
	* method.c (deduce_inheriting_ctor): Return bool if the deduction
	fails.
	(implicitly_declare_fn): If raises is error_mark_node, call
	synthesized_method_walk with diag being true.

gcc/testsuite/ChangeLog:

	PR c++/94751
	* g++.dg/cpp0x/inh-ctor37.C: New test.
2021-03-25 16:11:29 -04:00
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