]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 years agoanalyzer: remove redundant typedef
David Malcolm [Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)] 
analyzer: remove redundant typedef

Delete an overzealous copy&paste.

gcc/analyzer/ChangeLog:
* svalue.h (conjured_svalue::iterator_t): Delete.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 years agoanalyzer: remove unused prototypes
David Malcolm [Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)] 
analyzer: remove unused prototypes

gcc/analyzer/ChangeLog:
* store.h (store::get_direct_binding): Remove unused decl.
(store::get_default_binding): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 years agoanalyzer: show types for poisoned_svalue and compound_svalue
David Malcolm [Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)] 
analyzer: show types for poisoned_svalue and compound_svalue

gcc/analyzer/ChangeLog:
* svalue.cc (poisoned_svalue::dump_to_pp): Dump type.
(compound_svalue::dump_to_pp): Dump any type.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 years agodiagnostic-show-locus: tweak rejection logic
David Malcolm [Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)] 
diagnostic-show-locus: tweak rejection logic

gcc/ChangeLog:
* diagnostic-show-locus.c (diagnostic_show_locus): Don't reject
printing the same location twice if there are fix-it hints,
multiple locations, or a label.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 years agoanalyzer: fix missing leak after call to strsep [PR100615]
David Malcolm [Fri, 2 Jul 2021 19:19:43 +0000 (15:19 -0400)] 
analyzer: fix missing leak after call to strsep [PR100615]

PR analyzer/100615 reports a missing leak diagnostic.
The issue is that the code calls strsep which the analyzer doesn't
have special knowledge of, and so conservatively assumes that it
could free the pointer, so drops malloc state for it.

Properly "teaching" the analyzer about strsep would require it
to support bifurcating state at a call, which is currently fiddly to
do, so for now this patch notes that strsep doesn't affect the
malloc state machine, allowing the analyzer to correctly detect the leak.

gcc/analyzer/ChangeLog:
PR analyzer/100615
* sm-malloc.cc: Include "analyzer/function-set.h".
(malloc_state_machine::on_stmt): Call unaffected_by_call_p and
bail on the functions it recognizes.
(malloc_state_machine::unaffected_by_call_p): New.

gcc/testsuite/ChangeLog:
PR analyzer/100615
* gcc.dg/analyzer/pr100615.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 years agoanalyzer: fix ICE on NULL change.m_expr [PR100244]
David Malcolm [Fri, 2 Jul 2021 19:19:43 +0000 (15:19 -0400)] 
analyzer: fix ICE on NULL change.m_expr [PR100244]

PR analyzer/100244 reports an ICE on a -Wanalyzer-free-of-non-heap
due to a case where free_of_non_heap::describe_state_change can be
passed a NULL change.m_expr for a suitably complicated symbolic value.

Bulletproof it by checking for change.m_expr being NULL before
dereferencing it.

gcc/analyzer/ChangeLog:
PR analyzer/100244
* sm-malloc.cc (free_of_non_heap::describe_state_change):
Bulletproof against change.m_expr being NULL.

gcc/testsuite/ChangeLog:
PR analyzer/100244
* g++.dg/analyzer/pr100244.C: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 years agoChange EH pointer encodings to PC relative on Windows
Eric Botcazou [Fri, 2 Jul 2021 08:21:11 +0000 (10:21 +0200)] 
Change EH pointer encodings to PC relative on Windows

A big difference between ELF and PE-COFF is that, with the latter, you can
build position-independent executables or DLLs without generating PIC; as
a  matter of fact, flag_pic has historically been forced to 0 for 32-bit:

/* Don't allow flag_pic to propagate since gas may produce invalid code
   otherwise.  */

\
do {
        \
  flag_pic = TARGET_64BIT ? 1 : 0; \
} while (0)

The reason is that the linker builds a .reloc section that collects the
absolute relocations in the generated binary, and the loader uses them to
relocate it at load time if need be (e.g. if --dynamicbase is enabled).

Up to binutils 2.35, the GNU linker didn't build the .reloc section for
executables and defaulted to --enable-auto-image-base for DLLs, which means
that DLLs had an essentially unique load address and, therefore, need not
be relocated by the loader in most cases.

With binutils 2.36 and later, the GNU linker builds a .reloc section for
executables (thus making them PIE), --enable-auto-image-base is disabled
and --dynamicbase is enabled by default, which means that essentially all
the binaries are relocated at load time.

This badly breaks the 32-bit compiler configured to use DWARF-2 EH because
the loader corrupts the .eh_frame section when processing the relocations
contained in the .reloc section.

gcc/
* config/i386/i386.c (asm_preferred_eh_data_format): Always use the
PIC encodings for PE-COFF targets.

4 years agoDaily bump.
GCC Administrator [Fri, 2 Jul 2021 00:18:20 +0000 (00:18 +0000)] 
Daily bump.

4 years agoUse intermediate integer type with proper signedness
Eric Botcazou [Thu, 1 Jul 2021 15:57:16 +0000 (17:57 +0200)] 
Use intermediate integer type with proper signedness

This is a minor regression present on mainline and 11 branch, whereby the
value of the Enum_Rep attribute is always unsigned.

gcc/ada/
PR ada/101094
* exp_attr.adb (Get_Integer_Type): Return an integer type with the
same signedness as the input type.

4 years agoDaily bump.
GCC Administrator [Thu, 1 Jul 2021 00:18:16 +0000 (00:18 +0000)] 
Daily bump.

4 years agoUpdate Power10 scheduling description for new fused instruction types.
Pat Haugen [Wed, 30 Jun 2021 14:54:37 +0000 (09:54 -0500)] 
Update Power10 scheduling description for new fused instruction types.

Backported from master:
2021-06-08  Pat Haugen  <pthaugen@linux.ibm.com>

gcc/ChangeLog:
* config/rs6000/power10.md (power10-fused-load, power10-fused-store,
power10-fused_alu, power10-fused-vec, power10-fused-branch): New.

4 years agoDaily bump.
GCC Administrator [Wed, 30 Jun 2021 00:18:23 +0000 (00:18 +0000)] 
Daily bump.

4 years agocompiler: in composite literals use temps only for interfaces
Ian Lance Taylor [Tue, 29 Jun 2021 18:00:13 +0000 (11:00 -0700)] 
compiler: in composite literals use temps only for interfaces

For a composite literal we only need to introduce a temporary variable
if we may be converting to an interface type, so only do it then.
This saves over 80% of compilation time when using gccgo to compile
cmd/internal/obj/x86, as the GCC middle-end spends a lot of time
pointlessly computing interactions between temporary variables.

For PR debug/101064
For golang/go#46600

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

4 years agoc++: Failure to delay noexcept parsing with ptr-operator [PR100752]
Marek Polacek [Tue, 8 Jun 2021 21:44:13 +0000 (17:44 -0400)] 
c++: Failure to delay noexcept parsing with ptr-operator [PR100752]

We weren't passing 'flags' to the recursive call to cp_parser_declarator
in the ptr-operator case and as an effect, delayed parsing of noexcept
didn't work as advertised.  The following change passes more than just
CP_PARSER_FLAGS_DELAY_NOEXCEPT but that doesn't seem to break anything.

I'm now also passing member_p and static_p, as a consequence, two tests
needed small tweaks.

PR c++/100752

gcc/cp/ChangeLog:

* parser.c (cp_parser_declarator): Pass flags down to
cp_parser_declarator.  Also pass static_p/member_p.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept69.C: New test.
* g++.dg/parse/saved1.C: Adjust dg-error.
* g++.dg/template/crash50.C: Likewise.

(cherry picked from commit f9c80eb12c58126a94ad869380af5b88b752c06f)

4 years agors6000: Fix typos in float128 ISA3.1 support
Kewen Lin [Wed, 23 Jun 2021 04:09:30 +0000 (23:09 -0500)] 
rs6000: Fix typos in float128 ISA3.1 support

The recent float128 ISA3.1 support (r12-1340) has some typos,
it makes the libgcc build fail if it's with one binutils
(assembler) which doesn't support Power10 insns.  The error
looks like:

Error: invalid switch -mpower10
Error: unrecognized option -mpower10
... [...libgcc/shared-object.mk:14: float128-p10.o] Error 1

What this patch does are:
  - fix test target typo libgcc_cv_powerpc_3_1_float128_hw
    (written wrongly as libgcc_cv_powerpc_float128_hw, so it's
     going to build ISA3.1 stuffs just when detecting ISA3.0).
  - fix test used for libgcc_cv_powerpc_3_1_float128_hw check.
  - fix test option used for libgcc_cv_powerpc_3_1_float128_hw
    check.
  - remove the ISA3.1 related contents from t-float128-hw.
  - add new macro FLOAT128_HW_INSNS_ISA3_1 to differentiate
    ISA3.1 content from ISA3.0 part in ifunc support.

Bootstrapped/regtested on:
  - powerpc64le-linux-gnu P10
  - powerpc64le-linux-gnu P9 (w/i and w/o p10 supported as)
  - powerpc64-linux-gnu P8 (w/i and w/o p10 supported as)

libgcc/ChangeLog:

PR target/101235
* configure: Regenerate.
* configure.ac (test for libgcc_cv_powerpc_3_1_float128_hw): Fix
typos among the name, CFLAGS and the test.
* config/rs6000/t-float128-hw (fp128_3_1_hw_funcs, fp128_3_1_hw_src,
fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj, fp128_3_1_hw_obj):
Remove.
* config/rs6000/t-float128-p10-hw (FLOAT128_HW_INSNS): Append
macro FLOAT128_HW_INSNS_ISA3_1.
(FP128_3_1_CFLAGS_HW): Fix option typo.
* config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): Guard this with
FLOAT128_HW_INSNS_ISA3_1.
(__floattikf_resolve): Likewise.
(__floatuntikf_resolve): Likewise.
(__fixkfti_resolve): Likewise.
(__fixunskfti_resolve): Likewise.
(__floattikf): Likewise.
(__floatuntikf): Likewise.
(__fixkfti): Likewise.
(__fixunskfti): Likewise.

(cherry picked from commit 47749c43acb460ac8f410ee599616d1860ee5a35)

