Commit Graph

183146 Commits

Author SHA1 Message Date
Tobias Burnus
10c83fb713 gcc/fortran/intrinsic.texi: Fix typos
gcc/fortran/ChangeLog:

	* intrinsic.texi (CO_BROADCAST, CO_MIN, CO_REDUCE, CO_SUM): Fix typos.
2021-01-25 14:43:52 +01:00
Jakub Jelinek
fe5cb7f94d configure: Add workaround for buggy binutils 2.35 [PR98811]
binutils since https://sourceware.org/bugzilla/show_bug.cgi?id=25612
changes from March last year until the
https://sourceware.org/pipermail/binutils/2020-August/112684.html
fix in early August emits incorrect .debug_info when assembling files
with --gdwarf-5.  Instead of emitting proper DWARF 5 .debug_info header,
it emits DWARF 4 .debug_info header with 5 as the dwarf version instead of
4.  This results e.g. in libgcc.a (morestack.o) having garbage in its
.debug_info sections and e.g. libbacktrace during pretty much all libgo
tests fails miserably.

The following patch adds a workaround for that, don't set
HAVE_AS_GDWARF_5_DEBUG_FLAG if readelf can't read the .debug_info back.

Built tested on x86_64-linux against both binutils 2.35 (buggy ones) and
latest binutils trunk, the former with the patch now has DWARF 3
.debug_line and DWARF 2 .debug_info in morestack.o, while the latter
as before correct DWARF 5 .debug_line and .debug_info.

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

	PR debug/98811
	* configure.ac (HAVE_AS_GDWARF_5_DEBUG_FLAG): Only define if
	readelf -wi is able to read the emitted .debug_info back.
	* configure: Regenerated.
2021-01-25 14:20:05 +01:00
Martin Liska
e05a117dc4 Enable -fprofile-reproducible=parallel-runs for profiledbootstrap.
ChangeLog:

	PR gcov-profile/98739
	* Makefile.in: Enable -fprofile-reproducible=parallel-runs
	for profiledbootstrap.
2021-01-25 13:31:05 +01:00
Martin Liska
5089df534b Restore profile reproducibility.
gcc/ChangeLog:

	PR gcov-profile/98739
	* common.opt: Add missing sign symbol.
	* value-prof.c (get_nth_most_common_value): Restore handling
	of PROFILE_REPRODUCIBILITY_PARALLEL_RUNS and
	PROFILE_REPRODUCIBILITY_MULTITHREADED.

libgcc/ChangeLog:

	PR gcov-profile/98739
	* libgcov-merge.c (__gcov_merge_topn): Mark when merging
	ends with a dropped counter.
	* libgcov.h (gcov_topn_add_value): Add return value.
2021-01-25 13:30:34 +01:00
Richard Biener
defc40db9e middle-end/98807 - more vector_element_bits fixes
This simplifies vector_element_bits further, avoiding any mode
dependence and instead relying on boolean vector construction
to populate element precision accordingly.

2021-01-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/98807
	* tree.c (vector_element_bits): Always use precision of
	the element type for boolean vectors.

	* gcc.dg/pr98807.c: New testcase.
2021-01-25 13:18:13 +01:00
Sebastian Huber
0433fc2d7d RTEMS: Fix default linker script
We have to use ENDFILE_SPEC for the default linker script and not
STARTFILE_SPEC, since STARTFILE_SPEC is place before the user provided
library search paths.

gcc/

	* config/rtems.h (STARTFILE_SPEC): Remove qnolinkcmds.
	(ENDFILE_SPEC): Evaluate qnolinkcmds.
2021-01-25 12:31:23 +01:00
Eric Botcazou
5d01fc7c11 Fix internal error on extension with interface at -O2
This is a regression present on the mainline, 10 and 9 branches, in the
form of an internal error with the Ada compiler when a covariant-only
thunk is inlined into its caller.

gcc/ada/
	* gcc-interface/trans.c (make_covariant_thunk): Set the DECL_CONTEXT
	of the parameters and do not set TREE_PUBLIC on the thunk.
	(maybe_make_gnu_thunk): Pass the alias to the covariant thunk.
	* gcc-interface/utils.c (finish_subprog_decl): Set the DECL_CONTEXT
	of the parameters here...
	(begin_subprog_body): ...instead of here.

gcc/testsuite/
	* gnat.dg/thunk2.adb, gnat.dg/thunk2.ads: New test.
	* gnat.dg/thunk2_pkg.ads: New helper.
2021-01-25 11:30:00 +01:00
Paul Thomas
c6b0e33feb Fortran: Fix deferred character lengths in array constructors [PR98517].
2021-01-25  Steve Kargl  <kargl@gcc.gnu.org>

gcc/fortran
	PR fortran/98517
	* resolve.c (resolve_charlen): Check that length expression is
	present before testing for scalar/integer..

gcc/testsuite/
	PR fortran/98517
	* gfortran.dg/charlen_18.f90 : New test.
2021-01-25 10:27:51 +00:00
Sebastian Huber
28229916e1 RTEMS: Fix GCC specification
The use of -nostdlib and -nodefaultlibs disables the processing of
LIB_SPEC (%L) as specified by LINK_COMMAND_SPEC and thus disables the
default linker script for RTEMS.  Move the linker script to
STARTFILE_SPEC which is controlled by -nostdlib and -nostartfiles.  This
fits better since the linker script defines the platform start file
provided by the board support package in RTEMS.

gcc/

	* config/rtems.h (STARTFILE_SPEC): Remove nostdlib and
	nostartfiles handling since this is already done by
	LINK_COMMAND_SPEC.  Evaluate qnolinkcmds.
	(ENDFILE_SPEC): Remove nostdlib and nostartfiles handling since this
	is already done by LINK_COMMAND_SPEC.
	(LIB_SPECS): Remove nostdlib and nodefaultlibs handling since
	this is already done by LINK_COMMAND_SPEC.  Remove qnolinkcmds
	evaluation.
