platform/upstream/gcc.git
2 years agoUpdate gcc fr.po, sv.po
Joseph Myers [Mon, 7 Mar 2022 21:44:04 +0000 (21:44 +0000)]
Update gcc fr.po, sv.po

* fr.po, sv.po: Update.

2 years agoFortran: Fix gfc_maybe_dereference_var [PR104430][PR99585]
Tobias Burnus [Mon, 7 Mar 2022 21:11:33 +0000 (22:11 +0100)]
Fortran: Fix gfc_maybe_dereference_var [PR104430][PR99585]

PR fortran/99585
PR fortran/104430

gcc/fortran/ChangeLog:

* trans-expr.cc (conv_parent_component_references): Fix comment;
simplify comparison.
(gfc_maybe_dereference_var): Avoid d referencing a nonpointer.

gcc/testsuite/ChangeLog:

* gfortran.dg/class_result_10.f90: New test.

2 years agoanalyzer: fix leak suppression at end of 'main' [PR101983]
David Malcolm [Mon, 7 Mar 2022 19:19:30 +0000 (14:19 -0500)]
analyzer: fix leak suppression at end of 'main' [PR101983]

PR analyzer/101983 reports what I thought were false positives
from -Wanalyzer-malloc-leak, but on closer inspection, the
analyzer is correctly reporting heap-allocated buffers that are
no longer reachable.

However, these "leaks" occur at the end of "main".  The analyzer already
has some logic to avoid reporting leaks at the end of main, where the
leak is detected at the end of the EXIT basic block.  However, in this case,
the leak is detected at the clobber in BB 2 here:
  <bb 2> :
  func (&res);
  res ={v} {CLOBBER(eol)};
  _4 = 0;

  <bb 3> :
<L0>:
  return _4;

where we have a chain BB 2 -> BB 3 -> EXIT BB.

This patch generalizes the "are we at the end of 'main'" detection to
handle such cases, silencing -Wanalyzer-malloc-leak on them.

There's a remaining issue where the analyzer unhelpfully describes one
of the leaking values as '<unknown>', rather than 'res.a', but I'm
leaving that for a followup (covered by PR analyzer/99771).

gcc/analyzer/ChangeLog:
PR analyzer/101983
* engine.cc (returning_from_function_p): New.
(impl_region_model_context::on_state_leak): Use it when rejecting
leaks at the return from "main".

gcc/testsuite/ChangeLog:
PR analyzer/101983
* gcc.dg/analyzer/pr101983-main.c: New test.
* gcc.dg/analyzer/pr101983-not-main.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agoFortran: Fix typos
Tobias Burnus [Mon, 7 Mar 2022 16:20:52 +0000 (17:20 +0100)]
Fortran: Fix typos

gcc/fortran/ChangeLog:

* array.cc (gfc_ref_dimen_size): Fix comment typo.
* dump-parse-tree.cc (gfc_dump_c_prototypes): Likewise.
* frontend-passes.cc (cfe_code): Likewise.
* gfortran.texi: Likewise.
* resolve.cc (generate_component_assignments): Likewise.
* simplify.cc (gfc_simplify_this_image): Likewise.
* trans-expr.cc (trans_scalar_class_assign,
gfc_maybe_dereference_var): Likewise.
* intrinsic.texi: Remove word duplication.
* invoke.texi: Likewise.

2 years agodoc: Remove redundant sentence about modules being in C++20
Jonathan Wakely [Mon, 7 Mar 2022 16:08:10 +0000 (16:08 +0000)]
doc: Remove redundant sentence about modules being in C++20

As C++20 has already been published, we don't need to link to the draft
(which is now the C++23 draft anyway). And there's no need to say it's
part of the C++20 spec, or that there might be defect reports. That's
true for everything in C++20, so calling it out here just for Modules
isn't needed.

gcc/ChangeLog:

* doc/invoke.texi (C++ Modules): Remove anachronism.

2 years agolibstdc++: Use visibility pragmas instead of attributes [PR104807]
Jonathan Wakely [Mon, 7 Mar 2022 15:07:05 +0000 (15:07 +0000)]
libstdc++: Use visibility pragmas instead of attributes [PR104807]

The _GLIBCXX_PSEUDO_VISIBILITY macro isn't defined until after including
os_defines.h, so we can't use _GLIBCXX_VISIBILITY early in c++config.
Replace the uses of that macro with #pragma visibility push(default)
instead.

libstdc++-v3/ChangeLog:

PR libstdc++/104807
* include/bits/c++config (__terminate, __glibcxx_assert_fail):
Replace _GLIBCXX_VISIBILITY on function with visibility pragma.
(__is_constant_evaluated): Add visibility pragma.

2 years agoopts: fix -gtoggle + optimize attribute
Martin Liska [Fri, 4 Feb 2022 14:50:17 +0000 (15:50 +0100)]
opts: fix -gtoggle + optimize attribute

Note -fvar-tracking is enabled automatically with OPT_LEVELS_1_PLUS and
so we need to drop it if we are called from optimize attribute and the
option is unset.

PR middle-end/104381

gcc/ChangeLog:

* opts.cc (finish_options): If debug info is disabled
(debug_info_level) and -fvar-tracking is unset, disable it.

gcc/testsuite/ChangeLog:

* gcc.dg/pr104381.c: New test.

2 years agoAdd missing space in various string literals
Jakub Jelinek [Mon, 7 Mar 2022 14:16:56 +0000 (15:16 +0100)]
Add missing space in various string literals

After more than 2 years I've run my
https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00844.html
script again.  While it has lots of false positives, it discovered
two bugs.

2022-03-07  Jakub Jelinek  <jakub@redhat.com>

gcc/c/
* c-parser.cc (c_parser_omp_clause_map): Add missing space in string
literal.
gcc/cp/
* parser.cc (cp_parser_omp_clause_map): Add missing space in string
literal.

2 years agoFix up duplicated duplicated words in comments
Jakub Jelinek [Mon, 7 Mar 2022 14:00:20 +0000 (15:00 +0100)]
Fix up duplicated duplicated words in comments

Like in r10-7215-g700d4cb08c88aec37c13e21e63dd61fd698baabc 2 years ago,
I've run
grep -v 'long long\|optab optab\|template template\|double double' *.{[chS],cc} */*.{[chS],cc} *.def config/*/* 2>/dev/null | grep ' \([a-zA-Z]\+\) \1 '
and for the cases that looked clearly wrong changed them, mostly by removing
one of the duplicated words but in some cases with other changes.

2022-03-07  Jakub Jelinek  <jakub@redhat.com>

gcc/
* tree-ssa-propagate.cc: Fix up duplicated word issue in a comment.
* config/riscv/riscv.cc: Likewise.
* config/darwin.h: Likewise.
* config/i386/i386.cc: Likewise.
* config/aarch64/thunderx3t110.md: Likewise.
* config/aarch64/fractional-cost.h: Likewise.
* config/vax/vax.cc: Likewise.
* config/rs6000/pcrel-opt.md: Likewise.
* config/rs6000/predicates.md: Likewise.
* ctfc.h: Likewise.
* tree-ssa-uninit.cc: Likewise.
* value-relation.h: Likewise.
* gimple-range-gori.cc: Likewise.
* ipa-polymorphic-call.cc: Likewise.
* pointer-query.cc: Likewise.
* ipa-sra.cc: Likewise.
* internal-fn.cc: Likewise.
* varasm.cc: Likewise.
* gimple-ssa-warn-access.cc: Likewise.
gcc/analyzer/
* store.cc: Fix up duplicated word issue in a comment.
* analyzer.cc: Likewise.
* engine.cc: Likewise.
* sm-taint.cc: Likewise.
gcc/c-family/
* c-attribs.cc: Fix up duplicated word issue in a comment.
gcc/cp/
* cvt.cc: Fix up duplicated word issue in a comment.
* pt.cc: Likewise.
* module.cc: Likewise.
* coroutines.cc: Likewise.
gcc/fortran/
* trans-expr.cc: Fix up duplicated word issue in a comment.
* gfortran.h: Likewise.
* scanner.cc: Likewise.
gcc/jit/
* libgccjit.h: Fix up duplicated word issue in a comment.

2 years agoarm: add missing space to error.
Martin Liska [Mon, 7 Mar 2022 13:16:21 +0000 (14:16 +0100)]
arm: add missing space to error.

PR target/104794

gcc/ChangeLog:

* config/arm/arm.cc (arm_option_override_internal): Add missing
space.

2 years agotree-optimization/104782 - adjust PR101636 fix
Richard Biener [Mon, 7 Mar 2022 10:11:44 +0000 (11:11 +0100)]
tree-optimization/104782 - adjust PR101636 fix

This reverts the reversion of r10-5979 amending the CTOR case
with a comment as to why the conversion is not necessary there.
It also adds a testcase (but not for the CTOR case).

2022-03-07  Richard Biener  <rguenther@suse.de>

PR tree-optimization/104782
* tree-vect-slp.cc (vectorize_slp_instance_root_stmt):
Re-instantiate r10-5979 fix, add comment.

* gcc.dg/vect/pr104782.c: New testcase.

2 years agoMSP430: fix error message.
Martin Liska [Mon, 7 Mar 2022 10:41:52 +0000 (11:41 +0100)]
MSP430: fix error message.

PR target/104797

gcc/ChangeLog:

* config/msp430/msp430.cc (msp430_expand_delay_cycles): Remove
parenthesis from built-in name.

2 years agoarm: fix option quoting in error messages.
Martin Liska [Mon, 7 Mar 2022 10:25:18 +0000 (11:25 +0100)]
arm: fix option quoting in error messages.

PR target/104794

gcc/ChangeLog:

* config/arm/arm.cc (arm_option_override_internal): Fix quoting
of options in error messages.
(arm_option_reconfigure_globals): Likewise.

2 years agotranslation: reuse string and use switch for codes
Martin Liska [Mon, 7 Mar 2022 09:56:43 +0000 (10:56 +0100)]
translation: reuse string and use switch for codes

PR target/104794

gcc/ChangeLog:

* config/arm/arm-builtins.cc (arm_expand_builtin): Reuse error
message.  Fix ARM_BUILTIN_WRORHI and ARM_BUILTIN_WRORH that can
have only range [0,32].

2 years agos390: Fix up *cmp_and_trap_unsigned_int<mode> constraints [PR104775]
Jakub Jelinek [Mon, 7 Mar 2022 10:14:04 +0000 (11:14 +0100)]
s390: Fix up *cmp_and_trap_unsigned_int<mode> constraints [PR104775]

The following testcase fails to assemble due to clgte %r6,0(%r1,%r10)
insn not being accepted by assembler.
My rough understanding is that in the RSY-b insn format the spot
in other formats used for index registers is used instead for M3 what
kind of comparison it is, so this patch follows what other similar
instructions use for constraint (i.e. one without index register).

2022-03-07  Jakub Jelinek  <jakub@redhat.com>