4 years agoDaily bump.
GCC Administrator [Tue, 29 Jun 2021 00:18:12 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Mon, 28 Jun 2021 00:18:00 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 27 Jun 2021 00:17:59 +0000 (00:17 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 26 Jun 2021 00:18:20 +0000 (00:18 +0000)] 
Daily bump.

4 years agoFix SLP permute propagation error
Richard Biener [Thu, 24 Jun 2021 08:47:18 +0000 (10:47 +0200)] 
Fix SLP permute propagation error

This fixes SLP permute propagation to not propagate across operations
that have different semantics on different lanes like for example
the recently added COMPLEX_ADD_ROT90.

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

* tree-vect-slp.c (vect_optimize_slp): Do not propagate
across operations that have different semantics on different
lanes.

4 years agotree-optimization/101158 - adjust SLP call matching sequence
Richard Biener [Tue, 22 Jun 2021 07:24:24 +0000 (09:24 +0200)] 
tree-optimization/101158 - adjust SLP call matching sequence

This moves the check for same operands after verifying we're
facing compatible calls.

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

PR tree-optimization/101158
* tree-vect-slp.c (vect_build_slp_tree_1): Move same operand
checking after checking for matching operation.

* gfortran.dg/pr101158.f90: New testcase.

(cherry picked from commit 7a22d8a764418265680a6bb9a9aec31e984eb015)

4 years agotree-optimization/101151 - fix irreducible region check for sinking
Richard Biener [Tue, 22 Jun 2021 08:14:02 +0000 (10:14 +0200)] 
tree-optimization/101151 - fix irreducible region check for sinking

The check whether two blocks are in the same irreducible region
and thus post-dominance checks being unreliable was incomplete
since an irreducible region can contain reducible sub-regions but
if one block is in the irreducible part and one not the check
still doesn't work as expected.

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

PR tree-optimization/101151
* tree-ssa-sink.c (statement_sink_location): Expand irreducible
region check.

* gcc.dg/torture/pr101151.c: New testcase.

(cherry picked from commit a2ef8395fa970498985764514044e5fd00f7d5c0)

4 years agotree-optimization/101105 - fix runtime alias test optimization
Richard Biener [Wed, 23 Jun 2021 10:43:03 +0000 (12:43 +0200)] 
tree-optimization/101105 - fix runtime alias test optimization

We were ignoring DR_STEP for VF == 1 which is OK only in case
the scalar order is preserved or both DR steps are the same.

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

PR tree-optimization/101105
* tree-vect-data-refs.c (vect_prune_runtime_alias_test_list):
Only ignore steps when they are equal or scalar order is preserved.

* gcc.dg/torture/pr101105.c: New testcase.

(cherry picked from commit 50374fdacbd121bc4a61b073e559208ff61bee06)

4 years agomiddle-end/100672 - fix bogus right shift folding
Richard Biener [Wed, 19 May 2021 11:35:07 +0000 (13:35 +0200)] 
middle-end/100672 - fix bogus right shift folding

This fixes the bogus use of TYPE_PRECISION on vector types
from optimizing -((int)x >> 31) into (unsigned)x >> 31.

2021-05-19  Richard Biener  <rguenther@suse.de>

PR middle-end/100672
* fold-const.c (fold_negate_expr_1): Use element_precision.
(negate_expr_p): Likewise.

* gcc.dg/torture/pr100672.c: New testcase.

(cherry picked from commit 8d51039cb7c807ed84ff7df5416a1e3ba07a5e63)

4 years agoDaily bump.
GCC Administrator [Fri, 25 Jun 2021 00:18:34 +0000 (00:18 +0000)] 
Daily bump.

4 years agoEmit .file 0 directive earlier in DWARF 5
Eric Botcazou [Thu, 24 Jun 2021 10:55:27 +0000 (12:55 +0200)] 
Emit .file 0 directive earlier in DWARF 5

When the assembler supports it, the compiler automatically passes --gdwarf-5
to it, which has an interesting side effect: any assembly instruction prior
to the first .file directive defines a new line associated with .file 0 in
the .debug_line section and of course the numbering of these implicit lines
has nothing to do with that of the source code.  This can be problematic in
Ada when we do not generate .file/.loc directives for compiled-generated
functions to avoid too jumpy a debugging experience.

gcc/
* dwarf2out.c (dwarf2out_assembly_start): Emit .file 0 marker here..
(dwarf2out_finish): ...instead of here.

4 years agoFix --gdwarf-5 configure tests for Windows
Eric Botcazou [Thu, 24 Jun 2021 10:53:24 +0000 (12:53 +0200)] 
Fix --gdwarf-5 configure tests for Windows

The issues are that 1) they use readelf instead of objdump and 2) they use
ELF syntax in the assembly code.

gcc/
* configure.ac (--gdwarf-5 option): Use objdump instead of readelf.
(working --gdwarf-4/--gdwarf-5 for all sources): Likewise.
(--gdwarf-4 not refusing generated .debug_line): Adjust for Windows.
* configure: Regenerate.

4 years agoFortran: fix sm computation in CFI_allocate [PR93524]
Sandra Loosemore [Tue, 22 Jun 2021 19:42:17 +0000 (12:42 -0700)] 
Fortran: fix sm computation in CFI_allocate [PR93524]

Backported from trunk.

This patch fixes a bug in setting the step multiplier field in the
C descriptor for array dimensions > 2.

2021-06-21  Sandra Loosemore  <sandra@codesourcery.com>
    Tobias Burnus  <tobias@codesourcery.com>

libgfortran/
PR fortran/93524
* runtime/ISO_Fortran_binding.c (CFI_allocate): Fix
sm computation.

gcc/testsuite/
PR fortran/93524
* gfortran.dg/pr93524.c: New.
* gfortran.dg/pr93524.f90: New.

4 years agoDaily bump.
GCC Administrator [Thu, 24 Jun 2021 00:18:21 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDo not enable pcrel-opt by default
Aaron Sawdey [Tue, 22 Jun 2021 21:02:15 +0000 (16:02 -0500)] 
Do not enable pcrel-opt by default

Backported from trunk.

SPEC2017 testing on p10 shows that this optimization does not have a
positive impact on performance. So we are no longer going to enable it
by default. The test cases for it needed to be updated so they always
enable it to test it.

gcc/

* config/rs6000/rs6000-cpus.def: Take OPTION_MASK_PCREL_OPT out
of OTHER_POWER10_MASKS so it will not be enabled by default.

gcc/testsuite/

* gcc.target/powerpc/pcrel-opt-inc-di.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-ld-df.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-ld-di.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-ld-hi.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-ld-qi.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-ld-sf.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-ld-si.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-ld-vector.c: Enable -mpcrel-opt to
test it.
* gcc.target/powerpc/pcrel-opt-st-df.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-st-di.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-st-hi.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-st-qi.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-st-sf.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-st-si.c: Enable -mpcrel-opt to test it.
* gcc.target/powerpc/pcrel-opt-st-vector.c: Enable -mpcrel-opt to
test it.

(cherry picked from commit b7574ca6edb5ac7fab741f46d4f50ac4294c8180)

4 years agoBackport patch from master branch.
Michael Meissner [Wed, 23 Jun 2021 19:00:16 +0000 (15:00 -0400)] 
Backport patch from master branch.

Add IEEE 128-bit min/max support on PowerPC.

This patch adds the support for the IEEE 128-bit floating point C minimum and
maximum instructions.  The next patch will add the support for using the
compare and set mask instruction to implement conditional moves.

This patch does not try to re-use the code used for SF/DF min/max
support.  It defines a separate insn for the IEEE 128-bit support.  It
uses the code iterator <minmax> to simplify adding both operations.

GCC will not convert ternary operations into using min/max instructions
provided in this patch unless the user uses -Ofast.  The next patch that adds
conditional move instructions will enable the ternary conversion in many cases.

gcc/
2021-06-23  Michael Meissner  <meissner@linux.ibm.com>

* config/rs6000/rs6000.c (rs6000_emit_minmax): Add support for ISA
3.1 IEEE 128-bit floating point xsmaxcqp/xsmincqp instructions.
* config/rs6000/rs6000.md (s<minmax><mode>3, IEEE128 iterator):
New insns.

gcc/testsuite/
2021-06-23  Michael Meissner  <meissner@linux.ibm.com>

* gcc.target/powerpc/float128-minmax-2.c: New test.

4 years agoi386: Prevent unwanted combine from LZCNT to BSR [PR101175]
Uros Bizjak [Wed, 23 Jun 2021 10:50:53 +0000 (12:50 +0200)] 
i386: Prevent unwanted combine from LZCNT to BSR [PR101175]

The current RTX pattern for BSR allows combine pass to convert LZCNT insn
to BSR. Note that the LZCNT has a defined behavior to return the operand
size when operand is zero, where BSR has not.

Add a BSR specific setting of zero-flag to RTX pattern of BSR insn
in order to avoid matching unwanted combinations.

2021-06-23  UroÅ¡ Bizjak  <ubizjak@gmail.com>

gcc/
PR target/101175
* config/i386/i386.md (bsr_rex64): Add zero-flag setting RTX.
(bsr): Ditto.
(*bsrhi): Remove.
(clz<mode>2): Update RTX pattern for additions.

gcc/testsuite/

PR target/101175
* gcc.target/i386/pr101175.c: New test.

(cherry picked from commit 1e16f2b472c7d253d564556a048dc4ae16119c00)

4 years agoopenmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs [PR101167]
Jakub Jelinek [Wed, 23 Jun 2021 08:03:28 +0000 (10:03 +0200)] 
openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs [PR101167]

The following testcase FAILs, because the UDR combiner is invoked incorrectly.
lower_omp_rec_clauses expects that when it sets
DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
for both the placeholder and the var that everything will be properly
regimplified, but as the variable in question is a PARM_DECL rather than
VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
and so it is not.

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

PR middle-end/101167
* omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.

* testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.

(cherry picked from commit 679506c3830ea1a93c755413609bfac3538e2cbd)

4 years agoinline-asm: Fix ICE with bitfields in "m" operands [PR100785]
Jakub Jelinek [Mon, 21 Jun 2021 11:30:42 +0000 (13:30 +0200)] 
inline-asm: Fix ICE with bitfields in "m" operands [PR100785]

Bitfields, while they live in memory, aren't something inline-asm can easily
operate on.
For C and "=m" or "+m", we were diagnosing bitfields in the past in the
FE, where c_mark_addressable had:
      case COMPONENT_REF:
        if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1)))
          {
            error
              ("cannot take address of bit-field %qD", TREE_OPERAND (x, 1));
            return false;
          }
but that check got moved in GCC 6 to build_unary_op instead and now we
emit an error during expansion and ICE afterwards (i.e. error-recovery).
For "m" it used to be diagnosed in c_mark_addressable too, but since
GCC 6 it is ice-on-invalid.
For C++, this was never diagnosed in the FE, but used to be diagnosed
in the gimplifier and/or during expansion before 4.8.

The following patch does multiple things:
1) diagnoses it in the FEs
2) simplifies during expansion the inline asm if any errors have been
   reported (similarly how e.g. vregs pass if it detects errors on
   inline-asm either deletes them or simplifies to bare minimum -
   just labels), so that we don't have error-recovery ICEs there

2021-06-11  Jakub Jelinek  <jakub@redhat.com>

PR inline-asm/100785
gcc/
* cfgexpand.c (expand_asm_stmt): If errors are emitted,
remove all inputs, outputs and clobbers from the asm and
set template to "".
gcc/c/
* c-typeck.c (c_mark_addressable): Diagnose trying to make
bit-fields addressable.
gcc/cp/
* typeck.c (cxx_mark_addressable): Diagnose trying to make
bit-fields addressable.
gcc/testsuite/
* c-c++-common/pr100785.c: New test.

(cherry picked from commit 644c2cc5f2c09506a7bfef293a7f90efa8d7e5fa)

