Commit Graph

183972 Commits

Author SHA1 Message Date
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
Richard Biener
ffa6a7fba1 tree-optimization/99721 - avoid SLP nodes we cannot schedule
This makes sure we'll not run into SLP scheduling issues later by
rejecting all-constant children nodes without any scalar stmts early.

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

	PR tree-optimization/99721
	* tree-vect-slp.c (vect_slp_analyze_node_operations):
	Make sure we can schedule the node.

	* gfortran.dg/vect/pr99721.f90: New testcase.
2021-03-23 10:50:04 +01:00
Marcus Comstedt
fffefe3d9d RISC-V: Fix riscv_subword() for big endian
gcc/
	* config/riscv/riscv.c (riscv_subword): Take endianness into
	account when calculating the byte offset.
2021-03-23 17:32:41 +08:00
Marcus Comstedt
7ac4dfec39 RISC-V: Fix matches against subreg with a bytenum of 0 in riscv.md
These all intend the least significant subpart of the register.
Use the same endian-neutral "subreg_lowpart_operator" predicate that
ARM does instead.

gcc/
	* config/riscv/predicates.md (subreg_lowpart_operator): New predicate
	* config/riscv/riscv.md (*addsi3_extended2, *subsi3_extended2)
	(*negsi2_extended2, *mulsi3_extended2, *<optab>si3_mask)
	(*<optab>si3_mask_1, *<optab>di3_mask, *<optab>di3_mask_1)
	(*<optab>si3_extend_mask, *<optab>si3_extend_mask_1): Use
	new predicate "subreg_lowpart_operator"
2021-03-23 17:32:41 +08:00
Marcus Comstedt
4eb3a801a5 RISC-V: Update shift-shift-5.c testcase for big endian
gcc/testsuite/

	* gcc.target/riscv/shift-shift-5.c (sub): Change
	order of struct fields depending on byteorder.
2021-03-23 17:32:32 +08:00
Marcus Comstedt
28bddf0e32 RISC-V: Fix trampoline generation on big endian
gcc/
	* config/riscv/riscv.c (riscv_swap_instruction): New function
	to byteswap an SImode rtx containing an instruction.
	(riscv_trampoline_init): Byteswap the generated instructions
	when needed.
2021-03-23 17:31:13 +08:00
Marcus Comstedt
f1af1326d2 RISC-V: Update soft-fp config for big-endian
libgcc/
	* config/riscv/sfp-machine.h (__BYTE_ORDER): Set according
	to __BYTE_ORDER__.
2021-03-23 17:31:13 +08:00
Marcus Comstedt
cd1e2f6325 RISC-V: Add riscv{32,64}be with big endian as default
gcc/
	* common/config/riscv/riscv-common.c
	(TARGET_DEFAULT_TARGET_FLAGS): Set default endianness.
	* config.gcc (riscv32be-*, riscv64be-*): Set
	TARGET_BIG_ENDIAN_DEFAULT to 1.
	* config/riscv/elf.h (LINK_SPEC): Change -melf* value
	depending on default endianness.
	* config/riscv/freebsd.h (LINK_SPEC): Likewise.
	* config/riscv/linux.h (LINK_SPEC): Likewise.
	* config/riscv/riscv.c (TARGET_DEFAULT_TARGET_FLAGS): Set
	default endianness.
	* config/riscv/riscv.h (DEFAULT_ENDIAN_SPEC): New macro.
2021-03-23 17:31:13 +08:00
Marcus Comstedt
a9604fcbb2 RISC-V: Support -mlittle-endian and -mbig-endian
gcc/
	* config/riscv/elf.h (LINK_SPEC): Pass linker endianness flag.
	* config/riscv/freebsd.h (LINK_SPEC): Likewise.
	* config/riscv/linux.h (LINK_SPEC): Likewise.
	* config/riscv/riscv.h (ASM_SPEC): Pass -mbig-endian and
	-mlittle-endian.
	(BYTES_BIG_ENDIAN): Handle big endian.
	(WORDS_BIG_ENDIAN): Define to BYTES_BIG_ENDIAN.
	* config/riscv/riscv.opt (-mbig-endian, -mlittle-endian): New
	options.
	* doc/invoke.texi (-mbig-endian, -mlittle-endian): Document.
2021-03-23 17:31:13 +08:00
Jakub Jelinek
3e07e7a6a7 c++: Diagnose references to void in structured bindings [PR99650]
We ICE on the following testcase, because std::tuple_element<...,...>::type
is void and for structured bindings we therefore need to create
void & or void && which is invalid.  We created such REFERENCE_TYPE and
later ICEd in the middle-end.
The following patch fixes it by diagnosing that.

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

	PR c++/99650
	* decl.c (cp_finish_decomp): Diagnose void initializers when
	using tuple_element and get.

	* g++.dg/cpp1z/decomp55.C: New test.
2021-03-23 10:23:42 +01:00
Stefan Schulze Frielinghaus
a28cc94a27 cprop_hardreg: Ensure replacement reg has compatible mode [PR99221]
In addition to the existing check also ask the target whether a
replacement register may be accessed in a different mode than it was set
before.

gcc/ChangeLog:

	* regcprop.c (find_oldest_value_reg): Ask target whether
	  different mode is fine for replacement register.
2021-03-23 09:48:01 +01:00
Martin Liska
e54da1b6b3 mklog: fix test_mklog.py tests.
contrib/ChangeLog:

	* mklog.py: Fix broken tests.
2021-03-23 08:49:25 +01:00
Aldy Hernandez
88081d38bd Handle setting of 1-bit anti-ranges uniformly.
PR tree-optimization/99296
	* value-range.cc (irange::irange_set_1bit_anti_range): New.
	(irange::irange_set_anti_range): Call irange_set_1bit_anti_range
	* value-range.h (irange::irange_set_1bit_anti_range): New.
2021-03-23 02:57:41 -04:00
Joseph Myers
441e1980ce Update gcc sv.po.
* sv.po: Update.
2021-03-23 00:34:23 +00:00
GCC Administrator
8b744f46a2 Daily bump. 2021-03-23 00:16:25 +00:00