PR target/104775
* config/s390/s390.md (*cmp_and_trap_unsigned_int<mode>): Use
S constraint instead of T in the last alternative.

* gcc.target/s390/pr104775.c: New test.

2 years agotranslation: small fixes
Martin Liska [Mon, 7 Mar 2022 10:02:15 +0000 (11:02 +0100)]
translation: small fixes

PR translation/90148

gcc/fortran/ChangeLog:

* intrinsic.cc (gfc_is_intrinsic): Remove asterisk from error
message.

gcc/ChangeLog:

* plugin.cc (default_plugin_dir_name): Remove <dir> from error
message.

2 years agoFix translation strings.
Martin Liska [Mon, 7 Mar 2022 09:41:11 +0000 (10:41 +0100)]
Fix translation strings.

PR translation/90148

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_linux64_override_options): Put
quote to a proper place.
* plugin.cc (default_plugin_dir_name): Likewise.

gcc/fortran/ChangeLog:

* intrinsic.cc (gfc_is_intrinsic): Put
quote to a proper place.

2 years agorx: Fix translation string.
Martin Liska [Mon, 7 Mar 2022 09:33:57 +0000 (10:33 +0100)]
rx: Fix translation string.

PR target/99297

gcc/ChangeLog:

* config/rx/rx.cc (rx_expand_builtin_mvtc): Fix translation
string.

2 years agoi386: Fix up cond_{and,ior,xor,mul}* [PR104779]
Jakub Jelinek [Mon, 7 Mar 2022 08:40:51 +0000 (09:40 +0100)]
i386: Fix up cond_{and,ior,xor,mul}* [PR104779]

The following testcase ICEs, because the cond_andv* expander
has vector_operand predicates in both of the commutative inputs
and calls gen_andv*_mask which calls ix86_binary_operator_ok
in its condition, but nothing calls ix86_fixup_binary_operands_no_copy
during the expansion, which means cond_* accepts even operands
like 2 MEMs which then can't be matched.

The following patch handles it like most other insns that the other
cond_* patterns use - by having a separate define_expand that calls
ix86_fixup_binary_operands_no_copy and define_ins with
ix86_binary_operator_ok.

2022-03-07  Jakub Jelinek  <jakub@redhat.com>

PR target/104779
* config/i386/sse.md (avx512dq_mul<mode>3<mask_name>): New
define_expand pattern.  Rename define_insn to ...
(*avx512dq_mul<mode>3<mask_name>): ... this.
(<code><mode>3_mask): New any_logic define_expand pattern.
(<mask_codefor><code><mode>3<mask_name>): Rename to ...
(*<code><mode>3<mask_name>): ... this.

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

2 years agolibstdc++: vxworks: remove stray <iostream> include
Rasmus Villemoes [Fri, 4 Mar 2022 08:18:39 +0000 (09:18 +0100)]
libstdc++: vxworks: remove stray <iostream> include

There doesn't seem to be any reason for this TU to include
<iostream>, and it causes errors when the resulting libstdc++ is used
on our VxWorks 5.5 target - presumably because now libstdc++ itself
contains an instance of std::ios_base::Init. Which should be mostly
harmless, but apparently isn't, and from a QoI viewpoint should
probably be avoided anyway.

libstdc++-v3/ChangeLog:

* config/locale/vxworks/ctype_members.cc: Remove <iostream>
  include.

2 years agoDaily bump.
GCC Administrator [Mon, 7 Mar 2022 00:16:20 +0000 (00:16 +0000)]
Daily bump.

2 years ago[Committed] Update gcc.dg/lower-subreg-1.c on ia32.
Roger Sayle [Sun, 6 Mar 2022 11:03:00 +0000 (11:03 +0000)]
[Committed] Update gcc.dg/lower-subreg-1.c on ia32.

This updates gcc.dg/lower-subreg-1.c to reflect that the i386 backend now
lowers iordi3 itself, rather than relying on the middle-end's subreg1 pass.
Committed as obvious.

2022-03-06  Roger Sayle  <roger@nextmovesoftware.com>

gcc/testsuite/ChangeLog
* gcc.dg/lower-subreg-1.c: Update test case.  iordi3 is no longer
lowered by the RTL subreg1 pass on ia32 [even with -mno-stv].

2 years agoDaily bump.
GCC Administrator [Sun, 6 Mar 2022 00:16:16 +0000 (00:16 +0000)]
Daily bump.

2 years agolibstdc++: Ensure __glibcxx_assert_fail has default visibility
Jonathan Wakely [Fri, 4 Mar 2022 18:23:10 +0000 (18:23 +0000)]
libstdc++: Ensure __glibcxx_assert_fail has default visibility

This ensures there's no linker error if libstdc++ headers are included
following a pragma that sets hidden visibility.

Similarly for std::__terminate, which is always-inline so shouldn't
matter, but it's not wrong to do this anyway.

libstdc++-v3/ChangeLog:

* include/bits/c++config (__glibcxx_assert_fail): Add visibility
attribute.
(__terminate): Likewise.

2 years agowaccess: Remove visited bitmap and stop on EDGE_ABNORMAL
Jakub Jelinek [Sat, 5 Mar 2022 11:20:47 +0000 (12:20 +0100)]
waccess: Remove visited bitmap and stop on EDGE_ABNORMAL

On Fri, Mar 04, 2022 at 02:58:37PM +0100, Jakub Jelinek via Gcc-patches wrote:
> On Thu, Mar 03, 2022 at 05:08:30PM -0700, Martin Sebor wrote:
> > > 1) shouldn't it give up for EDGE_ABNORMAL too?  I mean, e.g.
> > >     following a non-local goto forced edge from a noreturn call
> > >     to a non-local label (if there is just one) doesn't seem
> > >     right to me
> >
> > Possibly yes.  I can add it but I don't have a lot of experience with
> > these bits so if you can suggest a test case to exercise this that
> > would be helpful.
>
> Something like:
> void
> foo (void)
> {
>   __label__ l;
>   __attribute__((noreturn)) void bar (int x) { if (x) goto l; __builtin_trap (); }
>   bar (0);
> l:;
> }
> shows a single EDGE_ABNORMAL from the bar call.
> But it would need tweaking for the ptr use and clobber.
>
> > > 2) if EDGE_DFS_BACK is computed and 1) is done, is there any
> > >     reason why you need 2 levels of protection, i.e. the EDGE_DFS_BACK
> > >     check as well as the visited bitmap (and having them use
> > >     very different answers, if EDGE_DFS_BACK is seen, the function
> > >     will return false, if visited bitmap has a bb, it will return true)?
> > >     Can't the visited bitmap go away?
> >
> > Possibly.  As I said above, I don't have enough experience with these
> > bits to make (and test) the changes quickly, or enough bandwidth to
> > come up to speed on them.  Please feel free to make these improvements.
>
> I'll change that if it passes testing.

Here is a patch to do both.  I don't think we really need to have a testcase
for the EDGE_ABNORMAL case (Martin, feel free to add it later), abnormal
edges simply aren't normal control flow and what exactly it means varies.

2022-03-05  Jakub Jelinek  <jakub@redhat.com>

* gimple-ssa-warn-access.cc (pass_waccess::use_after_inval_p): Remove
visited bitmap and its use.  Also punt on EDGE_ABNORMAL edges.

2 years agoPR 104732: Simplify/fix DI mode logic expansion/splitting on -m32.
Roger Sayle [Sat, 5 Mar 2022 08:50:45 +0000 (08:50 +0000)]
PR 104732: Simplify/fix DI mode logic expansion/splitting on -m32.

This clean-up patch resolves PR testsuite/104732, the failure of the recent
test gcc.target/i386/pr100711-1.c on 32-bit Solaris/x86.  Rather than just
tweak the testcase, the proposed approach is to fix the underlying problem
by removing the "TARGET_STV && TARGET_SSE2" conditionals from the DI mode
logical operation expanders and pre-reload splitters in i386.md, which as
I'll show generate inferior code (even a GCC 12 regression) on !TARGET_64BIT
whenever -mno-stv (such as Solaris) or -msse (but not -msse2).

First a little bit of history.  In the beginning, DImode operations on
i386 weren't defined by the machine description, and lowered during RTL
expansion to SI mode operations.  The with PR 65105 in 2015, -mstv was
added, together with a SWIM1248x mode iterator (later renamed to SWIM1248x)
together with several *<code>di3_doubleword post-reload splitters that
made use of register allocation to perform some double word operations
in 64-but XMM registers.  A short while later in 2016, PR 70322 added
similar support for one_cmpldi2.  All of this logic was dependent upon
"!TARGET_64BIT && TARGET_STV && TARGET_SSE2".  With the passing of time,
these conditions became irrelevant when in 2019, it was decided to split
these double-word patterns before reload.
https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523877.html
https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532236.html
Hence the current situation, where on most modern CPU architectures
(where "TARGET_STV && TARGET_SSE2" is true), RTL is expanded with DI
mode operations, that are then split into two SI mode instructions
before reload, except on Solaris and other odd cases, where the splitting
is to two SI mode instructions is done during RTL expansion.  By the
time compilation reaches register allocation both paths in theory
produce identical or similar code, so the vestigial legacy/logic would
appear to be harmless.

Unfortunately, there is one place where this arbitrary choice of how
to lower DI mode doubleword operations is visible to the middle-end,
it controls whether the backend appears to have a suitable optab, and
the presence (or not) of DImode optabs can influence vectorization
cost models and veclower decisions.

The issue (and code quality regression) can be seen in this test case:

typedef long long v2di __attribute__((vector_size (16)));
v2di x;
void foo (long long a)
{
    v2di t = {a, a};
    x = ~t;
}

which when compiled with "-O2 -m32 -msse -march=pentiumpro" produces:

foo:    subl    $28, %esp
        movl    %ebx, 16(%esp)
        movl    32(%esp), %eax
        movl    %esi, 20(%esp)
        movl    36(%esp), %edx
        movl    %edi, 24(%esp)
        movl    %eax, %esi
        movl    %eax, %edi
        movl    %edx, %ebx
        movl    %edx, %ecx
        notl    %esi
        notl    %ebx
        movl    %esi, (%esp)
        notl    %edi
        notl    %ecx
        movl    %ebx, 4(%esp)
        movl    20(%esp), %esi
        movl    %edi, 8(%esp)
        movl    16(%esp), %ebx
        movl    %ecx, 12(%esp)
        movl    24(%esp), %edi
        movss   8(%esp), %xmm1
        movss   12(%esp), %xmm2
        movss   (%esp), %xmm0
        movss   4(%esp), %xmm3
        unpcklps        %xmm2, %xmm1
        unpcklps        %xmm3, %xmm0
        movlhps %xmm1, %xmm0
        movaps  %xmm0, x
        addl    $28, %esp
        ret

Importantly notice the four "notl" instructions.  With this patch:

foo: subl    $28, %esp
        movl    32(%esp), %edx
        movl    36(%esp), %eax
        notl    %edx
        movl    %edx, (%esp)
        notl    %eax
        movl    %eax, 4(%esp)
        movl    %edx, 8(%esp)
        movl    %eax, 12(%esp)
        movaps  (%esp), %xmm1
        movaps  %xmm1, x
        addl    $28, %esp
        ret

Notice only two "notl" instructions.  Checking with godbolt.org, GCC
generated 4 NOTs in GCC 4.x and 5.x, 2 NOTs between GCC 6.x and 9.x,
and regressed to 4 NOTs since GCC 10.x [which hopefully qualifies
this clean-up as suitable for stage 4].

Most significantly, this patch allows pr100711-1.c to pass with
-mno-stv, allowing pandn to be used with V2DImode on Solaris/x86.
Fingers-crossed this should reduce the number of discrepancies
encountered supporting Solaris/x86.

2022-03-05  Roger Sayle  <roger@nextmovesoftware.com>
    Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog
PR testsuite/104732
* config/i386/i386.md (SWIM1248x): Renamed from SWIM1248s.
Include DI mode unconditionally.
(*anddi3_doubleword): Remove && TARGET_STV && TARGET_SSE2 condition,
i.e. always split on !TARGET_64BIT.
(*<any_or>di3_doubleword): Likewise.
(*one_cmpldi2_doubleword): Likewise.
(and<mode>3 expander): Update to use SWIM1248x from SWIM1248s.
(<any_or><mode>3 expander): Likewise.
(one_cmpl<mode>2 expander): Likewise.

gcc/testsuite/ChangeLog
PR testsuite/104732
* gcc.target/i386/pr104732.c: New test case.

2 years agoOptimize signed DImode -> TImode on power10.
Michael Meissner [Sat, 5 Mar 2022 05:01:52 +0000 (00:01 -0500)]
Optimize signed DImode -> TImode on power10.

On power10, GCC tries to optimize the signed conversion from DImode to
TImode by using the vextsd2q instruction.  However to generate this
instruction, it would have to generate 3 direct moves (1 from the GPR
registers to the altivec registers, and 2 from the altivec registers to
the GPR register).

This patch generates the shift right immediate instruction to do the
conversion if the target/source registers ares GPR registers like it does
on earlier systems.  If the target/source registers are Altivec registers,
it will generate the vextsd2q instruction.

2022-03-05   Michael Meissner  <meissner@linux.ibm.com>

gcc/
PR target/104698
* config/rs6000/vsx.md (UNSPEC_MTVSRD_DITI_W1): Delete.
(mtvsrdd_diti_w1): Delete.
(extendditi2): Convert from define_expand to
define_insn_and_split.  Replace with code to deal with both GPR
registers and with altivec registers.

gcc/testsuite/
PR target/104698
* gcc.target/powerpc/pr104698-1.c: New test.
* gcc.target/powerpc/pr104698-2.c: New test.

2 years agoDaily bump.
GCC Administrator [Sat, 5 Mar 2022 00:16:31 +0000 (00:16 +0000)]
Daily bump.

2 years agoUpdate gcc de.po
Joseph Myers [Fri, 4 Mar 2022 23:55:26 +0000 (23:55 +0000)]
Update gcc de.po

* de.po: Update.

2 years agors6000: Improve .machine
Segher Boessenkool [Tue, 1 Mar 2022 17:04:29 +0000 (17:04 +0000)]
rs6000: Improve .machine

This adds more correct .machine for most older CPUs.  It should be
conservative in the sense that everything we handled before we handle at
least as well now.  This does not yet revamp the server CPU handling, it
is too risky at this point in time.

Tested on powerpc64-linux {-m32,-m64}.  Also manually tested with all
-mcpu=, and the output of that passed through the GNU assembler.

2022-03-04  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Restructure a
bit.  Handle most older CPUs.

2 years agoUpdate .po files
Joseph Myers [Fri, 4 Mar 2022 22:03:22 +0000 (22:03 +0000)]
Update .po files

gcc/po/
* 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.

libcpp/po/
* be.po, ca.po, da.po, de.po, el.po, eo.po, es.po, fi.po, fr.po,
id.po, ja.po, nl.po, pt_BR.po, ru.po, sr.po, sv.po, tr.po, uk.po,
vi.po, zh_CN.po, zh_TW.po: Update.

2 years agoc++: Standard mangling abbreviations & modules
Nathan Sidwell [Thu, 3 Mar 2022 00:42:23 +0000 (19:42 -0500)]
c++: Standard mangling abbreviations & modules

The std manglings for things like std::string should not apply if
we're not in the global module.

gcc/cp/
* mangle.cc (is_std_substitution): Check global module.
(is_std_substitution_char): Return bool.
gcc/testsuite/
* g++.dg/modules/std-subst-2.C: New.
* g++.dg/modules/std-subst-3.C: New.
* g++.dg/modules/std-subst-4_a.C: New.
* g++.dg/modules/std-subst-4_b.C: New.
* g++.dg/modules/std-subst-4_c.C: New.

2 years agoFix 'libgomp.oacc-c-c++-common/kernels-decompose-1.c' expected diagnostics
Thomas Schwinge [Fri, 4 Mar 2022 19:34:40 +0000 (20:34 +0100)]
Fix 'libgomp.oacc-c-c++-common/kernels-decompose-1.c' expected diagnostics

Fix-up for recent commit 8935589b496f755e08cadf26d8ceddf0dd6e0968
"OMP lowering: Regimplify 'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE' DECLs
[PR100280, PR104132, PR104133]": adjust for a GCN offloading workaround
added just before commit: '(volatile void *) &f1;'.

PR testsuite/104791
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: Fix
expected diagnostics.

2 years agoanalyzer: reduce svalue depth limit from 13 to 12 [PR103521]
David Malcolm [Fri, 4 Mar 2022 18:51:14 +0000 (13:51 -0500)]
analyzer: reduce svalue depth limit from 13 to 12 [PR103521]

PR analyzer/103521 reports that commit r12-5585-g132902177138c09803d639e12b1daebf2b9edddc
("analyzer: further false leak fixes due to overzealous state merging [PR103217]")
led to failures of gcc.dg/analyzer/pr93032-mztools.c on some targets,
where rather than reporting FILE * leaks, the analyzer would hit
complexity limits and give up.

The cause is that pr93032-mztools.c has some 'unsigned char' values that
are copied to 'char'.  On targets where 'char' defaults to being signed,
this leads to casts, whereas on targets where 'char' defaults to being
unsigned, no casts are needed.

When the casts occur, various symbolic values within the loop (the
locals 'crc', 'cpsize', and 'uncpsize') become sufficiently complex as
to hit the --param=analyzer-max-svalue-depth= limit, and are treated as
UNKNOWN, allowing the analysis of the loop to quickly terminate, with
much of this state as UNKNOWN (but retaining the FILE * information, and
thus correctly reporting the FILE * leaks).

Without the casts, the symbolic values for these variables don't quite
hit the complexity limit, and the analyzer attempts to track these
values in the loop, leading to the analyzer eventually hitting the
per-program-point limit on the number of states, and giving up on
these execution paths, thus failing to report the FILE * leaks.

This patch tweaks the default value of the param:
  --param=analyzer-max-svalue-depth=.
from 13 down to 12.  This allows the pr93032-mztools.c testcase to
succeeed with both -fsigned-char and -funsigned-char, and thus allows
this integration test to succeed on both styles of target without
requiring extra command-line flags.  The patch duplicates the test so
it runs with both -fsigned-char and -funsigned-char.

My hope is that this will allow similar cases to terminate loop analysis
earlier.  I tried reducing it further, but doing so caused some test
cases to regress.

The tradeoff here is between:
(a) precision of individual states in the analysis, versus
(b) maximizing code-path coverage in the analysis

I can imagine a more nuanced approach that splits the current
per-program-point hard limit into soft and hard limits: on hitting the
soft limit at a program point, go into a less precise mode for states
at that program point, in the hope that we can fully explore execution
paths beyond it without hitting the hard limit, but this seems like
GCC 13 material.

Another possible future fix might be for the analysis plan to make an
attempt to prioritize parts of the code in an enode budget, rather than
setting the same hard limit uniformly across all program points.

gcc/analyzer/ChangeLog:
PR analyzer/103521
* analyzer.opt (-param=analyzer-max-svalue-depth=): Reduce from 13
to 12.

gcc/testsuite/ChangeLog:
PR analyzer/103521
* gcc.dg/analyzer/pr93032-mztools.c: Move to...
* gcc.dg/analyzer/pr93032-mztools-signed-char.c: ...this, adding
-fsigned-char to args, and...
* gcc.dg/analyzer/pr93032-mztools-unsigned-char.c: ...copy to here,
adding -funsigned-char to args.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agomkruntimeinc: skip _FILE
Ian Lance Taylor [Fri, 4 Mar 2022 18:18:00 +0000 (10:18 -0800)]
mkruntimeinc: skip _FILE

We don't need it, and it breaks uclibc.

PR go/101246

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/390021

2 years agolibgo: move golang.org/x/sync/semaphore to gotool packages
Clément Chigot [Tue, 1 Mar 2022 08:25:26 +0000 (09:25 +0100)]
libgo: move golang.org/x/sync/semaphore to gotool packages

golang/x/sync/semaphore is required by gofmt.go.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388634

2 years agolibgo: fix AIX build for the Go1.18 update
Clément Chigot [Tue, 1 Mar 2022 08:29:37 +0000 (09:29 +0100)]
libgo: fix AIX build for the Go1.18 update

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388635

2 years agoDarwin: Fix a type mismatch warning for a non-GCC bootstrap compiler.
Iain Sandoe [Fri, 4 Mar 2022 12:39:03 +0000 (12:39 +0000)]
Darwin: Fix a type mismatch warning for a non-GCC bootstrap compiler.

DECL_MD_FUNCTION_CODE() returns an int, on one particular compiler the
code in darwin_fold_builtin() triggers a warning.

Fixed thus.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin.cc (darwin_fold_builtin): Make fcode an int to
avoid a mismatch with DECL_MD_FUNCTION_CODE().

2 years agoDarwin, libgcc: Fix build errors on powerpc-darwin8.
Iain Sandoe [Fri, 4 Mar 2022 12:34:15 +0000 (12:34 +0000)]
Darwin, libgcc: Fix build errors on powerpc-darwin8.

PowerPC Darwin8 is the last version to use an unwind frame fallback routine.
This had been omitted from the new shared EH library, along with one more
header dependency that only fires there.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libgcc/ChangeLog:

* config/rs6000/t-darwin-ehs: Add darwin-fallback.o.
* config/t-darwin-ehs: Add dependency on unwind.h.

2 years agoc++: Add testcase for already fixed PR [PR103443]
Patrick Palka [Fri, 4 Mar 2022 15:17:30 +0000 (10:17 -0500)]
c++: Add testcase for already fixed PR [PR103443]

Fixed by r12-7264.

PR c++/103443

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/consteval29.C: New test.