2021-01-25 10:33:52 +01:00
Jakub Jelinek
b7a0507ad9 fold: Fix up strn{case,}cmp folding [PR98771]
As mentioned in the PR, the compiler behaves differently during strncmp
and strncasecmp folding between 32-bit and 64-bit hosts targeting 64-bit
target.  I think that is highly undesirable.

The culprit is the host_size_t_cst_p predicate that is used by
fold_const_call, which punts if the target size_t constants don't fit into
host size_t.  This patch gets rid of that behavior, instead it punts the
same when it doesn't fit into uhwi.

The predicate was used for strncmp and strncasecmp folding and for bcmp, memcmp and
memchr folding.
The constant is in all cases compared to 0, we can do that whether it fits
into size_t or unsigned HOST_WIDE_INT, then it is used in s2 <= s0 or
s2 <= s1 comparisons where s0 and s1 already have uhwi type and represent
the sizes of the objects.
The important difference is for strn{,case}cmp folding, we pass that s2
value as the last argument to the host functions comparing the c_getstr
results.  If s2 fits into size_t, then my patch makes no difference,
but if it is larger, we know the 2 c_getstr objects need to fit into the
host address space, so larger s2 should just act essentially as strcmp
or strcasecmp; as none of those objects can occupy 100% of the address
space, using MIN (SIZE_MAX, s2) achieves that.

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

	PR testsuite/98771
	* fold-const-call.c (host_size_t_cst_p): Renamed to ...
	(size_t_cst_p): ... this.  Check and store unsigned HOST_WIDE_INT
	value rather than host size_t.
	(fold_const_call): Change type of s2 from size_t to
	unsigned HOST_WIDE_INT.  Use size_t_cst_p instead of
	host_size_t_cst_p.  For strncmp calls, pass MIN (s2, SIZE_MAX)
	instead of s2 as last argument.
2021-01-25 10:03:40 +01:00
Tamar Christina
389b67feac Arm: Add NEON and MVE complex mul, mla and mls patterns.
This adds implementation for the optabs for complex operations.  With this the
following C code:

  void g (float complex a[restrict N], float complex b[restrict N],
	  float complex c[restrict N])
  {
    for (int i=0; i < N; i++)
      c[i] =  a[i] * b[i];
  }

generates

NEON:

g:
        vmov.f32        q11, #0.0  @ v4sf
        add     r3, r2, #1600
.L2:
        vmov    q8, q11  @ v4sf
        vld1.32 {q10}, [r1]!
        vld1.32 {q9}, [r0]!
        vcmla.f32       q8, q9, q10, #0
        vcmla.f32       q8, q9, q10, #90
        vst1.32 {q8}, [r2]!
        cmp     r3, r2
        bne     .L2
        bx      lr

MVE:

g:
        push    {lr}
        mov     lr, #100
        dls     lr, lr
.L2:
        vldrw.32        q1, [r1], #16
        vldrw.32        q2, [r0], #16
        vcmul.f32       q3, q2, q1, #0
        vcmla.f32       q3, q2, q1, #90
        vstrw.32        q3, [r2], #16
        le      lr, .L2
        ldr     pc, [sp], #4

instead of

g:
        add     r3, r2, #1600
.L2:
        vld2.32 {d20-d23}, [r0]!
        vld2.32 {d16-d19}, [r1]!
        vmul.f32        q14, q11, q9
        vmul.f32        q15, q11, q8
        vneg.f32        q14, q14
        vfma.f32        q15, q10, q9
        vfma.f32        q14, q10, q8
        vmov    q13, q15  @ v4sf
        vmov    q12, q14  @ v4sf
        vst2.32 {d24-d27}, [r2]!
        cmp     r3, r2
        bne     .L2
        bx      lr

and

g:
        add     r3, r2, #1600
.L2:
        vld2.32 {d20-d23}, [r0]!
        vld2.32 {d16-d19}, [r1]!
        vmul.f32        q15, q10, q8
        vmul.f32        q14, q10, q9
        vmls.f32        q15, q11, q9
        vmla.f32        q14, q11, q8
        vmov    q12, q15  @ v4sf
        vmov    q13, q14  @ v4sf
        vst2.32 {d24-d27}, [r2]!
        cmp     r3, r2
        bne     .L2
        bx      lr

respectively.

gcc/ChangeLog:

	* config/arm/iterators.md (rotsplit1, rotsplit2, conj_op, fcmac1,
	VCMLA_OP, VCMUL_OP): New.
	* config/arm/mve.md (mve_vcmlaq<mve_rot><mode>): Support vec_dup 0.
	* config/arm/neon.md (cmul<conj_op><mode>3): New.
	* config/arm/unspecs.md (UNSPEC_VCMLA_CONJ, UNSPEC_VCMLA180_CONJ,
	UNSPEC_VCMUL_CONJ): New.
	* config/arm/vec-common.md (cmul<conj_op><mode>3, arm_vcmla<rot><mode>,
	cml<fcmac1><conj_op><mode>4): New.
2021-01-25 08:56:37 +00:00
GCC Administrator
02551aa999 Daily bump. 2021-01-25 00:16:24 +00:00
GCC Administrator
6b1633378b Daily bump. 2021-01-24 00:16:16 +00:00
Iain Buclaw
81f928ec8e libphobos: Fix executables segfault on mipsel architecture
The dynamic section on MIPS is read-only, but this was not properly
handled in the runtime library.  The segfault only occurred for programs
that linked to the shared libphobos library.