4 years agoSync mklog.py from master.
Martin Liska [Wed, 23 Jun 2021 08:10:37 +0000 (10:10 +0200)] 
Sync mklog.py from master.

contrib/ChangeLog:

* mklog.py: Sync.
* test_mklog.py: Likewise.

4 years agocontrib: add git-commit-mklog wrapper
Martin Liska [Wed, 23 Jun 2021 07:44:34 +0000 (09:44 +0200)] 
contrib: add git-commit-mklog wrapper

contrib/ChangeLog:

* gcc-git-customization.sh: Use the new wrapper.
* git-commit-mklog.py: New file.
* prepare-commit-msg: Support GCC_MKLOG_ARGS.

4 years agoDaily bump.
GCC Administrator [Wed, 23 Jun 2021 00:18:00 +0000 (00:18 +0000)] 
Daily bump.

4 years agolibstdc++: Fix for deadlock in std::counting_semaphore [PR100806]
Thomas Rodgers [Tue, 22 Jun 2021 17:59:07 +0000 (10:59 -0700)] 
libstdc++: Fix for deadlock in std::counting_semaphore [PR100806]

libstdc++-v3/ChangeLog:
PR libstdc++/100806
* include/bits/semaphore_base.h (__atomic_semaphore::_M_release):
Force _M_release() to wake all waiting threads.
* testsuite/30_threads/semaphore/100806.cc: New test.

(cherry picked from commit e02840c1a92abecd211ffaf05b28329bcb534583)

4 years agoFix ICE for vpexpand*.
liuhongt [Wed, 28 Apr 2021 06:52:59 +0000 (14:52 +0800)] 
Fix ICE for vpexpand*.

gcc/ChangeLog

PR target/100310
* config/i386/i386-expand.c
(ix86_expand_special_args_builtin): Keep constm1_operand only
if it satisfies insn's operand predicate.

gcc/testsuite/ChangeLog

PR target/100310
* gcc.target/i386/pr100310.c: New test.

4 years agoDaily bump.
GCC Administrator [Tue, 22 Jun 2021 00:18:08 +0000 (00:18 +0000)] 
Daily bump.

4 years agoRS6000 Add 128-bit Binary Integer sign extend operations
Carl Love [Tue, 15 Jun 2021 16:37:31 +0000 (11:37 -0500)] 
RS6000 Add 128-bit Binary Integer sign extend operations

This patch adds the 128-bit sign extension instruction support and
corresponding builtin support.

RS6000 Add 128-bit Binary Integer sign extend operations

2021-06-08  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

* config/rs6000/altivec.h (vec_signextll, vec_signexti, vec_signextq):
Add define for new builtins.
* config/rs6000/altivec.md(altivec_vreveti2): Add define_expand.
* config/rs6000/rs6000-builtin.def (VSIGNEXTI, VSIGNEXTLL):  Add
overloaded builtin definitions.
(VSIGNEXTSB2W, VSIGNEXTSH2W, VSIGNEXTSB2D, VSIGNEXTSH2D,VSIGNEXTSW2D,
VSIGNEXTSD2Q): Add builtin expansions.
(SIGNEXT): Add P10 overload definition.
* config/rs6000/rs6000-call.c (P9V_BUILTIN_VEC_VSIGNEXTI,
P9V_BUILTIN_VEC_VSIGNEXTLL, P10_BUILTIN_VEC_SIGNEXT): Add
overloaded argument definitions.
* config/rs6000/vsx.md (vsx_sign_extend_v2di_v1ti): Add define_insn.
(vsignextend_v2di_v1ti, vsignextend_qi_<mode>, vsignextend_hi_<mode>,
vsignextend_si_v2di)[VIlong]: Add define_expand.
Make define_insn vsx_sign_extend_si_v2di visible.
* doc/extend.texi:  Add documentation for the vec_signexti,
vec_signextll builtins and vec_signextq.

gcc/testsuite/ChangeLog

* gcc.target/powerpc/int_128bit-runnable.c (extsd2q): Update expected
count.
Add tests for vec_signextq.
* gcc.target/powerpc/p9-sign_extend-runnable.c:  New test case.

4 years agoConversions between 128-bit integer and floating point values.
Carl Love [Wed, 21 Apr 2021 22:07:39 +0000 (18:07 -0400)] 
Conversions between 128-bit integer and floating point values.

The files fixkfti-sw.c and fixunskfti-sw.c are renamed versions of
fixkfti.c and fixunskfti.c respectively to do the conversions in software.
The function names in the files were updated with the rename as well as
some white spaces fixes. The file float128-p10.c contains the functions
for using the ISA 3.1 hardware instructions to perform the conversions.

2021-06-15  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

* config/rs6000/rs6000.c (__fixkfti, __fixunskfti, __floattikf,
__floatuntikf): Names changed to __fixkfti_sw, __fixunskfti_sw,
__floattikf_sw, __floatuntikf_sw respectively.
* config/rs6000/rs6000.md (floatti<mode>2, floatunsti<mode>2,
fix_trunc<mode>ti2, fixuns_trunc<mode>ti2): Add
define_insn for mode IEEE 128.

gcc/testsuite/ChangeLog

* gcc.target/powerpc/fp128_conversions.c: New file.
* gcc.target/powerpc/int_128bit-runnable.c(vextsd2q,
vcmpuq, vcmpsq, vcmpequq, vcmpequq., vcmpgtsq, vcmpgtsq.
vcmpgtuq, vcmpgtuq.): Update scan-assembler-times.
(ppc_native_128bit): Remove dg-require-effective-target.

libgcc/ChangeLog

* config.host: Add if test and set for
libgcc_cv_powerpc_3_1_float128_hw.
* config/rs6000/fixkfti.c: Renamed to fixkfti-sw.c.
Change calls of __fixkfti to __fixkfti_sw.
* config/rs6000/fixunskfti.c: Renamed to fixunskfti-sw.c.
Change calls of __fixunskfti to __fixunskfti_sw.
* config/rs6000/float128-p10.c (__floattikf_hw,
__floatuntikf_hw, __fixkfti_hw, __fixunskfti_hw): New file.
* config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): New macro.
(__floattikf_resolve, __floatuntikf_resolve, __fixkfti_resolve,
__fixunskfti_resolve): Add resolve functions.
(__floattikf, __floatuntikf, __fixkfti, __fixunskfti): New functions.
* config/rs6000/float128-sed (floattitf, __floatuntitf,
__fixtfti, __fixunstfti): Add editor commands to change names.
* config/rs6000/float128-sed-hw (__floattitf,
__floatuntitf, __fixtfti, __fixunstfti): Add editor commands to
change names.
* config/rs6000/floattikf.c: Renamed to floattikf-sw.c.
* config/rs6000/floatuntikf.c: Renamed to floatuntikf-sw.c.
* config/rs6000/quad-float128.h (__floattikf_sw,
__floatuntikf_sw, __fixkfti_sw, __fixunskfti_sw, __floattikf_hw,
__floatuntikf_hw, __fixkfti_hw, __fixunskfti_hw, __floattikf,
__floatuntikf, __fixkfti, __fixunskfti): New extern declarations.
* config/rs6000/t-float128 (floattikf, floatuntikf,
fixkfti, fixunskfti): Remove file names from fp128_ppc_funcs.
(floattikf-sw, floatuntikf-sw, fixkfti-sw, fixunskfti-sw): Add
file names to fp128_ppc_funcs.
* config/rs6000/t-float128-hw(fp128_3_1_hw_funcs,
fp128_3_1_hw_src, fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj,
fp128_3_1_hw_obj): Add variables for ISA 3.1 support.
* config/rs6000/t-float128-p10-hw: New file.
* configure: Update script for isa 3.1 128-bit float support.
* configure.ac: Add check for 128-bit float hardware support.

4 years agors6000, Add test 128-bit shifts for just the int128 type.
Carl Love [Wed, 16 Sep 2020 21:05:49 +0000 (16:05 -0500)] 
rs6000, Add test 128-bit shifts for just the int128 type.

This patch also renames and moves the VSX_TI iterator from vsx.md to
VEC_TI in vector.md.  The uses of VEC_TI are also updated.

2021-04-29  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

* config/rs6000/altivec.md (altivec_vslq, altivec_vsrq):
Rename to altivec_vslq_<mode>, altivec_vsrq_<mode>, mode VEC_TI.
* config/rs6000/vector.md (VEC_TI): Was named VSX_TI in vsx.md.
(vashlv1ti3): Change to vashl<mode>3, mode VEC_TI.
(vlshrv1ti3): Change to vlshr<mode>3, mode VEC_TI.
* config/rs6000/vsx.md (VSX_TI): Remove define_mode_iterator. Update
uses of VSX_TI to VEC_TI.

gcc/testsuite/ChangeLog

* gcc.target/powerpc/int_128bit-runnable.c: Add shift_right, shift_left
tests.