2 years agoc++: New module mangling ABI
Nathan Sidwell [Thu, 3 Mar 2022 00:13:43 +0000 (19:13 -0500)]
c++: New module mangling ABI

This implements a new module mangling ABI as the original one has a
few issues:

a) it was not demangleable (oops)

b) implemented a weak ownership model.

This implements a strong ownership model, so that exported entities
from named modules are mangled to include their module attachment.
This gives more informative linker diagnostics and better module
isolation.  Weak ownership was hoped to allow backwards compatibility
with non-modular code, but in practice was very brittle, and C++20
added new semantics for linkage declarations that cover the needed
functionality.

FAOD Clang is also moving to this ABI and documentation will be added
to the Itanium ABI specification.

gcc/cp/
* cp-tree.h (mangle_identifier): Replace with ...
(mangle_module_component): ... this.
* mangle.cc (dump_substitution_candidates): Adjust.
(add_substitution): Likewise.
(find_substitution): Likewise.
(unmangled_name_p): Likewise.
(mangle_module_substitution): Reimplement.
(mangle_module_component): New.
(write_module, maybe_write_module): Adjust.
(write_name): Drop modules here.
(write_unqualified): Do them here instead.
(mangle_global_init): Adjust.
* module.cc (module_state::mangle): Adjust.
(mangle_module): Likewise.
(get_originating_module): Adjust.

gcc/testsuite/
* g++.dg/modules/fn-inline-1_b.C: Adjust.
* g++.dg/modules/fn-inline-1_c.C: Adjust.
* g++.dg/modules/imp-inline-1_a.C: Adjust.
* g++.dg/modules/imp-inline-1_b.C: Adjust.
* g++.dg/modules/init-2_a.C: Adjust.
* g++.dg/modules/init-2_b.C: Adjust.
* g++.dg/modules/init-2_c.C: Adjust.
* g++.dg/modules/member-def-2_d.C: Adjust.
* g++.dg/modules/mod-sym-1.C: Adjust.
* g++.dg/modules/mod-sym-2.C: Adjust.
* g++.dg/modules/mod-sym-3.C: Adjust.
* g++.dg/modules/sym-subst-1.C: Adjust.
* g++.dg/modules/sym-subst-2_b.C: Adjust.
* g++.dg/modules/sym-subst-3_a.C: Adjust.
* g++.dg/modules/sym-subst-3_b.C: Adjust.
* g++.dg/modules/sym-subst-4.C: Adjust.
* g++.dg/modules/sym-subst-5.C: Adjust.
* g++.dg/modules/sym-subst-6.C: Adjust.
* g++.dg/modules/tpl-spec-1_a.C: Adjust.
* g++.dg/modules/tpl-spec-2_b.C: Adjust.
* g++.dg/modules/tpl-spec-2_d.C: Adjust.
* g++.dg/modules/tpl-spec-3_a.C: Adjust.
* g++.dg/modules/virt-1_a.C: Adjust.
* g++.dg/modules/virt-2_a.C: Adjust.
* g++.dg/modules/virt-2_b.C: Adjust.
* g++.dg/modules/virt-2_c.C: Adjust.
* g++.dg/modules/vtt-1_a.C: Adjust.
* g++.dg/modules/vtt-1_b.C: Adjust.

2 years agoLRA, rs6000, Darwin: Revise lo_sum use for forced constants [PR104117].
Iain Sandoe [Wed, 23 Feb 2022 13:53:44 +0000 (13:53 +0000)]
LRA, rs6000, Darwin: Revise lo_sum use for forced constants [PR104117].

Follow up discussion to the initial patch for this PR identified that it is
preferable to avoid the LRA change, and arrange for the target to reject the
hi and lo_sum selections when presented with an invalid address.

We split the Darwin high/low selectors into two:
 1. One that handles non-PIC addresses (kernel mode, mdynamic-no-pic).
 2. One that handles PIC addresses and rejects SYMBOL_REFs unless they are
    suitably wrapped in the MACHOPIC_OFFSET unspec.

The second case is handled by providing a new predicate (macho_pic_address)
that checks the requirements.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/104117

gcc/ChangeLog:

* config/rs6000/darwin.md (@machopic_high_<mode>): New.
(@machopic_low_<mode>): New.
* config/rs6000/predicates.md (macho_pic_address): New.
* config/rs6000/rs6000.cc (rs6000_legitimize_address): Do not
apply the TLS processing to Darwin.
* lra-constraints.cc (process_address_1): Revert the changes
in r12-7209.

2 years agors6000: Allow -mlong-double-64 after -mabi={ibm,ieee}longdouble [PR104208, PR87496]
Peter Bergner [Fri, 4 Mar 2022 15:03:44 +0000 (09:03 -0600)]
rs6000: Allow -mlong-double-64 after -mabi={ibm,ieee}longdouble [PR104208, PR87496]

The glibc build is showing a build error due to extra "error" checking from my
PR87496 fix.  That checking was overeager, disallowing setting the long double
size to 64-bits if the 128-bit long double ABI had already been specified.
Now we only emit an error if we specify a 128-bit long double ABI if our
long double size is not 128 bits.  This also fixes an erroneous error when
-mabi=ieeelongdouble is used and ISA 2.06 is not enabled, but the long double
size has been changed to 64 bits.

2022-03-04  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/87496
PR target/104208
* config/rs6000/rs6000.cc (rs6000_option_override_internal): Make the
ISA 2.06 requirement for -mabi=ieeelongdouble conditional on
-mlong-double-128.
Move the -mabi=ieeelongdouble and -mabi=ibmlongdouble error checking
from here...
* common/config/rs6000/rs6000-common.cc (rs6000_handle_option):
... to here.

gcc/testsuite/
PR target/87496
PR target/104208
* gcc.target/powerpc/pr104208-1.c: New test.
* gcc.target/powerpc/pr104208-2.c: Likewise.
* gcc.target/powerpc/pr87496-2.c: Swap long double options to trigger
the expected error.
* gcc.target/powerpc/pr87496-3.c: Likewise.

2 years agoTest 'libgomp.oacc-*/kernels-private-vars-*' with '--param=openacc-kernels=decompose...
Thomas Schwinge [Wed, 16 Feb 2022 21:24:03 +0000 (22:24 +0100)]
Test 'libgomp.oacc-*/kernels-private-vars-*' with '--param=openacc-kernels=decompose' [PR104784]

Before recent commit 8935589b496f755e08cadf26d8ceddf0dd6e0968
"OMP lowering: Regimplify 'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE' DECLs
[PR100280, PR104132, PR104133]", 'libgomp.oacc-c' testing already worked fine,
but 'libgomp.oacc-c++' testing ICEed.  Via the commit mentioned, the C++
testing ICEs are now resolved, but the underlying issue remains to be looked
into: PR104784 "OpenACC 'kernels' decomposition: C vs. C++ differences".

PR middle-end/104784
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c:
Test with '--param=openacc-kernels=decompose'.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90:
Likewise.

2 years agogimplify: Clear TREE_READONLY on automatic vars being stored into [PR104529]
Jakub Jelinek [Fri, 4 Mar 2022 14:14:59 +0000 (15:14 +0100)]
gimplify: Clear TREE_READONLY on automatic vars being stored into [PR104529]

The following testcase regressed when SRA started punting on stores to
TREE_READONLY vars.  We document that:
"In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
nonzero means it may not be the lhs of an assignment."
so the SRA change looks desirable.  On the other side, at least in this
testcase the TREE_READONLY is set there intentionally from the
PR85873 fix, because gimplify_init_constructor itself uses TREE_READONLY
on the object to determine if it can perform promotion to static const
or not.

So, similarly to other spots in the gimplifier where we also clear
TREE_READONLY when we emit IL that stores into the object, this
does the same in gimplify_init_constructor, but in the way so that
the TREE_READONLY test for the promotion to static const keeps working
and doesn't change anything for notify_temp_creation mode, which doesn't
emit any IL, just tests if it would need a temporary or not.

This keeps PR85873 testcase working as before and fixes this regression.

2022-03-04  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/104529
* gimplify.cc (gimplify_init_constructor): Clear TREE_READONLY
on automatic objects which will be runtime initialized.

* g++.dg/tree-ssa/pr104529.C: New test.

2 years agoTest '-fopt-info-omp-all' in 'libgomp.oacc-*/kernels-private-vars-*'
Thomas Schwinge [Wed, 16 Feb 2022 14:44:27 +0000 (15:44 +0100)]
Test '-fopt-info-omp-all' in 'libgomp.oacc-*/kernels-private-vars-*'

libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c:
Test '-fopt-info-omp-all'.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90:
Likewise.