libphobos/ChangeLog:

	PR d/98806
	* libdruntime/gcc/sections/elf_shared.d (MIPS_Any): Declare version
	for MIPS32 and MIPS64.
	(getDependencies): Adjust dlpi_addr on MIPS_Any.
2021-01-24 00:20:25 +01:00
Anthony Sharp
7e0f147a29 c++: private inheritance access diagnostics fix [PR17314]
This patch fixes PR17314. Previously, when class C attempted
to access member a declared in class A through class B, where class B
privately inherits from A and class C inherits from B, GCC would correctly
report an access violation, but would erroneously report that the reason was
because a was "protected", when in fact, from the point of view of class C,
it was really "private". This patch updates the diagnostics code to generate
more correct errors in cases of failed inheritance such as these.

The reason this bug happened was because GCC was examining the
declared access of decl, instead of looking at it in the
context of class inheritance.

gcc/cp/ChangeLog:

2021-01-21  Anthony Sharp  <anthonysharp15@gmail.com>

	* call.c (complain_about_access): Altered function.
	* cp-tree.h (complain_about_access): Changed parameters of function.
	(get_parent_with_private_access): Declared new function.
	* search.c (get_parent_with_private_access): Defined new function.
	* semantics.c (enforce_access): Modified function.
	* typeck.c (complain_about_unrecognized_member): Updated function
	arguments in complain_about_access.

gcc/testsuite/ChangeLog:

2021-01-21  Anthony Sharp  <anthonysharp15@gmail.com>

	* g++.dg/lookup/scoped1.C: Modified testcase to run successfully
	with changes.
	* g++.dg/tc1/dr142.C: Same as above.
	* g++.dg/tc1/dr52.C: Same as above.
	* g++.old-deja/g++.brendan/visibility6.C: Same as above.
	* g++.old-deja/g++.brendan/visibility8.C: Same as above.
	* g++.old-deja/g++.jason/access8.C: Same as above.
	* g++.old-deja/g++.law/access4.C: Same as above.
	* g++.old-deja/g++.law/visibility12.C: Same as above.
	* g++.old-deja/g++.law/visibility4.C: Same as above.
	* g++.old-deja/g++.law/visibility8.C: Same as above.
	* g++.old-deja/g++.other/access4.C: Same as above.
2021-01-23 17:48:31 -05:00
Jakub Jelinek
c63f091db8 rs6000: Fix up __m64 typedef in mmintrin.h [PR97301]
The x86 __m64 type is defined as:
/* The Intel API is flexible enough that we must allow aliasing with other
   vector types, and their scalar components.  */
typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
and so matches the comment above it in that reads and stores through
pointers to __m64 can alias anything.
But in the rs6000 headers that is the case only for __m128, but not __m64.

The following patch adds that attribute, which fixes the
FAIL: gcc.target/powerpc/sse-movhps-1.c execution test
FAIL: gcc.target/powerpc/sse-movlps-1.c execution test
regressions that appeared when Honza improved ipa-modref.

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

	PR testsuite/97301
	* config/rs6000/mmintrin.h (__m64): Add __may_alias__ attribute.