4 years agoAdd 128-bit int to 128-bit DFP (floattitd2) and 128-bit DFP to 128-bit int (fixtdti2...
Carl Love [Wed, 25 Nov 2020 00:18:05 +0000 (18:18 -0600)] 
Add 128-bit int to 128-bit DFP (floattitd2) and 128-bit DFP to 128-bit int (fixtdti2) support

2021-06-08  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

* config/rs6000/dfp.md (floattitd2, fixtdti2): New define_insns.

gcc/testsuite/ChangeLog

* gcc.target/powerpc/int_128bit-runnable.c: Add 128-bit DFP
conversion tests.

4 years agoRS6000 add 128-bit Integer Operations part 1
Carl Love [Tue, 15 Jun 2021 16:30:18 +0000 (11:30 -0500)] 
RS6000 add 128-bit Integer Operations part 1

2021-06-015  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

* config/rs6000/altivec.h (vec_dive, vec_mod): Add define for new
builtins.
* config/rs6000/altivec.md (UNSPEC_VMULEUD, UNSPEC_VMULESD,
UNSPEC_VMULOUD, UNSPEC_VMULOSD): New unspecs.
(altivec_eqv1ti, altivec_gtv1ti, altivec_gtuv1ti, altivec_vmuleud,
altivec_vmuloud, altivec_vmulesd, altivec_vmulosd, altivec_vrlq,
altivec_vrlqmi, altivec_vrlqmi_inst, altivec_vrlqnm,
altivec_vrlqnm_inst, altivec_vslq, altivec_vsrq, altivec_vsraq,
altivec_vcmpequt_p, altivec_vcmpgtst_p, altivec_vcmpgtut_p): New
define_insn.
(vec_widen_umult_even_v2di, vec_widen_smult_even_v2di,
vec_widen_umult_odd_v2di, vec_widen_smult_odd_v2di, altivec_vrlqmi,
altivec_vrlqnm): New define_expands.
* config/rs6000/rs6000-builtin.def (VCMPEQUT_P, VCMPGTST_P,
VCMPGTUT_P): Add macro expansions.
(BU_P10V_AV_P): Add builtin predicate definition.
(VCMPGTUT, VCMPGTST, VCMPEQUT, CMPNET, CMPGE_1TI,
CMPGE_U1TI, CMPLE_1TI, CMPLE_U1TI, VNOR_V1TI_UNS, VNOR_V1TI, VCMPNET_P,
VCMPAET_P, VMULEUD, VMULESD, VMULOUD, VMULOSD, VRLQ,
VSLQ, VSRQ, VSRAQ, VRLQNM, DIV_V1TI, UDIV_V1TI, DIVES_V1TI, DIVEU_V1TI,
MODS_V1TI, MODU_V1TI, VRLQMI): New macro expansions.
(VRLQ, VSLQ, VSRQ, VSRAQ, DIVE, MOD): New overload expansions.
* config/rs6000/rs6000-call.c (P10_BUILTIN_VCMPEQUT,
P10V_BUILTIN_CMPGE_1TI, P10V_BUILTIN_CMPGE_U1TI,
P10V_BUILTIN_VCMPGTUT, P10V_BUILTIN_VCMPGTST,
P10V_BUILTIN_CMPLE_1TI, P10V_BUILTIN_VCMPLE_U1TI,
P10V_BUILTIN_DIV_V1TI, P10V_BUILTIN_UDIV_V1TI,
P10V_BUILTIN_VMULESD, P10V_BUILTIN_VMULEUD,
P10V_BUILTIN_VMULOSD, P10V_BUILTIN_VMULOUD,
P10V_BUILTIN_VNOR_V1TI, P10V_BUILTIN_VNOR_V1TI_UNS,
P10V_BUILTIN_VRLQ, P10V_BUILTIN_VRLQMI,
P10V_BUILTIN_VRLQNM, P10V_BUILTIN_VSLQ,
P10V_BUILTIN_VSRQ, P10V_BUILTIN_VSRAQ,
P10V_BUILTIN_VCMPGTUT_P, P10V_BUILTIN_VCMPGTST_P,
P10V_BUILTIN_VCMPEQUT_P, P10V_BUILTIN_VCMPGTUT_P,
P10V_BUILTIN_VCMPGTST_P, P10V_BUILTIN_CMPNET,
P10V_BUILTIN_VCMPNET_P, P10V_BUILTIN_VCMPAET_P,
P10V_BUILTIN_DIVES_V1TI, P10V_BUILTIN_MODS_V1TI,
P10V_BUILTIN_MODU_V1TI):
New overloaded definitions.
(rs6000_gimple_fold_builtin) [P10V_BUILTIN_VCMPEQUT,
P10V_BUILTIN_CMPNET, P10V_BUILTIN_CMPGE_1TI,
P10V_BUILTIN_CMPGE_U1TI, P10V_BUILTIN_VCMPGTUT,
P10V_BUILTIN_VCMPGTST, P10V_BUILTIN_CMPLE_1TI,
P10V_BUILTIN_CMPLE_U1TI]: New case statements.
(rs6000_init_builtins) [bool_V1TI_type_node, int_ftype_int_v1ti_v1ti]:
New assignments.
(altivec_init_builtins): New E_V1TImode case statement.
(builtin_function_type)[P10_BUILTIN_128BIT_VMULEUD,
P10_BUILTIN_128BIT_VMULOUD, P10_BUILTIN_128BIT_DIVEU_V1TI,
P10_BUILTIN_128BIT_MODU_V1TI, P10_BUILTIN_CMPGE_U1TI,
P10_BUILTIN_VCMPGTUT, P10_BUILTIN_VCMPEQUT]: New case statements.
* config/rs6000/rs6000.c (rs6000_handle_altivec_attribute) [E_TImode,
E_V1TImode]: New case statements.
* config/rs6000/rs6000.h (rs6000_builtin_type_index): New enum
value RS6000_BTI_bool_V1TI.
* config/rs6000/vector.md (vector_gtv1ti,vector_nltv1ti,
vector_gtuv1ti, vector_nltuv1ti, vector_ngtv1ti, vector_ngtuv1ti,
vector_eq_v1ti_p, vector_ne_v1ti_p, vector_ae_v1ti_p,
vector_gt_v1ti_p, vector_gtu_v1ti_p, vrotlv1ti3, vashlv1ti3,
vlshrv1ti3, vashrv1ti3): New define_expands.
* config/rs6000/vsx.md (UNSPEC_VSX_DIVSQ, UNSPEC_VSX_DIVUQ,
UNSPEC_VSX_DIVESQ, UNSPEC_VSX_DIVEUQ, UNSPEC_VSX_MODSQ,
UNSPEC_VSX_MODUQ): New unspecs.
(mulv2di3, vsx_div_v1ti, vsx_udiv_v1ti, vsx_dives_v1ti,
vsx_diveu_v1ti, vsx_mods_v1ti, vsx_modu_v1ti, xxswapd_v1ti): New
define_insns.
(vcmpnet): New define_expand.
* doc/extend.texi: Add documentation for the new builtins vec_rl,
vec_rlmi, vec_rlnm, vec_sl, vec_sr, vec_sra, vec_mule, vec_mulo,
vec_div, vec_dive, vec_mod, vec_cmpeq, vec_cmpne, vec_cmpgt, vec_cmplt,
vec_cmpge, vec_cmple, vec_all_eq, vec_all_ne, vec_all_gt, vec_all_lt,
vec_all_ge, vec_all_le, vec_any_eq, vec_any_ne, vec_any_gt, vec_any_lt,
vec_any_ge, vec_any_le.

gcc/testsuite/ChangeLog

* gcc.target/powerpc/int_128bit-runnable.c: New test file.

4 years agors6000, Fix arguments in altivec_vrlwmi and altivec_rlwdi builtins
Carl Love [Tue, 15 Jun 2021 16:24:56 +0000 (11:24 -0500)] 
rs6000, Fix arguments in altivec_vrlwmi and altivec_rlwdi builtins

2021-06-07  Carl Love  <cel@us.ibm.com>

gcc/
* config/rs6000/altivec.md (altivec_vrl<VI_char>mi): Fix
bug in argument generation.

gcc/testsuite/
* gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c:
New runnable test case.
* gcc.target/powerpc/vec-rlmi-rlnm.c: Update scan assembler times
for xxlor instruction.

4 years agoc++: deleted after first declaration [PR101106]
Jason Merrill [Thu, 17 Jun 2021 19:31:15 +0000 (15:31 -0400)] 
c++: deleted after first declaration [PR101106]

An explicitly deleted function must be deleted on its first declaration.  We
were diagnosing this error only with -Wpedantic, but always giving the
"previous declaration" note.  For GCC 11, keep the -Wpedantic dependency,
just make the note depend on the previous diagnostic.

PR c++/101106

gcc/cp/ChangeLog:

* decl.c (duplicate_decls): Condition note on return value of pedwarn.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/deleted15.C: New test.

4 years agoc++: remove redundant warning [PR100879]
Jason Merrill [Tue, 8 Jun 2021 21:48:49 +0000 (17:48 -0400)] 
c++: remove redundant warning [PR100879]

Before my r277864, build_new_op promoted enums to int before passing them on
to cp_build_binary_op; after that commit, it doesn't, so
warn_for_sign_compare sees the enum operands and gives a redundant warning.
This warning dates back to 1995, and seems to have been dead code for a long
time--likely since build_new_op was added in 1997--so let's just remove it.

PR c++/100879

gcc/c-family/ChangeLog:

* c-warn.c (warn_for_sign_compare): Remove C++ enum mismatch
warning.

gcc/testsuite/ChangeLog:

* g++.dg/diagnostic/enum3.C: New test.

4 years agoFix p10 fusion regtests
Aaron Sawdey [Fri, 18 Jun 2021 17:47:03 +0000 (12:47 -0500)] 
Fix p10 fusion regtests

Backported from trunk.

Update the count of matches for the fusion combine patterns after
the recent changes to them.  At Segher's request, used \m and \M
in the match patterns. Also I have grouped together all alternatives of
each fusion insn, which should hopefully make this test a little less
fragile.

gcc/testsuite/ChangeLog

* gcc.target/powerpc/fusion-p10-2logical.c: Update pattern
match counts.
* gcc.target/powerpc/fusion-p10-addadd.c: Update pattern match
counts.
* gcc.target/powerpc/fusion-p10-ldcmpi.c: Update pattern match
counts.
* gcc.target/powerpc/fusion-p10-logadd.c: Update pattern match
counts.

(cherry picked from commit a798b3f15c47be55f535b754932a820b858870a8)

4 years agoDaily bump.
GCC Administrator [Mon, 21 Jun 2021 00:17:57 +0000 (00:17 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 20 Jun 2021 00:18:03 +0000 (00:18 +0000)] 
Daily bump.

4 years agoFortran - fix conversion to result type for the min/max intrinsic
Harald Anlauf [Fri, 18 Jun 2021 17:34:15 +0000 (19:34 +0200)] 
Fortran - fix conversion to result type for the min/max intrinsic

gcc/fortran/ChangeLog:

PR fortran/100283
PR fortran/101123
* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Unconditionally
convert result of min/max to result type.

gcc/testsuite/ChangeLog:

PR fortran/100283
PR fortran/101123
* gfortran.dg/min0_max0_1.f90: New test.
* gfortran.dg/min0_max0_2.f90: New test.

(cherry picked from commit 6fc543396345900f460c9fa7121239cb1ebbc3a3)

4 years agoDaily bump.
GCC Administrator [Sat, 19 Jun 2021 00:18:23 +0000 (00:18 +0000)] 
Daily bump.

4 years agoFortran - ICE in gfc_check_do_variable, at fortran/parse.c:4446
Harald Anlauf [Wed, 16 Jun 2021 20:04:22 +0000 (22:04 +0200)] 
Fortran - ICE in gfc_check_do_variable, at fortran/parse.c:4446

Avoid NULL pointer dereferences during error recovery.

gcc/fortran/ChangeLog:

PR fortran/95501
PR fortran/95502
* expr.c (gfc_check_pointer_assign): Avoid NULL pointer
dereference.
* match.c (gfc_match_pointer_assignment): Likewise.
* parse.c (gfc_check_do_variable): Avoid comparison with NULL
symtree.

gcc/testsuite/ChangeLog:

PR fortran/95501
PR fortran/95502
* gfortran.dg/pr95502.f90: New test.

(cherry picked from commit cfe0a2ec26867b290eb84af00317e60f8b67455c)

4 years agolibstdc++: Replace incorrect static assertion in std::reduce [PR95833]
Jonathan Wakely [Fri, 18 Jun 2021 13:46:58 +0000 (14:46 +0100)] 
libstdc++: Replace incorrect static assertion in std::reduce [PR95833]

The standard does not require the iterator's value type to be
convertible to the result type, it only requires that the result of
dereferencing the iterator can be passed to the binary function.

libstdc++-v3/ChangeLog:

PR libstdc++/95833
* include/std/numeric (reduce(Iter, Iter, T, BinaryOp)): Replace
incorrect static_assert with ones matching the 'Mandates'
conditions in the standard.
* testsuite/26_numerics/reduce/95833.cc: New test.

(cherry picked from commit 0532452dcd17910dfd3d2b0df50dfe3ef1194bf7)

4 years agoarm: Fix multilib mapping for CDE extensions [PR100856].
Srinath Parvathaneni [Fri, 18 Jun 2021 12:21:51 +0000 (13:21 +0100)] 
arm: Fix multilib mapping for CDE extensions [PR100856].

On passing +cdecp[0-7] extension to the -march string in command line options,
multilib linking is failing as mentioned in PR100856. This patch fixes this issue by
generating a separate canonical string by removing compiler options which are not
required for multilib linking from march string and assign the new string to mlibarch
option. This mlibarch string is used for multilib comparison.

gcc/ChangeLog:

2021-06-10  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/100856
* common/config/arm/arm-common.c (arm_canon_arch_option_1): New function
derived from arm_canon_arch.
(arm_canon_arch_option): Call it.
(arm_canon_arch_multilib_option): New function.
* config/arm/arm-cpus.in (IGNORE_FOR_MULTILIB): New fgroup.
* config/arm/arm.h (arm_canon_arch_multilib_option): New prototype.
(CANON_ARCH_MULTILIB_SPEC_FUNCTION): New macro.
(MULTILIB_ARCH_CANONICAL_SPECS): New macro.
(DRIVER_SELF_SPECS): Add MULTILIB_ARCH_CANONICAL_SPECS.
* config/arm/arm.opt (mlibarch): New option.
* config/arm/t-rmprofile (MULTILIB_MATCHES): For armv8*-m, replace use
of march on RHS with mlibarch.

gcc/testsuite/ChangeLog:

2021-06-10  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/100856
* gcc.target/arm/acle/pr100856.c: New test.
* gcc.target/arm/multilib.exp: Add tests for cde options.

(cherry picked from commit f58d03b5df25f9eab06b7eacea8da780fc2e0219)

4 years agoarm: Fix polymorphic variants failing with undefined reference to `__ARM_undef` error.
Srinath Parvathaneni [Fri, 11 Jun 2021 17:11:58 +0000 (18:11 +0100)] 
arm: Fix polymorphic variants failing with undefined reference to `__ARM_undef` error.

This patch fixes the issue mentioned in PR101016, which is mve polymorphic variants
failing at linking with undefined reference to "__ARM_undef" error.

gcc/ChangeLog:

2021-06-11  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/101016
* config/arm/arm_mve.h (__arm_vld1q): Change __ARM_mve_coerce(p0,
int8_t const *) to __ARM_mve_coerce1(p0, int8_t *) in the argument for
the polymorphic variants matching code.
(__arm_vld1q_z): Likewise.
(__arm_vld2q): Likewise.
(__arm_vld4q): Likewise.
(__arm_vldrbq_gather_offset): Likewise.
(__arm_vldrbq_gather_offset_z): Likewise.

gcc/testsuite/ChangeLog:

2021-06-11  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/101016
* gcc.target/arm/mve/intrinsics/pr101016.c: New test.

(cherry picked from commit b13f297f01c943aa167f7c6eb94bed40dce0d553)

4 years agoarm: Fix the mve multilib for the broken cmse support (pr99939).
Srinath Parvathaneni [Fri, 11 Jun 2021 14:56:37 +0000 (15:56 +0100)] 
arm: Fix the mve multilib for the broken cmse support (pr99939).

The current CMSE support in the multilib build for
"-march=armv8.1-m.main+mve -mfloat-abi=hard -mfpu=auto" is broken
as specified in PR99939 and this patch fixes the issue.

gcc/testsuite/ChangeLog:

2021-06-11  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/99939
* gcc.target/arm/cmse/cmse-18.c: Add separate scan-assembler
directives check for target is v8.1-m.main+mve or not before
comparing the assembly output.
* gcc.target/arm/cmse/cmse-20.c: New test.

libgcc/ChangeLog:

2021-06-11  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/99939
* config/arm/cmse_nonsecure_call.S: Add __ARM_FEATURE_MVE
macro.
* config/arm/t-arm: To link cmse.o and cmse_nonsecure_call.o
on passing -mcmse option.

(cherry picked from commit c5ed0148347beea1bd34795de146adddd2454c36)

4 years agolibstdc++: Suppress -Wstringop-overread warning in test
Jonathan Wakely [Fri, 18 Jun 2021 10:08:19 +0000 (11:08 +0100)] 
libstdc++: Suppress -Wstringop-overread warning in test

When compiled with -m32 -O2 -D_GLIBCXX_USE_CXX11_ABI=0 we get a warning
for 21_strings/basic_string/cons/char/1.cc:

bits/char_traits.h:409:56: warning: â€˜void* __builtin_memcpy(void*, const void*, unsigned int)’ reading 1073741821 bytes from a region of size 19 [-Wstringop-overread]

The warning is legitimate, even if that line cannot be reached because
we throw std::length_error before getting there. Since the invalid
length is deliberate (and mentioned in a comment) just suppress the
warning, so that the test can verify we get the exception.

Also remove an unused typedef that produces another warning.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/basic_string/cons/char/1.cc: Use
diagnostic pragma to suppress -Wstringop-overread error.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
(cherry picked from commit 92edc4a7684cdad5d30e197b976c35b2257f7bed)

4 years agolibstdc++: Simplify constexpr checks in std::char_traits [PR 91488]
Jonathan Wakely [Thu, 17 Jun 2021 13:11:22 +0000 (14:11 +0100)] 
libstdc++: Simplify constexpr checks in std::char_traits [PR 91488]

This removes the 'static' keyword from the helper functions added by
r8-1294 to detect whether the char_traits member functions can be
evaluated at compile time. This prevents the "inlining failed" error
reported in the PR.

The new testcase from the PR is added to the libitm testsuite, because
that's where we can be sure it's OK to use the -fgnu-tm option.

As a drive-by fix, the feature test macros for C++20 P0980R1 support are
made to depend on whether __cpp_lib_is_constant_evaluated is defined.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/91488

libstdc++-v3/ChangeLog:

* include/bits/basic_string.h (__cpp_lib_constexpr_string): Only
define C++20 value when std::is_constant_evaluated is available.
* include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
Likewise.
(__constant_string_p, __constant_array_p): Give external
linkage.
* include/std/version (__cpp_lib_constexpr_char_traits)
(__cpp_lib_constexpr_string): Only define C++20 values when
is_constant_evaluated is available.

libitm/ChangeLog:

* testsuite/libitm.c++/libstdc++-pr91488.C: New test.

(cherry picked from commit b376b1ef38971b84975ad1540bf5d2ae0b924e76)

4 years agostor-layout: Don't create DECL_BIT_FIELD_REPRESENTATIVE for QUAL_UNION_TYPE [PR101062]
Jakub Jelinek [Fri, 18 Jun 2021 09:20:40 +0000 (11:20 +0200)] 
stor-layout: Don't create DECL_BIT_FIELD_REPRESENTATIVE for QUAL_UNION_TYPE [PR101062]

> The following patch does create them, but treats all such bitfields as if
> they were in a structure where the particular bitfield is the only field.

While the patch passed bootstrap/regtest on the trunk, when trying to
backport it to 11 branch the bootstrap failed with
atree.ads:3844:34: size for "Node_Record" too small
errors.  Turns out the error is not about size being too small, but actually
about size being non-constant, and comes from:
 /* In a FIELD_DECL of a RECORD_TYPE, this is a pointer to the storage
    representative FIELD_DECL.  */
 #define DECL_BIT_FIELD_REPRESENTATIVE(NODE) \
   (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)

 /* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which
    if nonzero, indicates that the field occupies the type.  */
  #define DECL_QUALIFIER(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)
so by setting up DECL_BIT_FIELD_REPRESENTATIVE in QUAL_UNION_TYPE we
actually set or modify DECL_QUALIFIER and then construct size as COND_EXPRs
with those bit field representatives (e.g. with array type) as conditions
which doesn't fold into constant.

The following patch fixes it by not creating DECL_BIT_FIELD_REPRESENTATIVEs
for QUAL_UNION_TYPE as there is nowhere to store them,

Shall we change tree.h to document that DECL_BIT_FIELD_REPRESENTATIVE
is valid also on UNION_TYPE?
I see:
tree-ssa-alias.c-  if (TREE_CODE (type1) == RECORD_TYPE
tree-ssa-alias.c:      && DECL_BIT_FIELD_REPRESENTATIVE (field1))
tree-ssa-alias.c:    field1 = DECL_BIT_FIELD_REPRESENTATIVE (field1);
tree-ssa-alias.c-  if (TREE_CODE (type2) == RECORD_TYPE
tree-ssa-alias.c:      && DECL_BIT_FIELD_REPRESENTATIVE (field2))
tree-ssa-alias.c:    field2 = DECL_BIT_FIELD_REPRESENTATIVE (field2);
Shall we change that to || == UNION_TYPE or do we assume all fields
are overlapping in a UNION_TYPE already?
At other spots (asan, ubsan, expr.c) it is unclear what will happen
if they see a QUAL_UNION_TYPE with a DECL_QUALIFIER (or does the Ada FE
lower that somehow)?

2021-06-18  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/101062
* stor-layout.c (finish_bitfield_layout): Don't add bitfield
representatives in QUAL_UNION_TYPE.

4 years agostor-layout: Create DECL_BIT_FIELD_REPRESENTATIVE even for bitfields in unions [PR101062]
Jakub Jelinek [Wed, 16 Jun 2021 10:17:55 +0000 (12:17 +0200)] 
stor-layout: Create DECL_BIT_FIELD_REPRESENTATIVE even for bitfields in unions [PR101062]

The following testcase is miscompiled on x86_64-linux, the bitfield store
is implemented as a RMW 64-bit operation at d+24 when the d variable has
size of only 28 bytes and scheduling moves in between the R and W part
a store to a different variable that happens to be right after the d
variable.

The reason for this is that we weren't creating
DECL_BIT_FIELD_REPRESENTATIVEs for bitfields in unions.

The following patch does create them, but treats all such bitfields as if
they were in a structure where the particular bitfield is the only field.

2021-06-16  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/101062
* stor-layout.c (finish_bitfield_representative): For fields in unions
assume nextf is always NULL.
(finish_bitfield_layout): Compute bit field representatives also in
unions, but handle it as if each bitfield was the only field in the
aggregate.

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

(cherry picked from commit b4b50bf2864e09f028a39a3f460222632c4d7348)

4 years agolibstdc++: Non-triv-copyable extra args aren't simple [PR100940]
Patrick Palka [Thu, 17 Jun 2021 13:46:07 +0000 (09:46 -0400)] 
libstdc++: Non-triv-copyable extra args aren't simple [PR100940]

This force-enables perfect forwarding call wrapper semantics whenever
the extra arguments of a partially applied range adaptor aren't all
trivially copyable, so as to avoid incurring unnecessary copies of
potentially expensive-to-copy objects (such as std::function objects)
when invoking the adaptor.

PR libstdc++/100940

libstdc++-v3/ChangeLog:

* include/std/ranges (__adaptor::_Partial): For the "simple"
forwarding partial specializations, also require that
the extra arguments are trivially copyable.
* testsuite/std/ranges/adaptors/100577.cc (test04): New test.

(cherry picked from commit 2b87f3318cf6334a3a42dcf27f2fdec0fce04665)

4 years agolibstdc++: Refine range adaptors' "simple extra args" mechanism [PR100940]
Patrick Palka [Thu, 17 Jun 2021 13:46:04 +0000 (09:46 -0400)] 
libstdc++: Refine range adaptors' "simple extra args" mechanism [PR100940]

The _S_has_simple_extra_args mechanism is used to simplify forwarding
of range adaptor's extra arguments when perfect forwarding call wrapper
semantics isn't required for correctness, on a per-adaptor basis.
Both views::take and views::drop are flagged as such, but it turns out
perfect forwarding semantics are needed for these adaptors in some
contrived cases, e.g. when their extra argument is a move-only class
that's implicitly convertible to an integral type.

To fix this, we could just clear the flag for views::take/drop as with
views::split, but that'd come at the cost of acceptable diagnostics
for ill-formed uses of these adaptors (see PR100577).

This patch instead allows adaptors to parameterize their
_S_has_simple_extra_args flag according the types of the captured extra
arguments, so that we could conditionally disable perfect forwarding
semantics only when the types of the extra arguments permit it.  We
then use this finer-grained mechanism to safely disable perfect
forwarding semantics for views::take/drop when the extra argument is
integer-like, rather than incorrectly always disabling it.  Similarly,
for views::split, rather than always enabling perfect forwarding
semantics we now safely disable it when the extra argument is a scalar
or a view, and recover good diagnostics for these common cases.

PR libstdc++/100940

libstdc++-v3/ChangeLog:

* include/std/ranges (__adaptor::_RangeAdaptor): Document the
template form of _S_has_simple_extra_args.
(__adaptor::__adaptor_has_simple_extra_args): Add _Args template
parameter pack.  Try to treat _S_has_simple_extra_args as a
variable template parameterized by _Args.
(__adaptor::_Partial): Pass _Arg/_Args to the constraint
__adaptor_has_simple_extra_args.
(views::_Take::_S_has_simple_extra_args): Templatize according
to the type of the extra argument.
(views::_Drop::_S_has_simple_extra_args): Likewise.
(views::_Split::_S_has_simple_extra_args): Define.
* testsuite/std/ranges/adaptors/100577.cc (test01, test02):
Adjust after changes to _S_has_simple_extra_args mechanism.
(test03): Define.

(cherry picked from commit 0f4a2fb44dad6c9c140226fc19ed16109b85e6f4)

4 years agoDaily bump.
GCC Administrator [Fri, 18 Jun 2021 00:18:48 +0000 (00:18 +0000)] 
Daily bump.

4 years agors6000: MMA builtin usage ICEs when used in a #pragma omp parallel and using -fopenmp...
Peter Bergner [Mon, 14 Jun 2021 21:55:18 +0000 (16:55 -0500)] 
rs6000: MMA builtin usage ICEs when used in a #pragma omp parallel and using -fopenmp [PR100777]

Using an MMA builtin within an openmp parallel code block, leads to an SSA
verification ICE on the temporaries we create while expanding the MMA builtins
at gimple time.  The solution is to use create_tmp_reg_or_ssa_name(), which
knows when to create either an SSA or register temporary.

2021-06-14  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/100777
* config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Use
create_tmp_reg_or_ssa_name().

gcc/testsuite/
PR target/100777
* gcc.target/powerpc/pr100777.c: New test.

(cherry picked from commit 20073534c0ccca0a4e079c053ee0874af10b2ea0)

4 years agors6000: Add new __builtin_vsx_build_pair and __builtin_mma_build_acc built-ins
Peter Bergner [Thu, 10 Jun 2021 18:54:12 +0000 (13:54 -0500)] 
rs6000: Add new __builtin_vsx_build_pair and __builtin_mma_build_acc built-ins

The __builtin_vsx_assemble_pair and __builtin_mma_assemble_acc built-ins
currently assign their first source operand to the first VSX register
in a pair/quad, their second operand to the second register in a pair/quad, etc.
This is not endian friendly and forces the user to generate different calls
depending on endianness.  In agreement with the POWER LLVM team, we've
decided to lightly deprecate the assemble built-ins and replace them with
"build" built-ins that automatically handle endianness so the same built-in
call and be used for both little-endian and big-endian compiles.  We are not
removing the assemble built-ins, since there is code in the wild that use
them, but we are removing their documentation to encourage the use of the
new "build" variants.

gcc/
* config/rs6000/rs6000-builtin.def (build_pair): New built-in.
(build_acc): Likewise.
* config/rs6000/rs6000-call.c (mma_expand_builtin): Swap assemble
source operands in little-endian mode.
(rs6000_gimple_fold_mma_builtin): Handle VSX_BUILTIN_BUILD_PAIR.
(mma_init_builtins): Likewise.
* config/rs6000/rs6000.c (rs6000_split_multireg_move): Handle endianness
ordering for the MMA assemble and build source operands.
* doc/extend.texi (__builtin_vsx_build_acc, __builtin_mma_build_pair):
Document.
(__builtin_mma_assemble_acc, __builtin_mma_assemble_pair): Remove
documentation.

gcc/testsuite/
* gcc.target/powerpc/mma-builtin-4.c (__builtin_vsx_build_pair): Add
tests.  Update expected counts.
* gcc.target/powerpc/mma-builtin-5.c (__builtin_mma_build_acc): Add
tests.  Update expected counts.

(cherry picked from commit 00d07ec6e12451acc7a290cd93be03bed50cb666)

4 years agors6000: MMA test case ICEs using -O3 [PR99842]
Peter Bergner [Mon, 31 May 2021 03:45:55 +0000 (22:45 -0500)] 
rs6000: MMA test case ICEs using -O3 [PR99842]

The mma_assemble_input_operand predicate does not accept reg+reg indexed
addresses which can lead to ICEs.  The lxv and lxvp instructions have
indexed forms (lxvx and lxvpx), so the simple solution is to just allow
indexed addresses in the predicate.

2021-05-30  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/99842
* config/rs6000/predicates.md(mma_assemble_input_operand): Allow
indexed form addresses.

gcc/testsuite/
PR target/99842
* g++.target/powerpc/pr99842.C: New.

(cherry picked from commit df4e0359dad239854af0ea9eacb8e7e3719557d0)

4 years agoBackported from trunk:
Martin Sebor [Thu, 17 Jun 2021 18:22:28 +0000 (12:22 -0600)] 
Backported from trunk:

Consider size_t mangling as unsigned int and long [PR100876].

gcc/ChangeLog:

PR middle-end/100876
* builtins.c: (gimple_call_return_array): Account for size_t
mangling as either unsigned int or unsigned long

4 years agoBackported from trunk:
Martin Sebor [Thu, 17 Jun 2021 18:18:53 +0000 (12:18 -0600)] 
Backported from trunk:

Teach compute_objsize about placement new [PR100876].

Resolves:
PR c++/100876 - -Wmismatched-new-delete should understand placement new when it's not inlined

gcc/ChangeLog:

PR c++/100876
* builtins.c (gimple_call_return_array): Check for attribute fn spec.
Handle calls to placement new.
(ndecl_dealloc_argno): Avoid placement delete.

gcc/testsuite/ChangeLog:

PR c++/100876
* g++.dg/warn/Wmismatched-new-delete-4.C: New test.
* g++.dg/warn/Wmismatched-new-delete-5.C: New test.
* g++.dg/warn/Wstringop-overflow-7.C: New test.
* g++.dg/warn/Wfree-nonheap-object-6.C: New test.
* g++.dg/analyzer/placement-new.C: Prune out expected warning.

4 years agoPR c/100783 - ICE on -Wnonnull and erroneous type
Martin Sebor [Thu, 17 Jun 2021 18:17:02 +0000 (12:17 -0600)] 
PR c/100783 - ICE on -Wnonnull and erroneous type

gcc/c-family/ChangeLog:

PR c/100783
* c-attribs.c (positional_argument): Bail on erroneous types.

gcc/c/ChangeLog:

PR c/100783
* c-objc-common.c (print_type): Handle erroneous types.

gcc/testsuite/ChangeLog:

PR c/100783
* gcc.dg/nonnull-6.c: New test.

4 years agoBackported from trunk:
Martin Sebor [Thu, 17 Jun 2021 18:08:15 +0000 (12:08 -0600)] 
Backported from trunk:

PR middle-end/100732 - ICE on sprintf %s with integer argument

gcc/ChangeLog:

PR middle-end/100732
* gimple-fold.c (gimple_fold_builtin_sprintf): Avoid folding calls
with either source or destination argument of invalid type.
* tree-ssa-uninit.c (maybe_warn_pass_by_reference): Avoid checking
calls with arguments of invalid type.

gcc/testsuite/ChangeLog:

PR middle-end/100732
* gcc.dg/tree-ssa/builtin-snprintf-11.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-12.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-28.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-29.c: New test.
* gcc.dg/uninit-pr100732.c: New test.

4 years agoPR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda
Martin Sebor [Thu, 17 Jun 2021 18:01:38 +0000 (12:01 -0600)] 
PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda

gcc/ChangeLog:

PR middle-end/100684
* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Handle C++ lambda.

gcc/testsuite/ChangeLog:

PR middle-end/100684
* g++.dg/warn/Wnonnull13.C: New test.
* g++.dg/warn/Wnonnull14.C: New test.
* g++.dg/warn/Wnonnull15.C: New test.

4 years agoBackported from trunk:
Martin Sebor [Thu, 17 Jun 2021 17:42:10 +0000 (11:42 -0600)] 
Backported from trunk:

PR c/100619 - ICE on a VLA parameter with too many dimensions

gcc/c-family/ChangeLog:

PR c/100619
* c-attribs.c (build_attr_access_from_parms): Handle arbitrarily many
bounds.

gcc/testsuite/ChangeLog:

PR c/100619
* gcc.dg/pr100619.c: New test.

4 years agoBacported from trunk:
Martin Sebor [Thu, 17 Jun 2021 16:32:00 +0000 (10:32 -0600)] 
Bacported from trunk:

PR middle-end/100574 - ICE in size_remaining, at builtins.c

gcc/ChangeLog:
PR middle-end/100574
* builtins.c (access_ref::get_ref): Improve detection of PHIs with
all null arguments.

gcc/testsuite/ChangeLog:
PR middle-end/100574
* g++.dg/pr100574.C: New test.

4 years agoBackported from trunk:
Martin Sebor [Thu, 17 Jun 2021 16:24:34 +0000 (10:24 -0600)] 
Backported from trunk:

PR middle-end/100307 - spurious -Wplacement-new with negative pointer offset

gcc/ChangeLog:

PR middle-end/100307
* builtins.c (compute_objsize_r): Clear base0 for pointers.

gcc/testsuite/ChangeLog:

PR middle-end/100307
* g++.dg/warn/Wplacement-new-size-9.C: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test.

4 years agoBackported from trunk:
Martin Sebor [Thu, 17 Jun 2021 16:20:09 +0000 (10:20 -0600)] 
Backported from trunk:

PR middle-end/100250 - ICE related to -Wmaybe-uninitialized

gcc/ChangeLog:

PR middle-end/100250
* attribs.c (attr_access::array_as_string): Avoid dereferencing
a pointer when it's null.

gcc/testsuite/ChangeLog:

PR middle-end/100250
* gcc.dg/uninit-pr100250.c: New test.

4 years agoBackported from trunk:
Aaron Sawdey [Wed, 3 Mar 2021 00:06:37 +0000 (18:06 -0600)] 
Backported from trunk:

Fusion patterns for add-logical/logical-add

This patch modifies the function in genfusion.pl for generating
the logical-logical patterns so that it can also generate the
add-logical and logical-add patterns which are very similar.

Also backported from trunk and combined with the add-logical patch
because that revealed problems on gcc-11.

Add needed earlyclobber to fusion patterns

The add-logical and add-add fusion patterns all have constraint
alternatives "=0,1,&r,r" for the output (3). The inputs 0 and 1
are used in the first fusion instruction and then either may be
reused as a temp for the output of the first insn which is
input to the second. However, if input 2 is the same as 0 or 1,
it gets clobbered unexpectedly. So the first 2 alts need to be
"=&0,&1,&r,r" instead to indicate that in alts 0 and 1, the
register used for 3 is earlyclobber, hence can't be the same as
input 2.

This was actually encountered in the backport of the add-logical
fusion patch to gcc-11. Some code in go hit this case:

   <runtime.fillAligned+520>:        andc r30,r30,r9
r30 now (~(x|((x&c)+c)))&(~c) --> this is new x
   <runtime.fillAligned+524>:        b <runtime.fillAligned+288>
   <runtime.fillAligned+288>:        addi r31,r31,-1
r31 now m-1
   <runtime.fillAligned+292>:        srd r31,r30,r31
r31 now x>>(m-1)
   <runtime.fillAligned+296>:        subf r30,r31,r30
r30 now x-(x>>(m-1))
   <runtime.fillAligned+300>:        or r30,r30,r30   # mdoom
nop
   <runtime.fillAligned+304>:        not     r3,r30
r3 now ~(x-(x>>(m-1))) -- WHOOPS

The or r30,r30,r30 was meant to be or-ing in the earlier value
of r30 which was overwritten by the output of the subf.

Combined ChangeLog (needed for the scripts to understand):

gcc/ChangeLog

* config/rs6000/genfusion.pl (gen_logical_addsubf): Refactor to
add generation of logical-add and add-logical fusion pairs.  Add
earlyclobber to alts 0/1.
(gen_addadd): Add earlyclobber to alts 0/1.
* config/rs6000/rs6000-cpus.def: Add new fusion to ISA 3.1 mask
and powerpc mask.
* config/rs6000/rs6000.c (rs6000_option_override_internal): Turn on
logical-add and add-logical fusion by default.
* config/rs6000/rs6000.opt: Add -mpower10-fusion-logical-add and
-mpower10-fusion-add-logical options.
* config/rs6000/fusion.md: Regenerate file.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/fusion-p10-logadd.c: New file.

4 years agoIBM Z: Fix vector intrinsics vec_double and vec_floate
Marius Hillenbrand [Wed, 16 Jun 2021 16:26:48 +0000 (18:26 +0200)] 
IBM Z: Fix vector intrinsics vec_double and vec_floate

Fix the mapping of vec_double and vec_floate to builtins.

gcc/ChangeLog:

PR target/100871
* config/s390/vecintrin.h (vec_doublee): Fix to use
  __builtin_s390_vflls.
(vec_floate): Fix to use __builtin_s390_vflrd.

gcc/testsuite/ChangeLog:

* gcc.target/s390/zvector/vec-doublee.c: New test.
* gcc.target/s390/zvector/vec-floate.c: New test.

(cherry picked from commit a4fc63e0c3c6c7b895225c883137d152743be7fc)

4 years agotestsuite: Use noipa attribute instead of noinline, noclone
Jakub Jelinek [Wed, 16 Jun 2021 11:10:48 +0000 (13:10 +0200)] 
testsuite: Use noipa attribute instead of noinline, noclone

I've noticed this test now on various arches sometimes FAILs, sometimes
PASSes (the line 12 test in particular).

The problem is that a = 0; initialization in the caller no longer happens
before the f(&a) call as what the argument points to is only used in
debug info.

Making the function noipa forces the caller to initialize it and still
tests what the test wants to test, namely that we don't consider *p as
valid location for the c variable at line 18 (after it has been overwritten
with *p = 1;).

2021-06-16  Jakub Jelinek  <jakub@redhat.com>

* gcc.dg/guality/pr49888.c (f): Use noipa attribute instead of
noinline, noclone.

(cherry picked from commit a490b1dc0b3c26bff2ee00ac0da2d606d2009e3a)

4 years agolibffi: Fix up x86_64 classify_argument
Jakub Jelinek [Wed, 16 Jun 2021 08:45:27 +0000 (10:45 +0200)] 
libffi: Fix up x86_64 classify_argument

As the following testcase shows, libffi didn't handle properly
classify_arguments of structures at byte offsets not divisible by
UNITS_PER_WORD.  The following patch adjusts it to match what
config/i386/ classify_argument does for that and also ports the
PR38781 fix there (the second chunk).

This has been committed to upstream libffi already:
https://github.com/libffi/libffi/commit/5651bea284ad0822eafe768e3443c2f4d7da2c8f

2021-06-16  Jakub Jelinek  <jakub@redhat.com>

* src/x86/ffi64.c (classify_argument): For FFI_TYPE_STRUCT set words
to number of words needed for type->size + byte_offset bytes rather
than just type->size bytes.  Compute pos before the loop and check
total size of the structure.
* testsuite/libffi.call/nested_struct12.c: New test.

(cherry picked from commit 041f74177072df1d66502319205990a4d970c92a)

4 years agoexpr: Fix up VEC_PACK_TRUNC_EXPR expansion [PR101046]
Jakub Jelinek [Tue, 15 Jun 2021 09:36:47 +0000 (11:36 +0200)] 
expr: Fix up VEC_PACK_TRUNC_EXPR expansion [PR101046]

The following testcase ICEs, because we have a mode mismatch.
VEC_PACK_TRUNC_EXPR's operands have different modes from the result
(same vector mode size but twice as large element),
but we were passing non-NULL subtarget with the mode of the result
to the expansion of its arguments, so the VEC_PERM_EXPR in one of the
operands which had V8SImode operands and result had V16HImode target.

Fixed by clearing the subtarget if we are changing mode.

2021-06-15  Jakub Jelinek  <jakub@redhat.com>

PR target/101046
* expr.c (expand_expr_real_2) <case VEC_PACK_FIX_TRUNC_EXPR,
case VEC_PACK_TRUNC_EXPR>: Clear subtarget when changing mode.

(cherry picked from commit 008153c8435ca3bf587e11654c31f05c0f99b43a)

4 years agosimplify-rtx: Fix up simplify_logical_relational_operation for vector IOR [PR101008]
Jakub Jelinek [Fri, 11 Jun 2021 10:59:43 +0000 (12:59 +0200)] 
simplify-rtx: Fix up simplify_logical_relational_operation for vector IOR [PR101008]

simplify_relational_operation callees typically return just const0_rtx
or const_true_rtx and then simplify_relational_operation attempts to fix
that up if the comparison result has vector mode, or floating mode,
or punt if it has scalar mode and vector mode operands (it doesn't know how
exactly to deal with the scalar masks).
But, simplify_logical_relational_operation has a special case, where
it attempts to fold (x < y) | (x >= y) etc. and if it determines it is
always true, it just returns const_true_rtx, without doing the dances that
simplify_relational_operation does.
That results in an ICE on the following testcase, where such folding happens
during expansion (of debug stmts into DEBUG_INSNs) and we ICE because
all of sudden a VOIDmode rtx appears where it expects a vector (V4SImode)
rtx.

The following patch fixes that by moving the adjustement into a separate
helper routine and using it from both simplify_relational_operation and
simplify_logical_relational_operation.

2021-06-11  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/101008
* simplify-rtx.c (relational_result): New function.
(simplify_logical_relational_operation,
simplify_relational_operation): Use it.

(cherry picked from commit 4bdcdd8fa8d7659e5a19a930cf2f0332127f8a46)

4 years agoifcvt: Fix -fcompare-debug bug [PR100852]
Jakub Jelinek [Thu, 10 Jun 2021 07:28:27 +0000 (09:28 +0200)] 
ifcvt: Fix -fcompare-debug bug [PR100852]

The following testcase fails -fcompare-debug, because it is ifcvt optimized
into umin only with -g0 and not with -g - the function(s) use
prev_nonnote_insn, which without -g finds a real insn the code is looking
for, while with -g finds a DEBUG_INSN.

2021-06-10  Jakub Jelinek  <jakub@redhat.com>

PR debug/100852
* ifcvt.c (noce_get_alt_condition, noce_try_abs): Use
prev_nonnote_nondebug_insn instead of prev_nonnote_insn.

* g++.dg/opt/pr100852.C: New test.

(cherry picked from commit 2d2ed777b23ab6503027039e0adbfe1162f52b2f)

4 years agoopenmp: Gimplify OMP_CLAUSE_SIZE during gfc_omp_finish_clause [PR100965]
Jakub Jelinek [Wed, 9 Jun 2021 08:48:41 +0000 (10:48 +0200)] 
openmp: Gimplify OMP_CLAUSE_SIZE during gfc_omp_finish_clause [PR100965]

As the testcase shows, we need to gimplify OMP_CLAUSE_SIZE, so that we
don't end up with SAVE_EXPR or anything similar non-gimple in it.

2021-06-08  Jakub Jelinek  <jakub@redhat.com>

PR fortran/100965
* trans-openmp.c (gfc_omp_finish_clause): Gimplify OMP_CLAUSE_SIZE.

* gfortran.dg/gomp/pr100965.f90: New test.

(cherry picked from commit d4d38135b3137f1d3148138340e67bdcd7ea8216)

4 years agofold-const: Fix up fold_read_from_vector [PR100887]
Jakub Jelinek [Mon, 7 Jun 2021 07:28:31 +0000 (09:28 +0200)] 
fold-const: Fix up fold_read_from_vector [PR100887]

The callers of fold_read_from_vector expect that the index they pass is
an index of an element in the vector and the function does that most of the
time.  But we allow CONSTRUCTORs with VECTOR_TYPE to have VECTOR_TYPE
elements and in that case every CONSTRUCTOR element represents not just one
index (with the exception of V1 vectors), but multiple.
So returning zero vector if i >= CONSTRUCTOR_NELTS or returning some
CONSTRUCTOR_ELT's value might not be what the callers expect.

Fixed by punting if the first element has vector type.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

In theory we could instead recurse (and assert that for CONSTRUCTORs of
vector elements we have always all elements specified like tree-cfg.c
verifies?) after adjusting the index appropriately.

2021-06-07  Jakub Jelinek  <jakub@redhat.com>

PR target/100887
* fold-const.c (fold_read_from_vector): Return NULL if trying to
read from a CONSTRUCTOR with vector type elements.

(cherry picked from commit e1521b170b44be5cd5d36a98b6b760457b68f566)

4 years agotree-inline: Fix up __builtin_va_arg_pack handling [PR100898]
Jakub Jelinek [Mon, 7 Jun 2021 07:25:37 +0000 (09:25 +0200)] 
tree-inline: Fix up __builtin_va_arg_pack handling [PR100898]

The following testcase ICEs, because gimple_call_arg_ptr (..., 0)
asserts that there is at least one argument, while we were using
it even if we didn't copy anything just to get a pointer from/to which
the zero arguments should be copied.

Fixed by guarding the memcpy calls.  Also, the code was calling
gimple_call_num_args too many times - 5 times instead of 2, so the patch
adds two temporaries for those.

2021-06-07  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/100898
* tree-inline.c (copy_bb): Only use gimple_call_arg_ptr if memcpy
should copy any arguments.  Don't call gimple_call_num_args
on id->call_stmt or call_stmt more than once.

* g++.dg/ext/va-arg-pack-3.C: New test.

(cherry picked from commit d66a703c8ba86f3ca04cc10c3071696e6d014de6)

4 years agoopenmp: Call c_omp_adjust_map_clauses even for combined target [PR100902]
Jakub Jelinek [Sun, 6 Jun 2021 17:37:06 +0000 (19:37 +0200)] 
openmp: Call c_omp_adjust_map_clauses even for combined target [PR100902]

When looking at in_reduction support for target, I've noticed that
c_omp_adjust_map_clauses is not called for the combined target case.

The following patch fixes it.

Unfortunately, there are other issues.

One is (also mentioned in the PR) that currently the pointer attachment
stuff seems to be clause ordering dependent (the standard says that clause
ordering on the same construct does not matter), the baz and qux cases
in the PR are rejected while when swapped it is accepted.
Note, the order of clauses in GCC really is treated as insignificant
initially and only later on the compiler can adjust the ordering (e.g. when
we sort map clauses based on what they refer to etc.) and in particular,
clauses from parsing is reverse of the order in user code, while
c_omp_split_clauses performed for combined/composite constructs typically
reverses that ordering, i.e. makes it follow the user code ordering.

And another one is I'm slightly afraid c_omp_adjust_map_clauses might
misbehave in templates, though haven't tried to verify it with testcases.
When processing_template_decl, the non-dependent clauses will be handled
usually the same as when not in a template, but dependent clauses aren't
processed or only limited processing is done there, and rest is deferred
till later.  From quick skimming of c_omp_adjust_map_clauses, it seems
it might not be very happy about non-processed map clauses that might
still have the TREE_LIST representation of array sections, or might
not have finalized decls or base decls etc.
So, for this I wonder if cp_parser_omp_target (and other cp/parser.c
callers of c_omp_adjust_map_clauses) shouldn't call it only
if (!processing_template_decl) - perhaps you could add
cp_omp_adjust_map_clauses wrapper that would be
if (!processing_template_decl)
  c_omp_adjust_map_clauses (...);
- and call c_omp_adjust_map_clauses from within pt.c after the clauses
are tsubsted and finish_omp_clauses is called again.

2021-06-06  Jakub Jelinek  <jakub@redhat.com>

PR c/100902
* c-parser.c (c_parser_omp_target): Call c_omp_adjust_map_clauses
even when target is combined with other constructs.

* parser.c (cp_parser_omp_target): Call c_omp_adjust_map_clauses
even when target is combined with other constructs.

* c-c++-common/gomp/pr100902-1.c: New test.

(cherry picked from commit 7fa4db39b6bcd207bd2bffff52023ff6b155bd15)

4 years agox86: Fix ix86_expand_vector_init for V*TImode [PR100887]
Jakub Jelinek [Fri, 4 Jun 2021 09:20:02 +0000 (11:20 +0200)] 
x86: Fix ix86_expand_vector_init for V*TImode [PR100887]

We have vec_initv4tiv2ti and vec_initv2titi patterns which call
ix86_expand_vector_init and assume it works for those modes.  For the
case of construction from two half-sized vectors, the code assumes it
will always succeed, but we have only insn patterns with SImode and DImode
element types.  QImode and HImode element types are already handled
by performing it with same sized vectors with SImode elements and the
following patch extends that to V*TImode vectors.

2021-06-04  Jakub Jelinek  <jakub@redhat.com>

PR target/100887
* config/i386/i386-expand.c (ix86_expand_vector_init): Handle
concatenation from half-sized modes with TImode elements.

(cherry picked from commit b7dd2e4eeb44bc8678ecde8a6c7401de85e63561)

4 years agoc++: Tweak PR101029 fix
Jason Merrill [Wed, 16 Jun 2021 21:42:15 +0000 (17:42 -0400)] 
c++: Tweak PR101029 fix

The case of an initializer with side effects for a zero-length array seems
extremely unlikely, but we should still return the right type in that case.

            PR c++/101029

gcc/cp/ChangeLog:

* init.c (build_vec_init): Preserve the type of base.

4 years agoDaily bump.
GCC Administrator [Thu, 17 Jun 2021 00:18:41 +0000 (00:18 +0000)] 
Daily bump.

4 years agoc++: static memfn from non-dependent base [PR101078]
Jason Merrill [Wed, 16 Jun 2021 20:09:59 +0000 (16:09 -0400)] 
c++: static memfn from non-dependent base [PR101078]

After my patch for PR91706, or before that with the qualified call,
tsubst_baselink returned a BASELINK with BASELINK_BINFO indicating a base of
a still-dependent derived class.  We need to look up the relevant base binfo
in the substituted class.

PR c++/101078

gcc/cp/ChangeLog:

* pt.c (tsubst_baselink): Update binfos in non-dependent case.

gcc/testsuite/ChangeLog:

* g++.dg/template/access39.C: New test.

4 years agolibcpp: location comparison within macro [PR100796]
Jason Merrill [Mon, 14 Jun 2021 21:37:43 +0000 (17:37 -0400)] 
libcpp: location comparison within macro [PR100796]

The patch for 96391 changed linemap_compare_locations to give up on
comparing locations from macro expansions if we don't have column
information.  But in this testcase, the BOILERPLATE macro is multiple lines
long, so we do want to compare locations within the macro.  So this patch
moves the LINE_MAP_MAX_LOCATION_WITH_COLS check inside the block, to use it
for failing gracefully.

PR c++/100796
PR preprocessor/96391

libcpp/ChangeLog:

* line-map.c (linemap_compare_locations): Only use comparison with
LINE_MAP_MAX_LOCATION_WITH_COLS to avoid abort.

gcc/testsuite/ChangeLog:

* g++.dg/plugin/location-overflow-test-pr100796.c: New test.
* g++.dg/plugin/plugin.exp: Run it.

4 years agoc++: constexpr and array[0] [PR101029]
Jason Merrill [Fri, 11 Jun 2021 20:55:30 +0000 (16:55 -0400)] 
c++: constexpr and array[0] [PR101029]

build_vec_init_elt exits early if we're initializing a zero-element array,
so build_vec_init needs to do the same to avoid trying to instantiate things
after we've already started throwing important bits away.

PR c++/101029

gcc/cp/ChangeLog:

* init.c (build_vec_init): Shortcut [0] case.

gcc/testsuite/ChangeLog:

* g++.dg/ext/array4.C: New test.

4 years agomiddle-end/101009 - fix distance vector recording
Richard Biener [Fri, 11 Jun 2021 07:33:58 +0000 (09:33 +0200)] 
middle-end/101009 - fix distance vector recording

This fixes recording of distance vectors in case the DDR has just
constant equal indexes.  In that case we expect distance vectors
with zero distances to be recorded which is what was done when
any distance was computed for affine indexes.

2021-06-11  Richard Biener  <rguenther@suse.de>

PR middle-end/101009
* tree-data-ref.c (build_classic_dist_vector_1): Make sure
to set *init_b to true when we encounter a constant equal
index pair.
(compute_affine_dependence): Also dump the actual DR_REF.

* gcc.dg/torture/pr101009.c: New testcase.

(cherry picked from commit 336c41dbcb21740f8964021e157bc69ca547059b)

4 years agotree-optimization/100981 - fix SLP patterns involving reductions
Richard Biener [Wed, 9 Jun 2021 12:48:35 +0000 (14:48 +0200)] 
tree-optimization/100981 - fix SLP patterns involving reductions

The following fixes the SLP FMA patterns to preserve reduction
info and the reduction vectorization to consider internal function
call defs for the reduction stmt.

2021-06-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100981
gcc/
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use
gimple_get_lhs to also handle calls.
* tree-vect-slp-patterns.c (complex_pattern::build): Transfer
reduction info.

gcc/testsuite/
* gfortran.dg/vect/pr100981-1.f90: New testcase.

libgomp/
* testsuite/libgomp.fortran/pr100981-2.f90: New testcase.

4 years agotree-optimization/100934 - properly mark irreducible regions for DOM
Richard Biener [Mon, 14 Jun 2021 12:57:26 +0000 (14:57 +0200)] 
tree-optimization/100934 - properly mark irreducible regions for DOM

The jump threading code requires marked irreducible regions for the
purpose of validating jump threading paths but DOM fails to provide
that resulting in mised number of iteration upper bounds clearing.

2021-06-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100934
* tree-ssa-dom.c (pass_dominator::execute): Properly
mark irreducible regions.

* gcc.dg/torture/pr100934.c: New testcase.

(cherry picked from commit 788bb7edb3975b80c4cb16323e7a5e55a2471e46)

4 years agoipa/100791 - copy fntype when processing __builtin_va_arg_pack
Richard Biener [Fri, 28 May 2021 11:31:35 +0000 (13:31 +0200)] 
ipa/100791 - copy fntype when processing __builtin_va_arg_pack

This missing copying exposed a type mismatch in the IL.

2021-05-28  Richard Biener  <rguenther@suse.de>

PR ipa/100791
* tree-inline.c (copy_bb): When processing __builtin_va_arg_pack
copy fntype from original call.

* gcc.dg/pr100791.c: New testcase.

(cherry picked from commit 359c0a86e2974a9f3036bc05b6e6c661f2c463cf)

4 years agoFortran: Fix double function call with -fcheck=pointer [PR]
José Rui Faustino de Sousa [Wed, 16 Jun 2021 00:53:06 +0000 (00:53 +0000)] 
Fortran: Fix double function call with -fcheck=pointer [PR]

gcc/fortran/ChangeLog:

PR fortran/82376
* trans-expr.c (gfc_conv_procedure_call): Evaluate function result
and then pass a pointer.

gcc/testsuite/ChangeLog:

PR fortran/82376
* gfortran.dg/PR82376.f90: New test.

4 years agoDaily bump.
GCC Administrator [Wed, 16 Jun 2021 00:18:43 +0000 (00:18 +0000)] 
Daily bump.