2 years agoOMP lowering: Regimplify 'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE' DECLs [PR100280,...
Thomas Schwinge [Tue, 15 Feb 2022 22:31:34 +0000 (23:31 +0100)]
OMP lowering: Regimplify 'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE' DECLs [PR100280, PR104132, PR104133]

... by generalizing the existing 'gcc/omp-low.cc:task_shared_vars'.

Fix-up for commit 9b32c1669aad5459dd053424f9967011348add83
"OpenACC 'kernels' decomposition: Mark variables used in
synthesized data clauses as addressable [PR100280]".

PR middle-end/100280
PR middle-end/104132
PR middle-end/104133
gcc/
* omp-low.cc (task_shared_vars): Rename to
'make_addressable_vars'.  Adjust all users.
(scan_sharing_clauses) <OMP_CLAUSE_MAP> Use it for
'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE' DECLs, too.
gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-pr104061-1-3.c: Adjust.
* c-c++-common/goacc/kernels-decompose-pr104061-1-4.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104132-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104133-1.c: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Extend.

2 years agoOpenACC 'kernels' decomposition: Move 'TREE_ADDRESSABLE' setting into OMP lowering...
Thomas Schwinge [Tue, 15 Feb 2022 22:03:49 +0000 (23:03 +0100)]
OpenACC 'kernels' decomposition: Move 'TREE_ADDRESSABLE' setting into OMP lowering [PR100280]

... in preparation for later changes.  No functional change.

Follow-up to commit 9b32c1669aad5459dd053424f9967011348add83
"OpenACC 'kernels' decomposition: Mark variables used in
synthesized data clauses as addressable [PR100280]".

PR middle-end/100280
gcc/
* tree.h (OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE): New.
* tree-core.h: Document it.
* omp-low.cc (scan_sharing_clauses) <OMP_CLAUSE_MAP>: Handle
'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE'.
* omp-oacc-kernels-decompose.cc (maybe_build_inner_data_region):
Set 'OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE' instead of
'TREE_ADDRESSABLE'.
gcc/testsuite/
* c-c++-common/goacc/classify-kernels-unparallelized.c: Adjust.
* c-c++-common/goacc/classify-kernels.c: Likewise.
* c-c++-common/goacc/kernels-decompose-2.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr100280-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104061-1-2.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104061-1-3.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104061-1-4.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104132-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104133-1.c: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/f-asyncwait-1.c: Adjust.
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Likewise.

2 years agoAdd diagnostic: "note: OpenACC 'kernels' decomposition: variable '[...]' declared...
Thomas Schwinge [Tue, 15 Feb 2022 15:54:30 +0000 (16:54 +0100)]
Add diagnostic: "note: OpenACC 'kernels' decomposition: variable '[...]' declared in block made addressable" [PR100280]

Follow-up to commit 9b32c1669aad5459dd053424f9967011348add83
"OpenACC 'kernels' decomposition: Mark variables used in
synthesized data clauses as addressable [PR100280]".

PR middle-end/100280
gcc/
* omp-oacc-kernels-decompose.cc (maybe_build_inner_data_region):
Add diagnostic: "note: OpenACC 'kernels' decomposition: variable
'[...]' declared in block made addressable".
gcc/testsuite/
* c-c++-common/goacc/classify-kernels-unparallelized.c: Add
'--param=openacc-privatization=noisy'.
* c-c++-common/goacc/classify-kernels.c: Likewise.
* c-c++-common/goacc/kernels-decompose-2.c: Adjust.
* c-c++-common/goacc/kernels-decompose-pr100280-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104061-1-2.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104061-1-3.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104061-1-4.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104132-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104133-1.c: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/f-asyncwait-1.c: Adjust.
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Likewise.

2 years agoCatch 'GIMPLE_DEBUG' misbehavior in OpenACC 'kernels' decomposition [PR100400, PR1038...
Thomas Schwinge [Wed, 19 Jan 2022 13:04:42 +0000 (14:04 +0100)]
Catch 'GIMPLE_DEBUG' misbehavior in OpenACC 'kernels' decomposition [PR100400, PR103836, PR104061]

Actually fixing it is a separate task, but it seems prudent to at least catch
it, and document via a few test cases.

gcc/
PR middle-end/100400
PR middle-end/103836
PR middle-end/104061
* omp-oacc-kernels-decompose.cc (decompose_kernels_region_body):
Catch 'GIMPLE_DEBUG'.
gcc/testsuite/
PR middle-end/100400
PR middle-end/103836
PR middle-end/104061
* c-c++-common/goacc/kernels-decompose-pr100400-1-1.c: New.
* c-c++-common/goacc/kernels-decompose-pr100400-1-2.c: New.
* c-c++-common/goacc/kernels-decompose-pr100400-1-3.c: New.
* c-c++-common/goacc/kernels-decompose-pr100400-1-4.c: New.
* c-c++-common/goacc/kernels-decompose-pr103836-1-1.c: New.
* c-c++-common/goacc/kernels-decompose-pr103836-1-2.c: New.
* c-c++-common/goacc/kernels-decompose-pr103836-1-3.c: New.
* c-c++-common/goacc/kernels-decompose-pr103836-1-4.c: New.
* c-c++-common/goacc/kernels-decompose-pr104061-1-1.c: New.
* c-c++-common/goacc/kernels-decompose-pr104061-1-2.c: New.
* c-c++-common/goacc/kernels-decompose-pr104061-1-3.c: New.
* c-c++-common/goacc/kernels-decompose-pr104061-1-4.c: New.

2 years agoAdd 'c-c++-common/goacc/kernels-decompose-pr104133-1.c' [PR104133]
Thomas Schwinge [Wed, 19 Jan 2022 21:28:55 +0000 (22:28 +0100)]
Add 'c-c++-common/goacc/kernels-decompose-pr104133-1.c' [PR104133]

..., currently XFAILed with 'dg-ice'.

PR middle-end/104133
gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-pr104133-1.c: New file.

2 years agoAdd 'c-c++-common/goacc/kernels-decompose-pr104132-1.c' [PR104132]
Thomas Schwinge [Wed, 19 Jan 2022 21:28:55 +0000 (22:28 +0100)]
Add 'c-c++-common/goacc/kernels-decompose-pr104132-1.c' [PR104132]

..., currently XFAILed with 'dg-ice'.

PR middle-end/104132
gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-pr104132-1.c: New file.

2 years agoUpdate 'c-c++-common/goacc/classify-*', 'gfortran.dg/goacc/classify-*'
Thomas Schwinge [Tue, 1 Mar 2022 13:57:38 +0000 (14:57 +0100)]
Update 'c-c++-common/goacc/classify-*', 'gfortran.dg/goacc/classify-*'

... to use 'dg-line', simplifying later changes.  Also some minor miscellaneous
diagnostics scanning maintenance.

gcc/testsuite/
* c-c++-common/goacc/classify-kernels-parloops.c: Update.
* c-c++-common/goacc/classify-kernels-unparallelized-parloops.c:
Likewise.
* c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise.
* c-c++-common/goacc/classify-kernels.c: Likewise.
* c-c++-common/goacc/classify-parallel.c: Likewise.
* c-c++-common/goacc/classify-routine-nohost.c: Likewise.
* c-c++-common/goacc/classify-routine.c: Likewise.
* c-c++-common/goacc/classify-serial.c: Likewise.
* gfortran.dg/goacc/classify-kernels-parloops.f95: Likewise.
* gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95:
Likewise.
* gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
* gfortran.dg/goacc/classify-kernels.f95: Likewise.
* gfortran.dg/goacc/classify-parallel.f95: Likewise.
* gfortran.dg/goacc/classify-routine-nohost.f95: Likewise.
* gfortran.dg/goacc/classify-routine.f95: Likewise.
* gfortran.dg/goacc/classify-serial.f95: Likewise.

2 years agolibstdc++: Fix -Wunused-local-typedefs warning in <compare>
Jonathan Wakely [Fri, 4 Mar 2022 10:43:29 +0000 (10:43 +0000)]
libstdc++: Fix -Wunused-local-typedefs warning in <compare>

libstdc++-v3/ChangeLog:

* libsupc++/compare (strong_order::_S_fp_cmp): Move typedef
inside #if condition.

2 years agotree: Fix up warn_deprecated_use [PR104627]
Jakub Jelinek [Fri, 4 Mar 2022 08:53:36 +0000 (09:53 +0100)]
tree: Fix up warn_deprecated_use [PR104627]

The r12-7287-g1b71bc7c8b18bd1b change improved the -Wdeprecated
warning for C++, but regressed it for C, in particular in
gcc.dg/deprecated.c testcase we now report a type that actually isn't
deprecated as deprecated instead of the one that is deprecated.

The following change tries to find the middle ground between what
we used to do before and what r12-7287 change does.
If TYPE_STUB_DECL (node) is non-NULL (that is what happens with
those C tests), then it will do what it used to do before (just smarter,
there is no need to lookup_attribute when it is called again a few lines
below this), if it is NULL, it will try
TYPE_STUB_DECL (TYPE_MAIN_VARIANT (node)) - what the deprecated-16.C
test needs.

2022-03-04  Jakub Jelinek  <jakub@redhat.com>

PR c/104627
* tree.cc (warn_deprecated_use): For types prefer to use node
and only use TYPE_MAIN_VARIANT (node) if TYPE_STUB_DECL (node) is
NULL.

2 years agox86: Always return pseudo register in ix86_gen_scratch_sse_rtx
H.J. Lu [Sat, 26 Feb 2022 22:17:23 +0000 (14:17 -0800)]
x86: Always return pseudo register in ix86_gen_scratch_sse_rtx

ix86_gen_scratch_sse_rtx returns XMM7/XMM15/XMM31 as a scratch vector
register to prevent RTL optimizers from removing vector register.  It
introduces a conflict with explicit XMM7/XMM15/XMM31 usage and when it
is called by RTL optimizers, it may introduce conflicting usages of
XMM7/XMM15/XMM31.

Change ix86_gen_scratch_sse_rtx to always return a pseudo register and
xfail x86 tests which are optimized with a hard scratch register.

gcc/

PR target/104704
* config/i386/i386.cc (ix86_gen_scratch_sse_rtx): Always return
a pseudo register.

gcc/testsuite/

PR target/104704
* gcc.target/i386/incoming-11.c: Xfail.
* gcc.target/i386/pieces-memset-3.c: Likewise.
* gcc.target/i386/pieces-memset-37.c: Likewise.
* gcc.target/i386/pieces-memset-39.c: Likewise.
* gcc.target/i386/pieces-memset-46.c: Likewise.
* gcc.target/i386/pieces-memset-47.c: Likewise.
* gcc.target/i386/pieces-memset-48.c: Likewise.
* gcc.target/i386/pr90773-5.c: Likewise.
* gcc.target/i386/pr90773-14.c: Likewise.
* gcc.target/i386/pr90773-17.c: Likewise.
* gcc.target/i386/pr100865-8a.c: Likewise.
* gcc.target/i386/pr100865-8c.c: Likewise.
* gcc.target/i386/pr100865-9c.c: Likewise.
* gcc.target/i386/pieces-memset-21.c: Always expect vzeroupper.
* gcc.target/i386/pr82941-1.c: Likewise.
* gcc.target/i386/pr82942-1.c: Likewise.
* gcc.target/i386/pr82990-1.c: Likewise.
* gcc.target/i386/pr82990-3.c: Likewise.
* gcc.target/i386/pr82990-5.c: Likewise.
* gcc.target/i386/pr100865-11b.c: Expect vmovdqa instead of
vmovdqa64.
* gcc.target/i386/pr100865-12b.c: Likewise.
* gcc.target/i386/pr100865-8b.c: Likewise.
* gcc.target/i386/pr100865-9b.c: Likewise.
* gcc.target/i386/pr104704-1.c: New test.
* gcc.target/i386/pr104704-2.c: Likewise.
* gcc.target/i386/pr104704-3.c: Likewise.
* gcc.target/i386/pr104704-4.c: Likewise.
* gcc.target/i386/pr104704-5.c: Likewise.
* gcc.target/i386/pr104704-6.c: Likewise.

2 years agoDaily bump.
GCC Administrator [Fri, 4 Mar 2022 00:16:21 +0000 (00:16 +0000)]
Daily bump.

2 years agolibstdc++: Use non-debug vector in constexpr test [PR104748]
Jonathan Wakely [Thu, 3 Mar 2022 22:28:48 +0000 (22:28 +0000)]
libstdc++: Use non-debug vector in constexpr test [PR104748]

The std::__debug::vector isn't usable in constant expressions, so this
test fails in debug mode. Until the debug vector is fixed we can just
make the test use the non-debug one.

libstdc++-v3/ChangeLog:

PR libstdc++/104748
* testsuite/std/ranges/adaptors/all.cc: Use non-debug vector for
constexpr test.

2 years agolibstdc++: Fix test failure on AIX
Jonathan Wakely [Thu, 3 Mar 2022 22:20:32 +0000 (22:20 +0000)]
libstdc++: Fix test failure on AIX

This fixes a test failure due to a non-reserved name in an AIX system
header (included via <pthread.h>). That name clashes with one of the
names we check our own headers for, so skip checking that name on AIX.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/names.cc (func): Undef on AIX.

2 years agolibstdc++: Implement std::strong_order for floating-point types [PR96526]
Jonathan Wakely [Thu, 3 Mar 2022 12:34:27 +0000 (12:34 +0000)]
libstdc++: Implement std::strong_order for floating-point types [PR96526]

This removes a FIXME in <compare>, defining the total order for
floating-point types. I originally opened PR96526 to request a new
compiler built-in to implement this, but now that we have std::bit_cast
it can be done entirely in the library.

The implementation is based on the glibc definitions of totalorder,
totalorderf, totalorderl etc.

I think this works for all the types that satisfy std::floating_point
today, and should also work for the types expected to be added by P1467
except for std::bfloat16_t. It also supports some additional types that
don't currently satisfy std::floating_point, such as __float80, but we
probably do want that to satisfy the concept for non-strict modes.

libstdc++-v3/ChangeLog:

PR libstdc++/96526
* libsupc++/compare (strong_order): Add missing support for
floating-point types.
* testsuite/18_support/comparisons/algorithms/strong_order_floats.cc:
New test.

2 years agoCall mark_dfs_back_edges before testing EDGE_DFS_BACK [PR104761].
Martin Sebor [Thu, 3 Mar 2022 20:58:00 +0000 (13:58 -0700)]
Call mark_dfs_back_edges before testing EDGE_DFS_BACK [PR104761].

Resolves:
PR middle-end/104761 - bogus -Wdangling-pointer with cleanup and infinite loop

gcc/ChangeLog:

PR middle-end/104761
* gimple-ssa-warn-access.cc (pass_waccess::execute): Call
mark_dfs_back_edges.

gcc/testsuite/ChangeLog:

PR middle-end/104761
* g++.dg/warn/Wdangling-pointer-4.C: New test.
* gcc.dg/Wdangling-pointer-4.c: New test.

2 years agoconfigure: use linker plug-in by default for ld.mold
Martin Liska [Thu, 3 Mar 2022 16:28:45 +0000 (17:28 +0100)]
configure: use linker plug-in by default for ld.mold

gcc/ChangeLog:

* configure.ac: Use linker plug-in by default.
* configure: Regenerate.

2 years agoconfigure: enable plugin support for ld.mold
Martin Liska [Thu, 3 Mar 2022 14:47:19 +0000 (15:47 +0100)]
configure: enable plugin support for ld.mold

gcc/ChangeLog:

* configure.ac: Now ld.mold support LTO plugin API, use it.
* configure: Regenerate.

2 years agoopenmp, fortran: Check that the type of an event handle in a detach clause is suitabl...
Kwok Cheung Yeung [Thu, 3 Mar 2022 10:23:26 +0000 (10:23 +0000)]
openmp, fortran: Check that the type of an event handle in a detach clause is suitable [PR104131]

This rejects variables that are array types, array elements or derived type
members when used as the event handle inside a detach clause (in accordance
with the OpenMP specification).  This would previously lead to an ICE.

2022-03-03  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/fortran/

PR fortran/104131
* openmp.cc (gfc_match_omp_detach): Move check for type of event
handle to...
(resolve_omp_clauses) ...here.  Also check that the event handle is
not an array, or an array access or structure element access.

gcc/testsuite/

PR fortran/104131
* gfortran.dg/gomp/pr104131.f90: New.
* gfortran.dg/gomp/task-detach-1.f90: Update expected error message.

2 years ago[nvptx] Build libraries with mptx=3.1
Tom de Vries [Thu, 3 Mar 2022 08:22:42 +0000 (09:22 +0100)]
[nvptx] Build libraries with mptx=3.1

In gcc-5 to gcc-11, the ptx isa version was 3.1.

On trunk, the default is now 6.0, which is also what will be the value in
the libraries.

Consequently, there may be setups with an older driver that worked with
gcc-11, but will become unsupported with gcc-12.

Fix this by building the libraries with mptx=3.1.

After this, setups with an older driver still won't work out of the box
with gcc-12, because the default ptx isa version has changed, but should work
after specifying mptx=3.1.

gcc/ChangeLog:

2022-03-03  Tom de Vries  <tdevries@suse.de>

* config/nvptx/t-nvptx (MULTILIB_EXTRA_OPTS): Add mptx=3.1.

2 years ago[nvptx] Build libraries with misa=sm_30
Tom de Vries [Wed, 2 Mar 2022 11:04:39 +0000 (12:04 +0100)]
[nvptx] Build libraries with misa=sm_30

In gcc-11, when  specifying -misa=sm_30, an executable may still contain sm_35
code (due to libraries being built with the default -misa=sm_35), so it won't
run on an sm_30 board.

Fix this by building libraries with sm_30, as was the case in gcc-5 to gcc-10.

gcc/ChangeLog:

2022-03-03  Tom de Vries  <tdevries@suse.de>

PR target/104758
* config/nvptx/t-nvptx (MULTILIB_EXTRA_OPTS): Add misa=sm_30.

2 years ago[nvptx] Use --no-verify for sm_30
Tom de Vries [Thu, 3 Mar 2022 08:21:04 +0000 (09:21 +0100)]
[nvptx] Use --no-verify for sm_30

In PR97348, we ran into the problem that recent CUDA dropped support for
sm_30, which inhibited the build when building with CUDA bin in the path,
because the nvptx-tools assembler uses CUDA's ptxas to do ptx verification.

To fix this, in gcc-11 the default sm_xx was moved from sm_30 to sm_35.

This however broke support for sm_30 boards: an executable build for sm_30
might contain sm_35 code from the libraries, which are build with the default
sm_xx (PR104758).

We want to fix this by going back to having the libraries build with sm_30, as
was the case for gcc-5 to gcc-10.  That however reintroduces the problem from
PR97348.

Deal with PR97348 in the simplest way possible: when calling the assembler for
sm_30, specify --no-verify.

This has the unfortunate effect that after fixing PR104758 by building
libraries with sm_30, the libraries are no longer verified.  This can be
improved upon by:
- adding a configure test in gcc that tests if CUDA supports sm_30, and
  if so disabling this patch
- dealing with this in nvptx-tools somehow, either:
  - detect at ptxas execution time that it doesn't support sm_30, or
  - detect this at nvptx-tool configure time.

gcc/ChangeLog:

2022-03-03  Tom de Vries  <tdevries@suse.de>

* config/nvptx/nvptx.h (ASM_SPEC): Add %{misa=sm_30:--no-verify}.

2 years ago[nvptx] Add -mptx=_ in gcc.target/nvptx/smxx.c
Tom de Vries [Thu, 3 Mar 2022 07:51:33 +0000 (08:51 +0100)]
[nvptx] Add -mptx=_ in gcc.target/nvptx/smxx.c

With target board nvptx-none-run/-mptx=3.1 we run into:
...
cc1: error: PTX version (-mptx) needs to be at least 4.2 to support \
  selected -misa (sm_53)^M
compiler exited with status 1
FAIL: gcc.target/nvptx/sm53.c (test for excess errors)
...

Fix this by adding -mptx=_ in sm53.c and similar.

Tested on nvptx.

gcc/testsuite/ChangeLog:

2022-03-03  Tom de Vries  <tdevries@suse.de>

* gcc.target/nvptx/sm53.c: Add -mptx=_.
* gcc.target/nvptx/sm70.c: Same.
* gcc.target/nvptx/sm75.c: Same.
* gcc.target/nvptx/sm80.c: Same.

2 years agoopenmp: Disable SSA form during gimplification on OMP_SIMD clauses and body [PR104757]
Jakub Jelinek [Thu, 3 Mar 2022 08:13:32 +0000 (09:13 +0100)]
openmp: Disable SSA form during gimplification on OMP_SIMD clauses and body [PR104757]

When offloading to nvptx is enabled, scan_omp_simd duplicates the simd
region including its clauses and body using inliner's
copy_gimple_seq_and_replace_locals.  That works nicely for decls, remaps
only those that are seen in the nested bind expr vars (i.e. local variables)
and doesn't remap other vars.  But for SSA_NAMEs it remaps them always, doesn't
know if their def stmt is outside of the simd (then it better shouldn't be remapped)
or inside of it (then it should) and without cfg/dominators that is pretty hard
to figure out (well, we could walk the region twice, once note SSA_NAMEs defined
by each stmt seen there and once do the remapping of only those visited SSA_NAMEs).

This patch uses a simpler way, disables temporarily into_ssa for the clauses and
body of each simd region; we already disable into_ssa e.g. in parallel/target/task
etc. regions through push_gimplify_context () but for simd we don't push
any gimplification context and appart from into_ssa I think we don't need it.

2022-03-03  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/104757
* gimplify.cc (gimplify_omp_loop): Call gimplify_expr rather than
gimplify_omp_for.
(gimplify_expr) <case OMP_SIMD>: Temporarily disable
gimplify_ctxp->into_ssa around call to gimplify_omp_for.

* gfortran.dg/gomp/pr104757.f90: New test.
* gcc.dg/gomp/pr104757.c: New test.

2 years agocalls: When bypassing emit_push_insn for 0 sized arg, emit at least anti_adjust_stack...
Jakub Jelinek [Thu, 3 Mar 2022 08:11:09 +0000 (09:11 +0100)]
calls: When bypassing emit_push_insn for 0 sized arg, emit at least anti_adjust_stack for alignment pad if needed [PR104558]

The following testcase ICEs on x86_64 when asked to use the pre-GCC 8
ABI where zero sized arguments weren't ignored.
In GCC 7 the emit_push_insn calls in store_one_arg were unconditional,
it is true that they didn't actually push anything because it had zero
size, but because arg->locate.alignment_pad is 8 in this case,
emit_push_insn at the end performs
          if (alignment_pad && args_addr == 0)
            anti_adjust_stack (alignment_pad);
and an assert larger on is upset if we don't do it.
The following patch keeps the emit_push_insn conditional but calls
the anti_adjust_stack when needed by hand for the zero sized arguments.
For the new x86_64 ABI where zero sized arguments are ignored
arg->locate.alignment_pad is 0 in this case, so nothing changes
- we in that case really do ignore it.

There is another emit_push_insn call earlier in store_one_arg, also made
conditional on non-zero size by Marek in GCC 8, but that one is for
arguments with non-BLKmode and the only way those can be zero size is
if they are TYPE_EMPTY_P aka when they are completely ignored.  But
I believe arg->locate.alignment_pad should be 0 in that case, so IMHO
there is no need to do anything in the second spot.

2022-03-03  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/104558
* calls.cc (store_one_arg): When not calling emit_push_insn
because size_rtx is const0_rtx, call at least anti_adjust_stack
on arg->locate.alignment_pad if !argblock and the alignment might
be non-zero.

* gcc.dg/pr104558.c: New test.

2 years agoDaily bump.
GCC Administrator [Thu, 3 Mar 2022 00:16:24 +0000 (00:16 +0000)]
Daily bump.

2 years agoFortran: error recovery after invalid assumed type declaration
Harald Anlauf [Tue, 1 Mar 2022 22:13:17 +0000 (23:13 +0100)]
Fortran: error recovery after invalid assumed type declaration

gcc/fortran/ChangeLog:

PR fortran/104573
* resolve.cc (resolve_structure_cons): Avoid NULL pointer
dereference when there is no valid component.

gcc/testsuite/ChangeLog:

PR fortran/104573
* gfortran.dg/assumed_type_14.f90: New test.

2 years agotestsuite: Add -Wno-psabi to pr104505.c
David Edelsohn [Wed, 2 Mar 2022 13:59:01 +0000 (08:59 -0500)]
testsuite: Add -Wno-psabi to pr104505.c

The testcase references a vector type that elicits a psabi warning.
This patch adds the option to suppress the warning.

* c-c++-common/pr104505.c: Add -Wno-psabi.

2 years agod: Merge upstream dmd 423f19b41, druntime 100a608c, phobos a1f8c4c07.
Iain Buclaw [Wed, 2 Mar 2022 17:16:08 +0000 (18:16 +0100)]
d: Merge upstream dmd 423f19b41, druntime 100a608c, phobos a1f8c4c07.

D Runtime changes:

    - Fix stdc.stdio bindings to not depend on druntime (PR104729).
    - Implement stdc.math for Solaris (PR104735).

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 423f19b41.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 100a608c.
* src/MERGE: Merge upstream phobos a1f8c4c07.

2 years agoUndo multi-word optional reloads correctly
Alexandre Oliva [Wed, 2 Mar 2022 17:13:06 +0000 (14:13 -0300)]
Undo multi-word optional reloads correctly

Unlike e.g. remove_inheritance_pseudos, undo_optional_reloads didn't
deal with subregs, so instead of removing multi-word moves, it
replaced the reload pseudo with the original pseudo.  Besides the
redundant move, that retained the clobber of the dest, that starts a
multi-word move.  After the remap, the sequence that should have
become a no-op move starts by clobbering the original pseudo and then
moving its pieces onto themselves.  The problem is the clobber: it
makes earlier sets of the original pseudo to be regarded as dead: if
the optional reload sequence was an output reload, the insn for which
the output reload was attempted may be regarded as dead and deleted.

I've arranged for undo_optional_reloads to accept SUBREGs and use
get_regno, like remove_inheritance_pseudo, adjusted its insn-removal
loop to tolerate iterating over a removed clobber, and added logic to
catch any left-over reload clobbers that could trigger the problem.

for  gcc/ChangeLog

* lra-constraints.cc (undo_optional_reloads): Recognize and
drop insns of multi-word move sequences, tolerate removal
iteration on an already-removed clobber, and refuse to
substitute original pseudos into clobbers.

2 years agoDon't emit switch-unreachable warnings for -ftrivial-auto-var-init (PR102276)
Qing Zhao [Wed, 2 Mar 2022 16:48:37 +0000 (16:48 +0000)]
Don't emit switch-unreachable warnings for -ftrivial-auto-var-init (PR102276)

At the same time, adding -Wtrivial-auto-var-init and update documentation.
 -Wtrivial-auto-var-init and update documentation.

for the following testing case:
1 int g(int *);
2 int f1()
3 {
4     switch (0) {
5         int x;
6         default:
7         return g(&x);
8     }
9 }
compiling with -O -ftrivial-auto-var-init causes spurious warning:
warning: statement will never be executed [-Wswitch-unreachable]
5 |         int x;
  |             ^
This is due to the compiler-generated initialization at the point of
the declaration.

We could avoid the warning  to exclude the following cases:

when
flag_auto_var_init > AUTO_INIT_UNINITIALIZED
And
1) call to .DEFERRED_INIT
2) call to __builtin_clear_padding if the 2nd argument is present and non-zero
3) a gimple assign store right after the .DEFERRED_INIT call that has the LHS
   as RHS