2021-01-23 09:41:58 +01:00
Patrick Palka
a8cef3cba6 c++: 'this' injection and static member functions [PR97399]
In the testcase pr97399.C below, finish_qualified_id_expr at parse time
adds an implicit 'this->' to the expression tmp::integral<T> (because
it's type-dependent, and also current_class_ptr is set at this point)
within the trailing return type.  Later when substituting into this
trailing return type we crash because we can't resolve the 'this', since
tsubst_function_type does inject_this_parm only for non-static member
functions, which tmp::func is not.

This patch fixes this issue by removing the type-dependence check
in finish_qualified_id_expr added by r9-5972, and instead relaxes
shared_member_p to handle dependent USING_DECLs:

> I think I was wrong in my assertion around Alex's patch that
> shared_member_p should abort on a dependent USING_DECL; it now seems
> appropriate for it to return false if we don't know, we just need to
> adjust the comment to say that.

And when parsing a friend function declaration, we shouldn't be setting
current_class_ptr at all, so this patch additionally suppresses
inject_this_parm in this case.

Finally, the self-contained change to cp_parser_init_declarator is so
that we properly communicate static-ness to cp_parser_direct_declarator
when parsing a member function template.  This lets us reject the
explicit use of 'this' in the testcase this2.C below.

gcc/cp/ChangeLog:

	PR c++/97399
	* cp-tree.h (shared_member_p): Adjust declaration.
	* parser.c (cp_parser_init_declarator): If the storage class
	specifier is sc_static, pass true for static_p to
	cp_parser_declarator.
	(cp_parser_direct_declarator): Don't do inject_this_parm when
	the declarator is a friend.
	* search.c (shared_member_p): Change return type to bool and
	adjust function body accordingly.  Return false for a dependent
	USING_DECL instead of aborting.
	* semantics.c (finish_qualified_id_expr): Rely on shared_member_p
	even when type-dependent.

gcc/testsuite/ChangeLog:

	PR c++/88548
	PR c++/97399
	* g++.dg/cpp0x/this2.C: New test.
	* g++.dg/template/pr97399.C: New test.
2021-01-23 00:24:17 -05:00
David Edelsohn
eb9883c131 testsuite: fix gcc.target/powerpc ilp32 failures
The recent vec insert code generation changes were not reflected in the
expected output for ilp32 targets.  This patch updates the expected
instructions and counts.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/fold-vec-insert-char-p9.c: Adjust ilp32.
	* gcc.target/powerpc/fold-vec-insert-float-p9.c: Same.
	* gcc.target/powerpc/fold-vec-insert-int-p9.c: Same.
	* gcc.target/powerpc/fold-vec-insert-longlong.c: Same.
	* gcc.target/powerpc/fold-vec-insert-short-p9.c: Same.
	* gcc.target/powerpc/pr79251.p9.c: Same.
2021-01-22 19:56:14 -05:00
GCC Administrator
8502e23d1f Daily bump. 2021-01-23 00:16:32 +00:00
Jonathan Wright
16b7b8a32d aarch64: Use RTL builtins for integer mla intrinsics
Rewrite integer mla Neon intrinsics to use RTL builtins rather than
inline assembly code, allowing for better scheduling and optimization.

gcc/Changelog:

2021-01-14  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/aarch64-simd-builtins.def: Add mla builtin
	generator macro.
	* config/aarch64/arm_neon.h (vmla_s8): Use RTL builtin rather
	than asm.
	(vmla_s16): Likewise.
	(vmla_s32): Likewise.
	(vmla_u8): Likewise.
	(vmla_u16): Likewise.
	(vmla_u32): Likewise.
	(vmlaq_s8): Likewise.
	(vmlaq_s16): Likewise.
	(vmlaq_s32): Likewise.
	(vmlaq_u8): Likewise.
	(vmlaq_u16): Likewise.
	(vmlaq_u32): Likewise.
2021-01-22 23:18:11 +00:00
Marek Polacek
89100826ac c++: ICE with noexcept in class in member function [PR96623]
I discovered very strange code in inject_parm_decls:

   if (args && is_this_parameter (args))
     {
       gcc_checking_assert (current_class_ptr == NULL_TREE);
       current_class_ptr = NULL_TREE;

We are tripping up on the assert because when we call inject_parm_decls,
current_class_ptr is set to 'A'.  It was set by inject_this_parameter
after we've parsed the parameter-declaration-clause of the member
function foo.  It seems correct to set ccp/ccr to A::B when we're
late parsing the noexcept-specifiers of bar* functions in B, so that
this-> does the right thing.  Since inject_parm_decls doesn't expect
to see non-null ccp/ccr, reset it before calling inject_parm_decls.

gcc/cp/ChangeLog:

	PR c++/96623
	* parser.c (inject_parm_decls): Remove a redundant assignment.
	(cp_parser_class_specifier_1): Clear current_class_{ptr,ref}
	before calling inject_parm_decls.

gcc/testsuite/ChangeLog:

	PR c++/96623
	* g++.dg/cpp0x/noexcept64.C: New test.
2021-01-22 17:55:06 -05:00
David Edelsohn
ab8cde87ca testsuite: Enable spbp.C on AIX.
This testcase was disabled in the distant past when AIX did not have
support for DWARF and the testcase explicitly invokes DWARF debugging.
This patch re-enables the testcase.

gcc/testsuite/ChangeLog:

	* g++.dg/eh/spbp.C: Remove skip on AIX.
2021-01-22 17:38:50 -05:00
David Malcolm
9cead79073 doc: ensure GCC_EXTRA_DIAGNOSTIC_OUTPUT gets an HTML anchor
This is referenced by my recent release notes changes for GCC 11:
  https://gcc.gnu.org/pipermail/gcc-patches/2021-January/564164.html

gcc/ChangeLog:
	* doc/invoke.texi (GCC_EXTRA_DIAGNOSTIC_OUTPUT): Add @findex
	directive.
2021-01-22 17:07:30 -05:00
Jakub Jelinek
70ab52b8ca testsuite: Fix a typo - UINON_TYPE to UNION_TYPE - in gcc.target/powerpc
Spotted while fixing the rs6000 aliasing issue.

2021-01-22  Jakub Jelinek  <jakub@redhat.com>

	* gcc.target/powerpc/m128-check.h (CHECK_EXP, CHECK_FP_EXP): Fix a
	typo, UINON_TYPE to UNION_TYPE.
2021-01-22 22:55:44 +01:00
Jakub Jelinek
b30e19b517 testsuite: Fix a typo - UINON_TYPE to UNION_TYPE - in gcc.target/i386
Spotted while fixing the rs6000 aliasing issue.

2021-01-22  Jakub Jelinek  <jakub@redhat.com>

	* gcc.target/i386/m128-check.h (CHECK_EXP, CHECK_FP_EXP): Fix a typo,
	UINON_TYPE to UNION_TYPE.
	* gcc.target/i386/m256-check.h (CHECK_FP_EXP): Likewise.
	* gcc.target/i386/m512-check.h (CHECK_ROUGH_EXP): Likewise.
2021-01-22 22:51:03 +01:00
Jakub Jelinek
d08677c11d testsuite: Fix sse2-andnpd-1.c and sse-andnps-1.c testscases on powerpc
On Mon, Sep 21, 2020 at 10:12:20AM +0200, Richard Biener wrote:
> On Mon, 21 Sep 2020, Jan Hubicka wrote:
> > these testcases now fails because they contains an invalid type puning
> > that happens via const VALUE_TYPE *v pointer. Since the check function
> > is noinline, modref is needed to trigger the wrong code.
> > I think it is easiest to fix it by no-strict-aliasing.
> >
> > Regtested x86_64-linux, OK?
>
> OK.
>
> >     * gcc.target/i386/m128-check.h: Add no-strict aliasing to
> >     CHECK_EXP macro.
> >
> > diff --git a/gcc/testsuite/gcc.target/i386/m128-check.h b/gcc/testsuite/gcc.target/i386/m128-check.h
> > index 48b23328539..6f414b07be7 100644
> > --- a/gcc/testsuite/gcc.target/i386/m128-check.h
> > +++ b/gcc/testsuite/gcc.target/i386/m128-check.h
> > @@ -78,6 +78,7 @@ typedef union
> >
> >  #define CHECK_EXP(UINON_TYPE, VALUE_TYPE, FMT)             \
> >  static int                                         \
> > +__attribute__((optimize ("no-strict-aliasing")))   \
> >  __attribute__((noinline, unused))                  \
> >  check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v)     \
> >  {                                                  \

On powerpc64le the tests suffer from the exact same issue.

2021-01-22  Jakub Jelinek  <jakub@redhat.com>

	* gcc.target/powerpc/m128-check.h (check_##UINON_TYPE): Add
	optimize ("no-strict-aliasing") attribute.
2021-01-22 22:38:31 +01:00
Jakub Jelinek
b485fa167e dwarf2out: Always emit required 0 entries for DWARF 5 in *.debug_line [PR98796]
When GCC is emitting .debug_line or .gnu.debuglto_.debug_line section by
itself (happens either with too old or non-GNU assembler, with
-gno-as-loc-support or with -flto) on empty translation units, it violates
the DWARF 5 requirements.
The standard says:
"The first entry is the current directory of the compilation."
and a few lines later:
"The first entry in the sequence is the primary source file whose file name
exactly matches that given in the DW_AT_name attribute in the compilation
unit debugging information entry."
GCC emits 4 zeros (directory entry format count, directories count,
filename entry format count and filename count), which would be ok if the
spec said The first entry may be rather than is.

I had a brief look at whether I could just fall through into the rest of the
function, but there are too many assumptions that there is at least one
normal file that it can't be done that way easily.

So this patch instead extends the early out code to emit the required
minimum, which is 15 bytes more than we used to emit before.

2021-01-22  Jakub Jelinek  <jakub@redhat.com>

	PR debug/98796
	* dwarf2out.c (output_file_names): For -gdwarf-5, if there are no
	filenames to emit, still emit the required 0 index directory and
	filename entries that match DW_AT_comp_dir and DW_AT_name of the
	compilation unit.
2021-01-22 22:37:36 +01:00
Jonathan Wright
32a93eac7a MAINTAINERS: Add myself for write after approval
ChangeLog:

2021-01-22  Jonathan Wright  <jonathan.wright@arm.com>

	* MAINTAINERS (Write After Approval): Add myself.
2021-01-22 19:11:21 +00:00
Jason Merrill
90cbc76900 c++: Fix base copy elision thinko [PR98744]
As Jakub points out in the PR, I was mixing up
DECL_HAS_IN_CHARGE_PARM_P (which is true for the abstract maybe-in-charge
constructor) and DECL_HAS_VTT_PARM_P (which is true for a base constructor
that needs to handle virtual bases).

gcc/cp/ChangeLog:

	PR c++/98744
	* call.c (make_base_init_ok): Use DECL_HAS_VTT_PARM_P.

gcc/testsuite/ChangeLog:

	PR c++/98744
	* g++.dg/init/elide7.C: New test.
2021-01-22 13:09:00 -05:00
Jakub Jelinek
a9ed18295b c++: Fix up ubsan false positives on references [PR95693]
Alex' 2 years old change to build_zero_init_1 to return NULL pointer with
reference type for references breaks the sanitizers, the assignment of NULL
to a reference typed member is then instrumented before it is overwritten
with a non-NULL address later on.
That change has been done to fix error recovery ICE during
process_init_constructor_record, where we:
          if (TYPE_REF_P (fldtype))
            {
              if (complain & tf_error)
                error ("member %qD is uninitialized reference", field);
              else
                return PICFLAG_ERRONEOUS;
            }
a few lines earlier, but then continue and ICE when build_zero_init returns
NULL.

The following patch reverts the build_zero_init_1 change and instead creates
the NULL with reference type constants during the error recovery.

The pr84593.C testcase Alex' change was fixing still works as before.

2021-01-22  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/95693
	* init.c (build_zero_init_1): Revert the 2018-03-06 change to
	return build_zero_cst for reference types.
	* typeck2.c (process_init_constructor_record): Instead call
	build_zero_cst here during error recovery instead of build_zero_init.

	* g++.dg/ubsan/pr95693.C: New test.
2021-01-22 19:04:55 +01:00
Marek Polacek
25fc4d01a8 c++: ICE when mangling operator name [PR98545]
r11-6301 added some asserts in mangle.c, and now we trip over one of
them.  In particular, it's the one asserting that we didn't get
IDENTIFIER_ANY_OP_P when mangling an expression with a dependent name.

As this testcase shows, it's possible to get that, so turn the assert
into an if and write "on".  That changes the mangling in the following
way:

With this patch:

$ c++filt _ZN1i1hIJ1adS1_EEEDTcldtdefpTonclspcvT__EEEDpS2_
decltype (((*this).(operator()))((a)(), (double)(), (a)())) i::h<a, double, a>(a, double, a)

G++10:
$ c++filt _ZN1i1hIJ1adS1_EEEDTcldtdefpTclspcvT__EEEDpS2_
decltype (((*this).(operator()))((a)(), (double)(), (a)())) i::h<a, double, a>(a, double, a)

clang++/icc:
$ c++filt _ZN1i1hIJ1adS1_EEEDTclonclspcvT__EEEDpS2_
decltype ((operator())((a)(), (double)(), (a)())) i::h<a, double, a>(a, double, a)

This is now tracked in PR98756.

gcc/cp/ChangeLog:

	PR c++/98545
	* mangle.c (write_member_name): Emit abi_warn_or_compat_version_crosses
	warnings regardless of abi_version_at_least.
	(write_expression): When the expression is a dependent name
	and an operator name, write "on" before writing its name.

gcc/ChangeLog:

	PR c++/98545
	* doc/invoke.texi: Update C++ ABI Version 15 description.

gcc/testsuite/ChangeLog:

	PR c++/98545
	* g++.dg/abi/mangle76.C: New test.
2021-01-22 13:02:23 -05:00
Paul Thomas
bf8ee9e4ee Fortran: Fix for class functions as associated target [PR98565].
2021-01-22  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/98565
	* trans-intrinsic.c (gfc_conv_associated): Do not add a _data
	component for scalar class function targets. Instead, fix the
	function result and access the _data from that.

gcc/testsuite/
	PR fortran/98565
	* gfortran.dg/associated_target_7.f90 : New test.
2021-01-22 17:11:32 +00:00
Martin Jambor
d7e681fc3a Testcase for old PR 47059
I stumbled across PR 47059 from 2010 which has been addressed by
store-merging.  I am going to close it but would like to add its
testcase too.

gcc/testsuite/ChangeLog:

2021-01-08  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/47059
	* gcc.dg/tree-ssa/pr47059.c: New test.
2021-01-22 18:09:38 +01:00
Kyrylo Tkachov
9d33785f57 tree-ssa-mathopts: Use proper poly_int64 comparison with param_avoid_fma_max_bits [PR 98766]
We ICE here because we end up comparing a poly_int64 with a scalar using
<= rather than maybe_le.
This patch fixes that in the way rich suggests in the PR.

gcc/ChangeLog:

	PR tree-optimization/98766
	* tree-ssa-math-opts.c (convert_mult_to_fma): Use maybe_le when
	comparing against type size with param_avoid_fma_max_bits.

gcc/testsuite/ChangeLog:

	PR tree-optimization/98766
	* gcc.dg/pr98766.c: New test.
2021-01-22 16:40:57 +00:00
Nathan Sidwell
eee8ed2f22 testsuite: Uniquify test names [PR 98795]
Header unit names come from the path the preprocessor determines, and
thus can be absolute.  This tweaks the testsuite to elide that
absoluteness when embedded in a CMI name.  We were also not
distinguishing link and execute tests by the $std flags, so append
them when necessary.

	PR testsuite/98795
	gcc/testsuite/
	* g++.dg/modules/modules.exp (module_cmi_p): Avoid
	embedded absolute paths.
	(module_do_it): Append $std to test name.
2021-01-22 06:44:22 -08:00
Richard Biener
4be156d6be middle-end/98793 - properly handle BLKmode vectors in vector_element_bits
The previous change made AVX512 mask vectors correct but disregarded
the possibility of generic (BLKmode) boolean vectors which are exposed
by the frontends already.

2021-01-22  Richard Biener  <rguenther@suse.de>

	PR middle-end/98793
	* tree.c (vector_element_bits): Key single-bit bool vector on
	integer mode rather than not vector mode.

	* gcc.dg/pr98793.c: New testcase.
2021-01-22 15:23:54 +01:00
Xionghu Luo
e3a8ef8ef2 rs6000: Enable vec_insert for P8 with rs6000_expand_vector_set_var_p8 [PR98093]
Support P8 variable vec_insert and Update testcases' instruction count.

gcc/ChangeLog:

2021-01-22  Xionghu Luo  <luoxhu@linux.ibm.com>

	PR target/98093

	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	Generate ARRAY_REF(VIEW_CONVERT_EXPR) for P8 and later
	platforms.
	* config/rs6000/rs6000.c (rs6000_expand_vector_set_var): Update
	to call different path for P8 and P9.
	(rs6000_expand_vector_set_var_p9): New function.
	(rs6000_expand_vector_set_var_p8): New function.

gcc/testsuite/ChangeLog:

2021-01-22  Xionghu Luo  <luoxhu@linux.ibm.com>

	* gcc.target/powerpc/pr79251.p8.c: New test.
	* gcc.target/powerpc/fold-vec-insert-char-p8.c: Adjust
	instruction counts.
	* gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-double.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise.
	* gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise.
	* gcc.target/powerpc/vsx-builtin-7.c: Likewise.
2021-01-22 08:05:32 -06:00
Xionghu Luo
b292255975 rs6000: Support variable insert and Expand vec_insert in expander [PR79251]
vec_insert accepts 3 arguments, arg0 is input vector, arg1 is the value
to be insert, arg2 is the place to insert arg1 to arg0.  Current expander
generates stxv+stwx+lxv if arg2 is variable instead of constant, which
causes serious store hit load performance issue on Power.  This patch tries
 1) Build VIEW_CONVERT_EXPR for vec_insert (i, v, n) like v[n&3] = i to
unify the gimple code, then expander could use vec_set_optab to expand.
 2) Expand the IFN VEC_SET to fast instructions: lvsr+insert+lvsl.
In this way, "vec_insert (i, v, n)" and "v[n&3] = i" won't be expanded too
early in gimple stage if arg2 is variable, avoid generating store hit load
instructions.

For Power9 V4SI:
	addi 9,1,-16
	rldic 6,6,2,60
	stxv 34,-16(1)
	stwx 5,9,6
	lxv 34,-16(1)
=>
	rlwinm 6,6,2,28,29
	mtvsrwz 0,5
	lvsr 1,0,6
	lvsl 0,0,6
	xxperm 34,34,33
	xxinsertw 34,0,12
	xxperm 34,34,32

Though instructions increase from 5 to 7, the performance is improved
60% in typical cases.
Tested with V2DI, V2DF V4SI, V4SF, V8HI, V16QI on Power9-LE.

2021-01-22  Xionghu Luo  <luoxhu@linux.ibm.com>

gcc/ChangeLog:

	PR target/79251
	PR target/98065

	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	Ajdust variable index vec_insert from address dereference to
	ARRAY_REF(VIEW_CONVERT_EXPR) tree expression.
	* config/rs6000/rs6000-protos.h (rs6000_expand_vector_set_var):
	New declaration.
	* config/rs6000/rs6000.c (rs6000_expand_vector_set_var): New function.

2021-01-22  Xionghu Luo  <luoxhu@linux.ibm.com>

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr79251.p9.c: New test.
	* gcc.target/powerpc/pr79251-run.c: New test.
	* gcc.target/powerpc/pr79251.h: New header.
2021-01-22 08:03:53 -06:00
Martin Liska
b46027c654 Drop time profile for multi-threaded training run.
gcc/ChangeLog:

	PR gcov-profile/98739
	* profile.c (compute_value_histograms): Drop time profile for
	-fprofile-reproducible=multithreaded.
2021-01-22 14:20:53 +01:00
Nathan Sidwell
4804de453e driver: do not check file existence here [PR 98452]
The driver checks whether OPT_SPECIAL_input_file options are readable.
There's no need, the compiler proper will do that anyway.

	gcc/
	* gcc.c (process_command): Don't check OPT_SPECIAL_input_file
	existence here.
2021-01-22 04:56:11 -08:00
Richard Biener
8bad25eb56 middle-end/98773 - always sign extend CHREC_RIGHT
The previous change exposed a miscompile when trying to interpret
CHREC_RIGHT correctly which in fact it already was to the extent
it is used.  The following reverts this part of the change, only
retaining the singling out of HOST_WIDE_INT_MIN.

2021-01-22  Richard Biener  <rguenther@suse.de>

	PR middle-end/98773
	* tree-data-ref.c (initalize_matrix_A): Revert previous
	change, retaining failing on HOST_WIDE_INT_MIN CHREC_RIGHT.

	* gcc.dg/torture/pr98773.c: New testcase.
2021-01-22 12:49:46 +01:00
Jakub Jelinek
36fe1cdc95 match.pd: Replace incorrect simplifications into copysign [PR90248]
In the PR Andrew said he has implemented a simplification that has been
added to LLVM, but that actually is not true, what is in there are
X * (X cmp 0.0 ? +-1.0 : -+1.0) simplifications into +-abs(X)
but what has been added into GCC are (X cmp 0.0 ? +-1.0 : -+1.0)
simplifications into copysign(1, +-X) and then
X * copysign (1, +-X) into +-abs (X).
The problem is with the (X cmp 0.0 ? +-1.0 : -+1.0) simplifications,
they don't work correctly when X is zero.
E.g.
(X > 0.0 ? 1.0 : -1.0)
is -1.0 when X is either -0.0 or 0.0, but copysign will make it return
1.0 for 0.0 and -1.0 only for -0.0.
(X >= 0.0 ? 1.0 : -1.0)
is 1.0 when X is either -0.0 or 0.0, but copysign will make it return
still 1.0 for 0.0 and -1.0 for -0.0.
The simplifications were guarded on !HONOR_SIGNED_ZEROS, but as discussed in
the PR, that option doesn't mean that -0.0 will not ever appear as operand
of some operation, it is hard to guarantee that without compiler adding
canonicalizations of -0.0 to 0.0 after most of the operations and thus
making it very slow, but that the user asserts that he doesn't care if the result
of operations will be 0.0 or -0.0.  Not to mention that some of the
transformations are incorrect even for positive 0.0.

So, instead of those simplifications this patch recognizes patterns where
those ?: expressions are multiplied by X, directly into +-abs.
That works fine even for 0.0 and -0.0 (as long as we don't care about
whether the result is exactly 0.0 or -0.0 in those cases), because
whether the result of copysign is -1.0 or 1.0 doesn't matter when it is
multiplied by 0.0 or -0.0.

As a follow-up, maybe we should add the simplification mentioned in the PR,
in particular doing copysign by hand through
VIEW_CONVERT_EXPR <int, float_X> < 0 ? -float_constant : float_constant
into copysign (float_constant, float_X).  But I think that would need to be
done in phiopt.

2021-01-22  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/90248
	* match.pd (X cmp 0.0 ? 1.0 : -1.0 -> copysign(1, +-X),
	X cmp 0.0 ? -1.0 : +1.0 -> copysign(1, -+X)): Remove
	simplifications.
	(X * (X cmp 0.0 ? 1.0 : -1.0) -> +-abs(X),
	X * (X cmp 0.0 ? -1.0 : 1.0) -> +-abs(X)): New simplifications.

	* gcc.dg/tree-ssa/copy-sign-1.c: Don't expect any copysign
	builtins.
	* gcc.dg/pr90248.c: New test.
2021-01-22 11:51:22 +01:00
Jakub Jelinek
e287a2a11d on ARRAY_REFs sign-extend offsets only from sizetype's precision [PR98255]
As discussed in the PR, the problem here is that the routines changed in
this patch sign extend the difference of index and low_bound from the
precision of the index, so e.g. when index is unsigned int and contains
value -2U, we treat it as index -2 rather than 0x00000000fffffffeU on 64-bit
arches.
On the other hand, get_inner_reference which is used during expansion, does:
            if (! integer_zerop (low_bound))
              index = fold_build2 (MINUS_EXPR, TREE_TYPE (index),
                                   index, low_bound);

            offset = size_binop (PLUS_EXPR, offset,
                                 size_binop (MULT_EXPR,
                                             fold_convert (sizetype, index),
                                             unit_size));
which effectively requires that either low_bound is constant 0 and then
index in ARRAY_REFs can be arbitrary type which is then sign or zero
extended to sizetype, or low_bound is something else and then index and
low_bound must have compatible types and it is still converted afterwards to
sizetype and from there then a few lines later:
expr.c-  if (poly_int_tree_p (offset))
expr.c-    {
expr.c:      poly_offset_int tem = wi::sext (wi::to_poly_offset (offset),
expr.c-                               TYPE_PRECISION (sizetype));
The following patch makes those routines match what get_inner_reference is
doing.

2021-01-22  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/98255
	* tree-dfa.c (get_ref_base_and_extent): For ARRAY_REFs, sign
	extend index - low_bound from sizetype's precision rather than index
	precision.
	(get_addr_base_and_unit_offset_1): Likewise.
	* tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Likewise.
	* gimple-fold.c (fold_const_aggregate_ref_1): Likewise.

	* gcc.dg/pr98255.c: New test.
2021-01-22 11:42:03 +01:00
Richard Biener
fd61ca67f9 tree-optimization/98786 - fix issue with phiopt and abnormals
This fixes factor_out_conditional_conversion to avoid creating overlapping
lifetimes for abnormals.  It also makes sure we do deal with a conditional
conversion (at least for one PHI arg def) - for the testcase that wasn't the case.

2021-01-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98786
	* tree-ssa-phiopt.c (factor_out_conditional_conversion): Avoid
	adding new uses of abnormals.  Verify we deal with a conditional
	conversion.

	* gcc.dg/torture/pr98786.c: New testcase.
2021-01-22 10:37:51 +01:00
Prathamesh Kulkarni
4e3beaca15 arm: Fix ICE with incompatible values for -mfp16-format [PR98636].
gcc/
2021-01-22  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	PR target/98636
	* optc-save-gen.awk: Add arm_fp16_format to checked_options.

gcc/testsuite/
2021-01-22  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	PR target/98636
	* gcc.target/arm/pr98636.c: New test.
2021-01-22 14:14:20 +05:30
liuhongt
ee78c20e74 Lower AVX512 vector comparison to AVX version when dest is vector.
gcc/ChangeLog:

	PR target/96891
	PR target/98348
	* config/i386/sse.md (VI_128_256): New mode iterator.
	(*avx_cmp<mode>3_1, *avx_cmp<mode>3_2, *avx_cmp<mode>3_3,
	 *avx_cmp<mode>3_4, *avx2_eq<mode>3, *avx2_pcmp<mode>3_1,
	 *avx2_pcmp<mode>3_2, *avx2_gt<mode>3): New
	define_insn_and_split to lower avx512 vector comparison to avx
	version when dest is vector.
	(*<avx512>_cmp<mode>3,*<avx512>_cmp<mode>3,*<avx512>_ucmp<mode>3):
	define_insn_and_split for negating the comparison result.
	* config/i386/predicates.md (float_vector_all_ones_operand):
	New predicate.
	* config/i386/i386-expand.c (ix86_expand_sse_movcc): Use
	general NOT operator without UNSPEC_MASKOP.

gcc/testsuite/ChangeLog:

	PR target/96891
	PR target/98348
	* gcc.target/i386/avx512bw-pr96891-1.c: New test.
	* gcc.target/i386/avx512f-pr96891-1.c: New test.
	* gcc.target/i386/avx512f-pr96891-2.c: New test.
	* gcc.target/i386/avx512f-pr96891-3.c: New test.
	* g++.target/i386/avx512f-pr96891-1.C: New test.
	* gcc.target/i386/bitwise_mask_op-3.c: Adjust testcase.
2021-01-22 12:35:14 +08:00
Marek Polacek
bca467e56f c++: ICE with delayed noexcept and attribute used [PR97966]
Another ICE with delayed noexcept parsing, but a bit gnarlier.

A function definition marked with __attribute__((used)) ought to be
emitted even when it is not referenced in the TU.  For a member function
template marked with __attribute__((used)) this means that it will
be instantiated: in instantiate_class_template_1 we have

11971               /* Instantiate members marked with attribute used.  */
11972               if (r != error_mark_node && DECL_PRESERVE_P (r))
11973                 mark_used (r);

It is not so surprising that this doesn't work well with delayed
noexcept parsing: when we're processing the function template we delay
the parsing, so the member "foo" is found, but then when we're
instantiating it, "foo" hasn't yet been seen, which creates a
discrepancy and a crash ensues.  "foo" hasn't yet been seen because
instantiate_class_template_1 just loops over the class members and
instantiates right away.

To make it work, this patch uses a vector to keep track of members
marked with attribute used and uses it to instantiate such members
only after we're done with the class; in particular, after we have
called finish_member_declaration for each member.  And we ought to
be verifying that we did emit such members, so I've added a bunch
of dg-finals.

gcc/cp/ChangeLog:

	PR c++/97966
	* pt.c (instantiate_class_template_1): Instantiate members
	marked with attribute used only after we're done instantiating
	the class.

gcc/testsuite/ChangeLog:

	PR c++/97966
	* g++.dg/cpp0x/noexcept63.C: New test.
2021-01-21 19:22:01 -05:00
Maciej W. Rozycki
070a1fb5f5 MAINTAINERS: Update my e-mail address
* MAINTAINERS (Write After Approval): Update my e-mail address.
2021-01-22 00:18:14 +00:00
GCC Administrator
7559d465fd Daily bump. 2021-01-22 00:16:22 +00:00
David Edelsohn
9929d04ee2 testsuite: Adjust cpp2a/lambda-uneval regrex
Both lambda-uneval1.C and lambda-uneval5.C test that a symbol is not
declared global by looking for "globl" assembler directive.  The testcases
generate the "lglobl" directive in AIX XCOFF, which is a false positive.
This patch restricts the regex to ignore a prepended "l".  The patch
also tightens the regex to specifically look for space, tab or period
between the "globl" and the symbol.

Tested on powerpc-ibm-aix7.2.3.0 and powerpc64le-linux-gnu.

	* g++.dg/cpp2a/lambda-uneval1.C: Ignore preceding "l" and
	intervening period.
	* g++.dg/cpp2a/lambda-uneval5.C: Ignore preceding "l" and
	explicitly check for intervening space, tab or period.
2021-01-21 18:49:33 -05:00