However, we still need to warn users about the incapability of the option
-ftrivial-auto-var-init by adding a new warning option -Wtrivial-auto-var-init
to report cases when it cannot initialize the auto variable. At the same
time, update documentation for -ftrivial-auto-var-init to connect it with
the new warning option -Wtrivial-auto-var-init,  and add documentation
for -Wtrivial-auto-var-init.

gcc/ChangeLog:

PR middle-end/102276
* common.opt (-Wtrivial-auto-var-init): New option.
* doc/invoke.texi (-Wtrivial-auto-var-init): Document new option.
(-ftrivial-auto-var-init): Update option;
* gimplify.cc (emit_warn_switch_unreachable): New function.
(warn_switch_unreachable_r): Rename to ...
(warn_switch_unreachable_and_auto_init_r): This.
(maybe_warn_switch_unreachable): Rename to ...
(maybe_warn_switch_unreachable_and_auto_init): This.
(gimplify_switch_expr): Update calls to renamed function.

gcc/testsuite/ChangeLog:

PR middle-end/102276
* gcc.dg/auto-init-pr102276-1.c: New test.
* gcc.dg/auto-init-pr102276-2.c: New test.
* gcc.dg/auto-init-pr102276-3.c: New test.
* gcc.dg/auto-init-pr102276-4.c: New test.

2 years agortl-optimization/104686 - speedup IRA allocno conflict test
Richard Biener [Wed, 2 Mar 2022 07:55:58 +0000 (08:55 +0100)]
rtl-optimization/104686 - speedup IRA allocno conflict test

In this PR allocnos_conflict_p takes 90% of the compile-time via
the calls from update_conflict_hard_regno_costs.  This is due to
the high number of conflicts recorded in the dense bitvector
representation.  Fortunately we can take advantage of the bitvector
representation here and turn the O(n) conflict test into an O(1) one,
greatly speeding up the compile of the testcase from 39s to just 4s
(93% IRA time to 26% IRA time).

While for the testcase in question the first allocno is almost always
the nice one the patch tries a more systematic approach to finding
the allocno to iterate object conflicts over.  That does reduce
the actual number of compares for the testcase but it doesn't make
a measurable difference wall-clock wise.  That's not guaranteed
though I think so I've kept this systematic way of choosing the
cheapest allocno.

2022-03-02  Richard Biener  <rguenther@suse.de>

PR rtl-optimization/104686
* ira-color.cc (object_conflicts_with_allocno_p): New function
using a bitvector test instead of iterating when possible.
(allocnos_conflict_p): Choose the best allocno to iterate over
object conflicts.
(update_conflict_hard_regno_costs): Do allocnos_conflict_p test
last.

2 years agovect: add vect_float to pr102819 tests
Tamar Christina [Wed, 2 Mar 2022 12:49:57 +0000 (12:49 +0000)]
vect: add vect_float to pr102819 tests

This adds a vect_float requirements to this tests to stop them from running on
targets that don't support float vectorization.

gcc/testsuite/ChangeLog:

PR testsuite/104730
* gcc.dg/vect/complex/pr102819-1.c: Add vect_float.
* gcc.dg/vect/complex/pr102819-2.c: Likewise.
* gcc.dg/vect/complex/pr102819-3.c: Likewise.
* gcc.dg/vect/complex/pr102819-4.c: Likewise.
* gcc.dg/vect/complex/pr102819-5.c: Likewise.
* gcc.dg/vect/complex/pr102819-6.c: Likewise.
* gcc.dg/vect/complex/pr102819-7.c: Likewise.
* gcc.dg/vect/complex/pr102819-8.c: Likewise.
* gcc.dg/vect/complex/pr102819-9.c: Likewise.

2 years agotestsuite: Fix up pr104637 testcase [PR104637]
Jakub Jelinek [Wed, 2 Mar 2022 10:04:35 +0000 (11:04 +0100)]
testsuite: Fix up pr104637 testcase [PR104637]

This testcase FAILs everywhere for 3 reasons:
1) the testcase can't work on ia32, where sizeof (long double) == 12
   and as it is not a power of 2, we disallow creating vectors with such
   elements, -mx32 and -m64 are fine
2) the testcase emits a lot of -Wdiv-by-zero warnings, I've just added
   -Wno-div-by-zero to dg-options
3) my fault, when tweaking the testcase I've missed 33 initializers of
   a 32 element vector which didn't change anything on the ICE, but is
   still reported

This patch fixes all of it, tested with
RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} i386.exp=pr104637.c'
both without the LRA fix where it ICEs and with it where it passes
everywhere.

2022-03-02  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/104637
* gcc.target/i386/pr104637.c: Don't run on ia32.  Add -Wno-div-by-zero
to dg-options.
(foo): Remove extraneous initializer.

2 years agocfg: Dump goto_locus if -fdump-*-*-blocks-details
Jakub Jelinek [Wed, 2 Mar 2022 09:48:55 +0000 (10:48 +0100)]
cfg: Dump goto_locus if -fdump-*-*-blocks-details

When debugging the PR104589 issue, I've run into a problem that
goto_locus doesn't show up in the logs, so it wasn't clear if
the bug hasn't been introduced far earlier just by divergence
in goto_locus of some edge.

2022-03-02  Jakub Jelinek  <jakub@redhat.com>

* cfg.cc (dump_edge_info): Dump goto_locus if present.

2 years agocfgrtl: Fix up -g vs. -g0 code generation -flto differences in fixup_reorder_chain...
Jakub Jelinek [Wed, 2 Mar 2022 09:48:14 +0000 (10:48 +0100)]
cfgrtl: Fix up -g vs. -g0 code generation -flto differences in fixup_reorder_chain [PR104589]

This is similar to PR104237 and similarly to that, no testcase included
for the testsuite, as we don't have a framework to compile/link with
-g -flto and -g0 -flto and compare -fdump-final-insns= results from
the lto1 compilations.

With -flto, whether two location_t compare equal or not and just
express the same location is a lottery.

2022-03-02  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/104589
* cfgrtl.cc (fixup_reorder_chain): Use loc_equal instead of direct
INSN_LOCATION comparison with goto_locus.

2 years agotestsuite: Add testcases for already fixed PR [PR100541]
Jakub Jelinek [Wed, 2 Mar 2022 09:38:39 +0000 (10:38 +0100)]
testsuite: Add testcases for already fixed PR [PR100541]

These testcases started failing with r12-630 and one of them
got fixed with r12-4531 (aka PR102764 fix and r12-4616 further
improved the fix) and the other went latent in r12-2591 (i.e. threader
changes) and I believe was fixed for real by the PR102764 fix too.

2022-03-02  Jakub Jelinek  <jakub@redhat.com>

PR debug/100541
* g++.dg/opt/pr100541-1.C: New test.
* g++.dg/opt/pr100541-2.C: New test.

2 years agostrlen: Comment spelling fixes
Jakub Jelinek [Wed, 2 Mar 2022 09:26:27 +0000 (10:26 +0100)]
strlen: Comment spelling fixes

This fixes some comment spelling bugs in tree-ssa-strlen.cc.

2022-03-02  Jakub Jelinek  <jakub@redhat.com>

* tree-ssa-strlen.cc (strlen_pass::handle_assign,
strlen_pass::before_dom_children): Comment spelling fixes.

2 years agomodref: Comment spelling fixes
Jakub Jelinek [Wed, 2 Mar 2022 09:25:25 +0000 (10:25 +0100)]
modref: Comment spelling fixes

This fixes some spelling mistakes in ipa-modref*.

2022-03-02  Jakub Jelinek  <jakub@redhat.com>

* ipa-modref-tree.cc (modref_access_node::contains,
modref_access_node::closer_pair_p, modref_access_node::insert,
modref_access_node::insert_kill): Comment spelling fixes.
* ipa-modref.cc: Likewise.
(modref_summary::finalize, ignore_nondeterminism_p,
class modref_access_analysis,
modref_access_analysis::set_side_effects,
modref_access_analysis::set_nondeterministic,
modref_access_analysis::record_global_memory_load,
modref_access_analysis::propagate, modref_access_analysis::analyze,
struct escape_point, class modref_lattice, modref_lattice::merge,
modref_lattice::merge_deref, class modref_eaf_analysis,
modref_eaf_analysis::merge_call_lhs_flags,
modref_eaf_analysis::analyze_ssa_name, modref_eaf_analysis::propagate,
modref_eaf_analysis::record_escape_points, remap_kills,
update_escape_summary, remove_useless_summaries,
ipa_merge_modref_summary_after_inlining, pass_ipa_modref::execute):
Likewise.
* ipa-modref.h (struct modref_summary, interposable_eaf_flags):
Likewise.
* ipa-modref-tree.h (enum modref_special_parms,
struct modref_access_node): Likewise.

2 years agoi386: Fix pr104551 testcase for solaris
Hongyu Wang [Tue, 1 Mar 2022 11:59:03 +0000 (19:59 +0800)]
i386: Fix pr104551 testcase for solaris

Use avx2-check mechanism to avoid illegal instrucion on non-avx2 target.

gcc/testsuite/ChangeLog:

PR target/104726
* gcc.target/i386/pr104551.c: Use avx2-check.h.

2 years agoAVX512FP16: Fix vcvt[u]si2sh runtime tests for Solaris
Hongyu Wang [Tue, 1 Mar 2022 09:49:52 +0000 (17:49 +0800)]
AVX512FP16: Fix vcvt[u]si2sh runtime tests for Solaris

Use standard C type instead of __int64_t which doesn't work on Solaris.

gcc/testsuite/ChangeLog:

PR target/104724
* gcc.target/i386/avx512fp16-vcvtsi2sh-1b.c: Use long long
instead of __int64_t.
* gcc.target/i386/avx512fp16-vcvtsi2sh64-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vcvtusi2sh-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vcvtusi2sh64-1b.c: Ditto.

2 years agoDaily bump.
GCC Administrator [Wed, 2 Mar 2022 00:16:32 +0000 (00:16 +0000)]
Daily bump.

2 years agoAdd a test for true positives related to PR104715.
Martin Sebor [Tue, 1 Mar 2022 23:56:06 +0000 (16:56 -0700)]
Add a test for true positives related to PR104715.

Related to:
PR tree-optimization/104715 - false dangling pointer with strstr

gcc/testsuite/ChangeLog:
PR tree-optimization/104715
* gcc.dg/Wdangling-pointer-3.c: New test.

2 years agowarn-access: Fix up check_pointer_uses [PR104715]
Jakub Jelinek [Tue, 1 Mar 2022 20:05:31 +0000 (21:05 +0100)]
warn-access: Fix up check_pointer_uses [PR104715]

The following testcase emits bogus -Wdangling-pointer warnings.
The bug is that when it sees that ptr immediate use is a call that
returns one of its arguments, it will assume that the return value
is based on ptr, but that is the case only if ptr is passed to the
argument that is actually returned (so e.g. for memcpy the first argument,
etc.).  When the builtins guarantee e.g. that the result is based on the
first argument (either ERF_RETURNS_ARG 0 in which case it will always
just returns the first argument as is, or when it is something like
strstr or strpbrk or mempcpy that it returns some pointer based on the
first argument), it means the result is not based on second or following
argument if any.  The second hunk fixes this.

The first hunk just removes an unnecessary TREE_CODE check, the code only
pushes SSA_NAMEs into the pointers vector and if it didn't, it uses
      FOR_EACH_IMM_USE_FAST (use_p, iter, ptr)
a few lines below this, which of course requires that ptr is a SSA_NAME.
Tree checking on SSA_NAME_VERSION will already ensure that if it wasn't
a SSA_NAME, we'd ICE.

2022-03-01  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/104715
* gimple-ssa-warn-access.cc (pass_waccess::check_pointer_uses): Don't
unnecessarily test if ptr is a SSA_NAME, it has to be.  Only push lhs
of a call if gimple_call_return_arg is equal to ptr, not just when it
is non-NULL.

* c-c++-common/Wdangling-pointer-7.c: New test.

2 years agowarn-access: Comment spelling fixes
Jakub Jelinek [Tue, 1 Mar 2022 18:43:04 +0000 (19:43 +0100)]
warn-access: Comment spelling fixes

I've noticed various spelling bugs in comments in this file.

There is one spot I haven't fixed:
"Otherwise, VAR is the auto variable
(including an unnamed temporary such as a compound literal) whose
lifetime's rended it dangling."
I'm afraid I don't know what it wanted to say, "lifetime rendered it"
or something else?

2022-03-01  Jakub Jelinek  <jakub@redhat.com>

* gimple-ssa-warn-access.cc (warn_string_no_nul,
maybe_warn_nonstring_arg, fndecl_alloc_p, new_delete_mismatch_p,
matching_alloc_calls_p, maybe_warn_alloc_args_overflow,
pass_waccess::check_alloca, pass_waccess::check_strcat,
memmodel_to_uhwi, fntype_argno_type,
pass_waccess::maybe_check_access_sizes,
pass_waccess::check_call_access,
pass_waccess::maybe_check_dealloc_call, pass_waccess::check_stmt):
Comment spelling fixes.

2 years agod: Remove gdc.test/dhry.d from the testsuite
Iain Buclaw [Tue, 1 Mar 2022 18:25:30 +0000 (19:25 +0100)]
d: Remove gdc.test/dhry.d from the testsuite

This test is not well ported, and doesn't check anything useful.

gcc/testsuite/ChangeLog:

PR d/104736
* gdc.test/runnable/dhry.d: Removed.

2 years agox86: Limit PR 35513 tests to Linux
H.J. Lu [Tue, 1 Mar 2022 15:39:33 +0000 (07:39 -0800)]
x86: Limit PR 35513 tests to Linux

Limit PR 35513 tests to Linux since they fail on 32-bit Solaris/x86 with
Solaris linker.

PR testsuite/104725
* g++.target/i386/pr35513-1.C: Limit to Linux.
* g++.target/i386/pr35513-2.C: Likewise.

2 years agolto-plugin: update comments - remove hardwired gold
Martin Liska [Tue, 1 Mar 2022 15:40:45 +0000 (16:40 +0100)]
lto-plugin: update comments - remove hardwired gold

lto-plugin/ChangeLog:

* lto-plugin.c (process_offload_section): Use a linker as many
comments are connected to gold linker.
(process_option): Likewise.

2 years agolibstdc++: Fix -Wmaybe-uninitialized false positive [PR103984]
Jonathan Wakely [Tue, 1 Mar 2022 09:33:21 +0000 (09:33 +0000)]
libstdc++: Fix -Wmaybe-uninitialized false positive [PR103984]

This fixes a false positive warning seen with LTO:

12/bits/regex_compiler.tcc:443:32: error: '__last_char._M_char' may be used uninitialized [-Werror=maybe-uninitialized]

Given that the std::regex code is not very efficient anyway, the
overhead of initializing this byte should be minimal.

libstdc++-v3/ChangeLog:

PR middle-end/103984
* include/bits/regex_compiler.h (_BracketMatcher::_M_char): Use
default member initializer.

2 years agolibphobos: Fix misspelling of msvcUsesUCRT (PR104659)
Iain Buclaw [Tue, 1 Mar 2022 10:26:41 +0000 (11:26 +0100)]
libphobos: Fix misspelling of msvcUsesUCRT (PR104659)

libphobos/ChangeLog:

PR d/104659
* libdruntime/config/mingw/msvc.c (init_msvc): Fix misspelling of
msvcUsesUCRT.

2 years agotree-optimization/104716 - check if we can copy loop in loop distribution
Richard Biener [Tue, 1 Mar 2022 08:24:26 +0000 (09:24 +0100)]
tree-optimization/104716 - check if we can copy loop in loop distribution

The following checks whether we can copy the loop before attempting
to do so in loop distribution.  In the testcase there's a computed
goto and thus abnormal edges which we cannot redirect.

2022-03-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/104716
* tree-loop-distribution.cc (find_seed_stmts_for_distribution):
Check if we can copy the loop.

* gfortran.dg/pr104716.f: New testcase.

2 years agotestsuite/104727 - remove XFAIL for gcc.target/i386/pr84101.c
Richard Biener [Tue, 1 Mar 2022 14:23:07 +0000 (15:23 +0100)]
testsuite/104727 - remove XFAIL for gcc.target/i386/pr84101.c

2022-03-01  Richard Biener  <rguenther@suse.de>

PR testsuite/104727
* gcc.target/i386/pr84101.c: Remove XFAIL.

2 years agotestsuite/104728 - constrain gcc.dg/vect/pr81196-2.c
Richard Biener [Tue, 1 Mar 2022 14:20:59 +0000 (15:20 +0100)]
testsuite/104728 - constrain gcc.dg/vect/pr81196-2.c

We need to be able to reverse a vector for negative strides.

2022-03-01  Richard Biener  <rguenther@suse.de>

PR testsuite/104728
* gcc.dg/vect/pr81196-2.c: Require vect_perm.

2 years agoClear currently_expanding_gimple_stmt properly
H.J. Lu [Mon, 28 Feb 2022 23:18:04 +0000 (15:18 -0800)]
Clear currently_expanding_gimple_stmt properly

commit a5883ba0de68efad36db145e75c86394d8bd44ea
Author: Michael Matz <matz@gcc.gnu.org>
Date:   Tue Nov 24 15:37:32 2009 +0000

introduced currently_expanding_gimple_stmt, which was set and cleared in
expand_gimple_basic_block when expanding gimple statement to RTL.  But it
isn't cleared when expand_gimple_basic_block returns inside the loop.

PR middle-end/104721
* cfgexpand.cc (expand_gimple_basic_block): Clear
currently_expanding_gimple_stmt when returning inside the loop.

2 years agoRestrict new testcase gcc.target/i386/pr80270.c to x86_64.
Roger Sayle [Tue, 1 Mar 2022 10:39:58 +0000 (10:39 +0000)]
Restrict new testcase gcc.target/i386/pr80270.c to x86_64.

Committed as obvious (in hindsight).

2022-03-01  Roger Sayle  <roger@nextmovesoftware.com>

gcc/testsuite/ChangeLog
* gcc.target/i386/pr80270.c: Don't compile new test case on ia32.