]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 years agoOpenMP: Handle order(concurrent) clause in gfortran
Tobias Burnus [Fri, 21 Aug 2020 15:54:21 +0000 (17:54 +0200)] 
OpenMP: Handle order(concurrent) clause in gfortran

gcc/fortran/ChangeLog:

* dump-parse-tree.c (show_omp_clauses): Handle order(concurrent).
* gfortran.h (struct gfc_omp_clauses): Add order_concurrent.
* openmp.c (enum omp_mask1, OMP_DO_CLAUSES, OMP_SIMD_CLAUSES):
Add OMP_CLAUSE_ORDER.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_split_omp_clauses):
Handle order(concurrent) clause.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/order-3.f90: New test.
* gfortran.dg/gomp/order-4.f90: New test.

(cherry picked from commit d8140b9ed3c0fed041aedaff3fa4a603984ca10f)

4 years agoFortran: Fix for OpenMP's 'lastprivate(conditional:'
Tobias Burnus [Fri, 21 Aug 2020 15:52:13 +0000 (17:52 +0200)] 
Fortran: Fix for OpenMP's 'lastprivate(conditional:'

gcc/fortran/ChangeLog:

* trans-openmp.c (gfc_trans_omp_do): Fix 'lastprivate(conditional:'.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/lastprivate-conditional-3.f90: Enable some
previously disabled 'lastprivate(conditional:' dg-warnings.

(cherry picked from commit 7bd72dd5a385dfa6d49cfe640cefc9ed187361d3)

4 years agoOpenMP: Support 'lastprivate (conditional:' in Fortran
Tobias Burnus [Fri, 21 Aug 2020 15:49:50 +0000 (17:49 +0200)] 
OpenMP: Support 'lastprivate (conditional:' in Fortran

gcc/fortran/ChangeLog:

* gfortran.h (gfc_omp_namelist): Add lastprivate_conditional.
* openmp.c (gfc_match_omp_clauses): Handle 'conditional:'
modifier of 'lastprivate'.
* trans-openmp.c (gfc_omp_clause_default_ctor): Don't assert
on OMP_CLAUSE__CONDTEMP_ and other OMP_*TEMP_.
(gfc_trans_omp_variable_list): Handle lastprivate_conditional.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/lastprivate-conditional-1.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-2.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-3.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-4.f90: New test.
* gfortran.dg/gomp/lastprivate-conditional-5.f90: New test.

(cherry picked from commit 084dc63a0200e60e0fbb7c36b412a158d234f5c0)

4 years agoMerge remote-tracking branch 'origin/releases/gcc-10' into devel/omp/gcc-10
Tobias Burnus [Fri, 21 Aug 2020 15:18:13 +0000 (17:18 +0200)] 
Merge remote-tracking branch 'origin/releases/gcc-10' into devel/omp/gcc-10

Merged up to 2974c828615b240f66b208301b5a73c6a07fcb22 (2020-08-21)

4 years ago[LTO/offloading] Fix offloading-compilation ICE without -flto (PR84320)
Tobias Burnus [Tue, 26 May 2020 16:24:28 +0000 (18:24 +0200)] 
[LTO/offloading] Fix offloading-compilation ICE without -flto (PR84320)

gcc/ChangeLog:
PR ipa/95320
* ipa-utils.h (odr_type_p): Also permit calls with
only flag_generate_offload set.

(cherry picked from commit c5ab336ba106a407a67e84d8faac5b0ea6f18310)

4 years agoUpdate dg-* in gfortran.dg/gomp/pr67500.f90
Tobias Burnus [Fri, 21 Aug 2020 11:28:06 +0000 (13:28 +0200)] 
Update dg-* in gfortran.dg/gomp/pr67500.f90

Contrary to GCC 11, OG10 uses an error instead of a warning,
cf. commit 271c7fef548a86676d304b1eb2be5c0d47280bd6.

gcc/testsuite/
        * gfortran.dg/gomp/pr67500.f90: Change dg-warning to
        dg-error.

4 years agolibstdc++: Skip PSTL tests when installed TBB is too old [PR 96718]
Jonathan Wakely [Fri, 21 Aug 2020 11:01:05 +0000 (12:01 +0100)] 
libstdc++: Skip PSTL tests when installed TBB is too old [PR 96718]

These tests do not actually require TBB, because they only inspect the
feature test macros present in the headers. However, if TBB is installed
then its headers will be included, and the version will be checked. If
the version is too old, compilation fails due to a #error directive.

This change disables the tests if TBB is not present, so that we skip
them instead of failing.

libstdc++-v3/ChangeLog:

PR libstdc++/96718
* testsuite/25_algorithms/pstl/feature_test-2.cc: Require
tbb-backend effective target.
* testsuite/25_algorithms/pstl/feature_test-3.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test-5.cc: Likewise.
* testsuite/25_algorithms/pstl/feature_test.cc: Likewise.

(cherry picked from commit 988fb2f597d67cdf3603654372c020c28448441f)

4 years agoFortran: Fix OpenMP's 'if(simd:' etc. conditions
Tobias Burnus [Fri, 21 Aug 2020 07:45:53 +0000 (09:45 +0200)] 
Fortran: Fix OpenMP's 'if(simd:' etc. conditions

gcc/fortran/ChangeLog:

* openmp.c (gfc_match_omp_clauses): Re-order 'if' clause pasing
to avoid creating spurious symbols.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/lastprivate-conditional-10.f90: New test.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 656218ab982cc22b826227045826c92743143af1)

4 years agoOpenMP: Support 'if (simd:/cancel:' in Fortran
Tobias Burnus [Fri, 21 Aug 2020 07:42:52 +0000 (09:42 +0200)] 
OpenMP: Support 'if (simd:/cancel:' in Fortran

gcc/fortran/ChangeLog:

* gfortran.h (enum gfc_omp_if_kind): Add OMP_IF_CANCEL and OMP_IF_SIMD.
* openmp.c (OMP_SIMD_CLAUSES): Add OMP_CLAUSE_IF.
(gfc_match_omp_clauses, resolve_omp_clauses): Handle 'if (simd/cancel:'.
* dump-parse-tree.c (show_omp_clauses): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_cancel,
(gfc_split_omp_clauses): Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/cancel-2.f90: New test.
* gfortran.dg/gomp/cancel-3.f90: New test.
* gfortran.dg/gomp/if-1.f90: New test.

(cherry picked from commit e55ba804d3b8de86a430a8a5553dfc1ad06daa74)

4 years agoMerge remote-tracking branch 'origin/releases/gcc-10' into devel/omp/gcc-10
Tobias Burnus [Fri, 21 Aug 2020 07:15:35 +0000 (09:15 +0200)] 
Merge remote-tracking branch 'origin/releases/gcc-10' into devel/omp/gcc-10

Merge up to 981b776f02fa1c1a78bafd6cc00ea5c6c70abf75 (Aug 21, 2020)

4 years agoMove change-log items to ChangeLog.omp
Tobias Burnus [Fri, 21 Aug 2020 07:12:44 +0000 (09:12 +0200)] 
Move change-log items to ChangeLog.omp

Move entries from commit 7c10ae450b95495dda362cb66770bb78b546592e
from gcc/fortran/ChangeLog to gcc/fortran/ChangeLog.omp and
from gcc/testsuite/ChangeLog to gcc/testsuite/ChangeLog.omp.

4 years agoDaily bump.
GCC Administrator [Fri, 21 Aug 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

4 years agod: Adjust backport of PR96250 for front-end implementation.
Iain Buclaw [Thu, 20 Aug 2020 23:52:28 +0000 (01:52 +0200)] 
d: Adjust backport of PR96250 for front-end implementation.

gcc/d/ChangeLog:

2020-08-21  Iain Buclaw  <ibuclaw@gdcproject.org>

PR d/96250
* dmd/expressionsem.c (ExpressionSemanticVisitor::visit(TypeExp)):
Fix cast from Expression to VarExp.

4 years agoAnnotate inner loops in "acc kernels loop" directives (Fortran).
Sandra Loosemore [Thu, 20 Aug 2020 02:24:43 +0000 (19:24 -0700)] 
Annotate inner loops in "acc kernels loop" directives (Fortran).

Normally explicit loop directives in a kernels region inhibit
automatic annotation of other loops in the same nest, on the theory
that users have indicated they want manual control over that section
of code.  However there seems to be an expectation in user code that
the combined "kernels loop" directive should still allow annotation of
inner loops.  This patch implements this behavior in Fortran.

2020-08-19  Sandra Loosemore  <sandra@codesourcery.com>

gcc/fortran/
* openmp.c (annotate_do_loops_in_kernels): Handle
EXEC_OACC_KERNELS_LOOP separately to permit annotation of inner
loops in a combined "acc kernels loop" directive.

gcc/testsuite/
* gfortran.dg/goacc/kernels-loop-annotation-18.f95: New.
* gfortran.dg/goacc/kernels-loop-annotation-19.f95: New.
* gfortran.dg/goacc/combined-directives.f90: Adjust expected
patterns.
* gfortran.dg/goacc/private-explicit-kernels-1.f95: Likewise.
* gfortran.dg/goacc/private-predetermined-kernels-1.f95:
Likewise.

4 years agoAnnotate inner loops in "acc kernels loop" directives (C/C++).
Sandra Loosemore [Thu, 20 Aug 2020 02:18:57 +0000 (19:18 -0700)] 
Annotate inner loops in "acc kernels loop" directives (C/C++).

Normally explicit loop directives in a kernels region inhibit
automatic annotation of other loops in the same nest, on the theory
that users have indicated they want manual control over that section
of code.  However there seems to be an expectation in user code that
the combined "kernels loop" directive should still allow annotation of
inner loops.  This patch implements this behavior for C and C++.

2020-08-19  Sandra Loosemore  <sandra@codesourcery.com>

gcc/c-family/
* c-omp.c (annotate_loops_in_kernels_regions): Process inner
loops in combined "acc kernels loop" directives.

gcc/testsuite/
* c-c++-common/goacc/kernels-loop-annotation-18.c: New.
* c-c++-common/goacc/kernels-loop-annotation-19.c: New.
* c-c++-common/goacc/combined-directives.c: Adjust expected
patterns.

4 years agoAdd a "combined" flag for "acc kernels loop" etc directives.
Sandra Loosemore [Thu, 20 Aug 2020 02:13:55 +0000 (19:13 -0700)] 
Add a "combined" flag for "acc kernels loop" etc directives.

2020-08-19  Sandra Loosemore  <sandra@codesourcery.com>

gcc/
* tree.h (OACC_LOOP_COMBINED): New.

gcc/c/
* c-parser.c (c_parser_oacc_loop): Set OACC_LOOP_COMBINED.

gcc/cp/
* parser.c (cp_parser_oacc_loop): Set OACC_LOOP_COMBINED.

gcc/fortran/
* trans-openmp.c (gfc_trans_omp_do): Add combined parameter,
use it to set OACC_LOOP_COMBINED.  Update all call sites.

4 years agod: Field access in parentheses causes error: need 'this' for 'field' of type 'type'
Iain Buclaw [Tue, 21 Jul 2020 17:32:54 +0000 (19:32 +0200)] 
d: Field access in parentheses causes error: need 'this' for 'field' of type 'type'

1. Fixes an ICE in the front-end if a struct symbol were to appear twice
in the compilation unit.

2. Fixes a rejects-valid bug in the front-end where `(symbol)' was being
resolved as a `var' expression, instead of `this.var'.

gcc/d/ChangeLog:

PR d/96250
* dmd/dstruct.c (StructDeclaration::semantic): Error if redefinition
of struct exists in compilation.
* dmd/expressionsem.c (ExpressionSemanticVisitor::visit(TypeExp)):
Rewrite resolved field variables as 'this.var' before semantic.
* dmd/parse.c (Parser::parseUnaryExp): Mark '(type) una_exp' as a
parenthesized expression.

gcc/testsuite/ChangeLog:

PR d/96250
* gdc.test/fail_compilation/fail17492.d: New test.
* gdc.test/compilable/b9490.d: New test.
* gdc.test/compilable/ice14739.d: New test.
* gdc.test/fail_compilation/ice21060.d: New test.
* gdc.test/fail_compilation/imports/ice21060a/package.d: New file.
* gdc.test/fail_compilation/imports/ice21060b/package.d: New file.
* gdc.test/fail_compilation/imports/ice21060c/package.d: New file.
* gdc.test/fail_compilation/imports/ice21060d/package.d: New file.
* gdc.test/runnable/b16278.d: New test.

4 years agod: Fix ICE in setValue at dmd/dinterpret.c:7046
Iain Buclaw [Thu, 20 Aug 2020 16:18:40 +0000 (18:18 +0200)] 
d: Fix ICE in setValue at dmd/dinterpret.c:7046

This was originally seen when running the testsuite for a 16-bit target,
however, it could be reproduced on 32-bit using long[] as well.

gcc/d/ChangeLog:

* dmd/ctfeexpr.c (isCtfeValueValid): Return true for array literals as
well as structs.
* dmd/dinterpret.c: Don't reinterpret static arrays into dynamic.

gcc/testsuite/ChangeLog:

* gdc.test/compilable/interpret3.d: Add test.
* gdc.test/fail_compilation/reg6769.d: New test.

(cherry picked from commit c43db80477a95f69425f20e4b8f164081695d1e9)

4 years agod: Fix ICE using non-local variable: internal compiler error: Segmentation fault
Iain Buclaw [Tue, 21 Jul 2020 17:59:00 +0000 (19:59 +0200)] 
d: Fix ICE using non-local variable: internal compiler error: Segmentation fault

Moves no frame access error to own function, adding use of it for both
when get_framedecl() cannot find a path to the outer function frame, and
guarding get_decl_tree() from recursively calling itself.

gcc/d/ChangeLog:

PR d/96254
* d-codegen.cc (error_no_frame_access): New.
(get_frame_for_symbol): Use fdparent name in error message.
(get_framedecl): Replace call to assert with error.
* d-tree.h (error_no_frame_access): Declare.
* decl.cc (get_decl_tree): Detect recursion and error.

gcc/testsuite/ChangeLog:

PR d/96254
* gdc.dg/pr96254a.d: New test.
* gdc.dg/pr96254b.d: New test.

(cherry picked from commit 2b1c2a4bd9fb555dccde5d67d6da64547064e0e6)

4 years agolibgomp: adjust nvptx_free callback context checking
Chung-Lin Tang [Thu, 20 Aug 2020 14:18:51 +0000 (07:18 -0700)] 
libgomp: adjust nvptx_free callback context checking

Change test for CUDA callback context in nvptx_free() from using
GOMP_PLUGIN_acc_thread () into checking for CUDA_ERROR_NOT_PERMITTED,
for the former only works for OpenACC, but not OpenMP offloading.

2020-08-20  Chung-Lin Tang  <cltang@codesourcery.com>

libgomp/
* plugin/plugin-nvptx.c (nvptx_free):
Change "GOMP_PLUGIN_acc_thread () == NULL" test into check of
CUDA_ERROR_NOT_PERMITTED status for cuMemGetAddressRange. Adjust
comments.

(cherry picked from commit f9b9832837b65046a8f01c18597cf615ff61db40)

4 years agolibgomp: adjust nvptx_free callback context checking
Chung-Lin Tang [Thu, 20 Aug 2020 14:18:51 +0000 (07:18 -0700)] 
libgomp: adjust nvptx_free callback context checking

Change test for CUDA callback context in nvptx_free() from using
GOMP_PLUGIN_acc_thread () into checking for CUDA_ERROR_NOT_PERMITTED,
for the former only works for OpenACC, but not OpenMP offloading.

2020-08-20  Chung-Lin Tang  <cltang@codesourcery.com>

libgomp/
* plugin/plugin-nvptx.c (nvptx_free):
Change "GOMP_PLUGIN_acc_thread () == NULL" test into check of
CUDA_ERROR_NOT_PERMITTED status for cuMemGetAddressRange. Adjust
comments.

(cherry picked from commit f9b9832837b65046a8f01c18597cf615ff61db40)

4 years agoDaily bump.
GCC Administrator [Thu, 20 Aug 2020 00:17:07 +0000 (00:17 +0000)] 
Daily bump.

4 years agoFix gfortran.dg/goacc/pr70828.f90 testcase
Kwok Cheung Yeung [Wed, 19 Aug 2020 19:50:42 +0000 (12:50 -0700)] 
Fix gfortran.dg/goacc/pr70828.f90 testcase

Array mapping was changed by the patch '[OpenMP, Fortran] Add
structure/derived-type element mapping'.

2020-08-19  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/testsuite/
* gfortran.dg/goacc/pr70828.f90: Update expected output in Gimple
dump.

4 years agolibstdc++: Add deprecated attributes to old iostream members
Jonathan Wakely [Wed, 19 Aug 2020 12:41:26 +0000 (13:41 +0100)] 
libstdc++: Add deprecated attributes to old iostream members

Back in 2017 I removed these prehistoric members (which were deprecated
since C++98) for C++17 mode. But I didn't add deprecated attributes to
most of them, so users didn't get any warning they would be going away.
Apparently some poor souls do actually use some of these names, and so
now that GCC 11 defaults to -std=gnu++17 some code has stopped
compiling.

This adds deprecated attributes to them, so that C++98/03/11/14 code
will get a warning if it uses them. I'll also backport this to the
release branches so that users can find out about the deprecation before
they start using C++17.

libstdc++-v3/ChangeLog:

* include/bits/c++config (_GLIBCXX_DEPRECATED_SUGGEST): New
macro for "use 'foo' instead" message in deprecated warnings.
* include/bits/ios_base.h (io_state, open_mode, seek_dir)
(streampos, streamoff): Use _GLIBCXX_DEPRECATED_SUGGEST.
* include/std/streambuf (stossc): Replace C++11 attribute
with _GLIBCXX_DEPRECATED_SUGGEST.
* include/std/type_traits (__is_nullptr_t): Use
_GLIBCXX_DEPRECATED_SUGGEST instead of _GLIBCXX_DEPRECATED.
* testsuite/27_io/types/1.cc: Check for deprecated warnings.
Also check for io_state, open_mode and seek_dir typedefs.

(cherry picked from commit eef9bf4ca8d90a1751bc4bff03722ee68999eb8e)

4 years agoarm: Enable no-writeback vldr.16/vstr.16.
Joe Ramsay [Wed, 29 Jul 2020 13:04:28 +0000 (14:04 +0100)] 
arm: Enable no-writeback vldr.16/vstr.16.

There was previously no way to specify that a register operand cannot
have any writeback modifiers, and as a result the argument to vldr.16
and vstr.16 could be erroneously output with post-increment. This
change adds a constraint which forbids all writeback, and
selects it in the relevant case for vldr.16 and vstr.16

gcc/ChangeLog:

PR target/96682
* config/arm/arm-protos.h (arm_coproc_mem_operand_no_writeback):
Declare prototype.
(arm_mve_mode_and_operands_type_check): Declare prototype.
* config/arm/arm.c (arm_coproc_mem_operand): Refactor to use
_arm_coproc_mem_operand.
(arm_coproc_mem_operand_wb): New function to cover full, limited
and no writeback.
(arm_coproc_mem_operand_no_writeback): New constraint for memory
operand with no writeback.
(arm_print_operand): Extend 'E' specifier for memory operand
that does not support writeback.
(arm_mve_mode_and_operands_type_check): New constraint check for
MVE memory operands.
* config/arm/constraints.md: Add Uj constraint for VFP vldr.16
and vstr.16.
* config/arm/vfp.md (*mov_load_vfp_hf16): New pattern for
vldr.16.
(*mov_store_vfp_hf16): New pattern for vstr.16.
(*mov<mode>_vfp_<mode>16): Remove MVE moves.

gcc/testsuite/ChangeLog:

PR target/96682
* gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c: New test.

(cherry picked from commit 9f6abd2db90151c8966d2d2718ab8c299abf1105)

4 years agors6000: Rename instruction xvcvbf16sp to xvcvbf16spn
Peter Bergner [Tue, 18 Aug 2020 21:16:11 +0000 (16:16 -0500)] 
rs6000: Rename instruction xvcvbf16sp to xvcvbf16spn

The xvcvbf16sp mnemonic, which was just added in ISA 3.1 has been renamed
to xvcvbf16spn, to make it consistent with the other non-signaling conversion
instructions which all end with "n".  The only use of this instruction is in
an MMA conversion built-in function, so there is little to no compatibility
issue.

2020-08-18  Peter Bergner  <bergner@linux.ibm.com>

gcc/
* config/rs6000/rs6000-builtin.def (BU_VSX_1): Rename xvcvbf16sp to
xvcvbf16spn.
* config/rs6000/rs6000-call.c (builtin_function_type): Likewise.
* config/rs6000/vsx.md: Likewise.
* doc/extend.texi: Likewise.

gcc/testsuite/
* gcc.target/powerpc/mma-builtin-3.c: Rename xvcvbf16sp to xvcvbf16spn.

(cherry picked from commit 94bedeaf694c728607a718d599edb4d74a2813c0)

4 years agors6000: ICE when using an MMA type as a function param or return value [PR96506]
Peter Bergner [Thu, 13 Aug 2020 18:40:39 +0000 (13:40 -0500)] 
rs6000: ICE when using an MMA type as a function param or return value [PR96506]

PR96506 shows a problem where we ICE on illegal usage, namely using MMA
types for function arguments and return values.  The solution is to flag
these illegal usages as errors early, before we ICE.

2020-08-13  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96506
* config/rs6000/rs6000-call.c (rs6000_promote_function_mode): Disallow
MMA types as return values.
(rs6000_function_arg): Disallow MMA types as function arguments.

gcc/testsuite/
PR target/96506
* gcc.target/powerpc/pr96506.c: New test.

(cherry picked from commit 0ad7e730c142ef6cd0ddc1491a89a7f330caa887)

4 years agoDaily bump.
GCC Administrator [Wed, 19 Aug 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

4 years agoc++: Handle enumerator in C++20 alias CTAD. [PR96199]
Jason Merrill [Thu, 6 Aug 2020 06:40:10 +0000 (02:40 -0400)] 
c++: Handle enumerator in C++20 alias CTAD. [PR96199]

To form a deduction guide for an alias template, we substitute the template
arguments from the pattern into the deduction guide for the underlying
class.  In the case of B(A1<X>), that produces B(A1<B<T,1>::X>) -> B<T,1>.
But since an enumerator doesn't have its own template info, and B<T,1> is a
dependent scope, trying to look up B<T,1>::X fails and we crash.  So we need
to produce a SCOPE_REF instead.

And trying to use the members of the template class is wrong for other
members, as well, as it gives a nonsensical result if the class is
specialized.

gcc/cp/ChangeLog:

PR c++/96199
* pt.c (maybe_dependent_member_ref): New.
(tsubst_copy) [CONST_DECL]: Use it.
[VAR_DECL]: Likewise.
(tsubst_aggr_type): Handle nested type.

gcc/testsuite/ChangeLog:

PR c++/96199
* g++.dg/cpp2a/class-deduction-alias4.C: New test.

4 years agoFortran/OpenMP: Fix detecting not perfectly nested loops
Kwok Cheung Yeung [Tue, 18 Aug 2020 15:59:27 +0000 (08:59 -0700)] 
Fortran/OpenMP: Fix detecting not perfectly nested loops

This is a backport for master of commit
57dd9f3bfca8bb752c630431dc033c761e2ad382.

gcc/fortran/ChangeLog:

* openmp.c (resolve_omp_do): Detect not perfectly
nested loop with innermost collapse.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/collapse1.f90: Add dg-error.
* gfortran.dg/gomp/collapse2.f90: New test.

4 years agoopenmp: Handle clauses with gimple sequences in convert_nonlocal_omp_clauses properly
Kwok Cheung Yeung [Tue, 18 Aug 2020 15:55:21 +0000 (08:55 -0700)] 
openmp: Handle clauses with gimple sequences in convert_nonlocal_omp_clauses properly

This is a backport from master of commit
676b5525e8333005bdc1c596ed086f1da27a450f.

If the walk_body on the various sequences of reduction, lastprivate and/or linear
clauses needs to create a temporary variable, we should declare that variable
in that sequence rather than outside, where it would need to be privatized inside of
the construct.

2020-08-08  Jakub Jelinek  <jakub@redhat.com>

PR fortran/93553
* tree-nested.c (convert_nonlocal_omp_clauses): For
OMP_CLAUSE_REDUCTION, OMP_CLAUSE_LASTPRIVATE and OMP_CLAUSE_LINEAR
save info->new_local_var_chain around walks of the clause gimple
sequences and declare_vars if needed into the sequence.

2020-08-08  Tobias Burnus  <tobias@codesourcery.com>

PR fortran/93553
* testsuite/libgomp.fortran/pr93553.f90: New test.

4 years agocritical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite
Kwok Cheung Yeung [Tue, 18 Aug 2020 15:53:58 +0000 (08:53 -0700)] 
critical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite

This is a backport from master of commit
ade6e7204ce4d179cd9fa4637ddee85ba1fa12d9.

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/critical-hint-1.c: New; moved from
gcc/testsuite/c-c++-common/gomp/.
* testsuite/libgomp.c-c++-common/critical-hint-2.c: Likewise.
* testsuite/libgomp.fortran/critical-hint-1.f90: New; moved
from gcc/testsuite/gfortran.dg/gomp/.
* testsuite/libgomp.fortran/critical-hint-2.f90: Likewise.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/critical-hint-1.c: Moved to libgomp/.
* c-c++-common/gomp/critical-hint-2.c: Moved to libgomp/.
* gfortran.dg/gomp/critical-hint-1.f90: Moved to libgomp/.
* gfortran.dg/gomp/critical-hint-2.f90: Moved to libgomp/.

4 years agoOpenMP: Fixes for omp critical + hint
Kwok Cheung Yeung [Tue, 18 Aug 2020 15:44:30 +0000 (08:44 -0700)] 
OpenMP: Fixes for omp critical + hint

This is a backport from master of commit
c7c24828cfa4983ebc6744be3f913d0da6ff7163.

gcc/c-family/ChangeLog:

* c-omp.c (c_finish_omp_critical): Check for no name but
nonzero hint provided.

gcc/c/ChangeLog:

* c-parser.c (c_parser_omp_clause_hint): Require nonnegative hint clause.
(c_parser_omp_critical): Permit hint(0) clause without named critical.
(c_parser_omp_construct): Don't assert if error_mark_node is returned.

gcc/cp/ChangeLog:

* parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
(cp_parser_omp_critical): Permit hint(0) clause without named critical.
* pt.c (tsubst_expr): Re-check the latter for templates.

gcc/fortran/ChangeLog:

* openmp.c (gfc_match_omp_critical): Fix handling hints; permit
hint clause without named critical.
(resolve_omp_clauses): Require nonnegative constant integer
for the hint clause.
(gfc_resolve_omp_directive): Check for no name but
nonzero value for hint clause.
* parse.c (parse_omp_structured_block): Fix same-name check
for critical.
* trans-openmp.c (gfc_trans_omp_critical): Handle hint clause properly.

libgomp/ChangeLog:

* omp_lib.f90.in: Add omp_sync_hint_* and omp_sync_hint_kind.
* omp_lib.h.in: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/critical-3.C: Add nameless critical with hint testcase.
* c-c++-common/gomp/critical-hint-1.c: New test.
* c-c++-common/gomp/critical-hint-2.c: New test.
* gfortran.dg/gomp/critical-hint-1.f90: New test.
* gfortran.dg/gomp/critical-hint-2.f90: New test.

4 years agoi386: Fix restore_stack_nonlocal expander [PR96536].
Uros Bizjak [Tue, 18 Aug 2020 15:34:37 +0000 (17:34 +0200)] 
i386: Fix restore_stack_nonlocal expander [PR96536].

-fcf-protection code in restore_stack_nonlocal uses a branch based on
a clobber result.  The patch adds missing compare.

2020-08-18  UroÅ¡ Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

PR target/96536
* config/i386/i386.md (restore_stack_nonlocal):
Add missing compare RTX.

4 years agolibgomp.fortran/struct-elem-map-1.f90: Add char kind=4 tests
Kwok Cheung Yeung [Tue, 18 Aug 2020 11:39:49 +0000 (04:39 -0700)] 
libgomp.fortran/struct-elem-map-1.f90: Add char kind=4 tests

This is a backport from master of commit
e0685fadb6aa7c9cc895bc14cbbe2b9026fa3a94.

As the Fortran PR 95837 has been fixed, the test could be be added.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/struct-elem-map-1.f90: Remove unused
variables; add character(kind=4) tests; update TODO comment.

4 years agoFortran: Fix character-kind=4 substring resolution (PR95837)
Kwok Cheung Yeung [Tue, 18 Aug 2020 11:35:43 +0000 (04:35 -0700)] 
Fortran: Fix character-kind=4 substring resolution (PR95837)

This is a backport from master of commit
f48bffe70cba310461ec19ffcd07c573a6b86575.

Testing showed that it is always set and its value matches
always ts->kind (if available) or otherwise, if it is a variable,
the sym->ts.kind.

gcc/fortran/ChangeLog:

PR fortran/95837
* resolve.c (gfc_resolve_substring_charlen): Remove
bogus ts.kind setting for the expression.

gcc/testsuite/ChangeLog:

PR fortran/95837
* gfortran.dg/char4-subscript.f90: New test.

4 years agod: Fix ICE Segmentation fault during RTL pass: expand on armhf/armel/s390x
Iain Buclaw [Fri, 24 Jul 2020 11:49:37 +0000 (13:49 +0200)] 
d: Fix ICE Segmentation fault during RTL pass: expand on armhf/armel/s390x

gcc/d/ChangeLog:

PR d/96301
* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Only return
non-trivial structs by invisible reference.

gcc/testsuite/ChangeLog:

PR d/96301
* gdc.dg/pr96301a.d: New test.
* gdc.dg/pr96301b.d: New test.
* gdc.dg/pr96301c.d: New test.

(cherry picked from commit 6bebbc033d8bf2246745ffef7186b0424e08ba6b)

4 years agoDon't use pinsr/pextr for struct initialization/extraction.
liuhongt [Wed, 12 Aug 2020 02:48:17 +0000 (10:48 +0800)] 
Don't use pinsr/pextr for struct initialization/extraction.

gcc/
PR target/96562
PR target/93897
* config/i386/i386-expand.c (ix86_expand_pinsr): Don't use
pinsr for TImode.
(ix86_expand_pextr): Don't use pextr for TImode.

gcc/testsuite/
* gcc.target/i386/pr96562-1.c: New test.

4 years agocompiler: export thunks referenced by inline functions
Ian Lance Taylor [Fri, 14 Aug 2020 22:27:15 +0000 (15:27 -0700)] 
compiler: export thunks referenced by inline functions

The test case is https://golang.org/cl/248637.

Fixes golang/go#40252

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

4 years agoDaily bump.
GCC Administrator [Tue, 18 Aug 2020 00:17:00 +0000 (00:17 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Mon, 17 Aug 2020 00:16:52 +0000 (00:16 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 16 Aug 2020 00:16:55 +0000 (00:16 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 15 Aug 2020 00:16:55 +0000 (00:16 +0000)] 
Daily bump.

4 years agotestsuite: Fix up pr95548.C testcase.
Jakub Jelinek [Mon, 8 Jun 2020 08:30:48 +0000 (10:30 +0200)] 
testsuite: Fix up pr95548.C testcase.

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

PR lto/95548
* g++.dg/torture/pr95548.C: Change from dg-do compile to dg-do link,
add return type for main, for __SIZEOF_INT128__ test with __uint128_t
enumerator constants and add a test with unsigned long long
enumerators for all targets.

(cherry picked from commit 296d644b9f526e44fbe574426f24799c1d545fd3)

4 years ago[Fortran] OpenMP 5 – permit more sharing clauses for SIMD (PR94690)
Kwok Cheung Yeung [Fri, 14 Aug 2020 12:20:39 +0000 (05:20 -0700)] 
[Fortran] OpenMP 5 â€“ permit more sharing clauses for SIMD (PR94690)

This is a backport from master of commit
0ec52417fd9b3bef5227cdc9a18ff4f0247b0ea4.

gcc/fortran/
PR fortran/94690
* openmp.c (resolve_omp_do): Permit more clauses for SIMD
iteration variables.

gcc/testsuite/
PR fortran/94690
* gfortran.dg/gomp/openmp-simd-4.f90: New test.

4 years ago[Fortran] OpenMP - permit lastprivate in distribute + SIMD fixes (PR94690)
Kwok Cheung Yeung [Fri, 14 Aug 2020 12:14:32 +0000 (05:14 -0700)] 
[Fortran] OpenMP - permit lastprivate in distribute + SIMD fixes (PR94690)

This is a backport from master of commit
f884bef21cccc05d748fd7869cd641cbb4f6b6bb.

gcc/fortran/
2020-05-13  Tobias Burnus  <tobias@codesourcery.com>

PR fortran/94690
        * openmp.c (OMP_DISTRIBUTE_CLAUSES): Add OMP_CLAUSE_LASTPRIVATE.
        (gfc_resolve_do_iterator): Skip the private handling for SIMD as
        that is handled by ME code.
* trans-openmp.c (gfc_trans_omp_do): Don't add private/lastprivate
for dovar_found == 0, unless !simple.

libgomp/
2020-05-13  Tobias Burnus  <tobias@codesourcery.com>

PR fortran/94690
* testsuite/libgomp.fortran/pr66199-3.f90: New.
* testsuite/libgomp.fortran/pr66199-4.f90: New.
* testsuite/libgomp.fortran/pr66199-5.f90: New.
* testsuite/libgomp.fortran/pr66199-6.f90: New.
* testsuite/libgomp.fortran/pr66199-7.f90: New.
* testsuite/libgomp.fortran/pr66199-8.f90: New.
* testsuite/libgomp.fortran/pr66199-9.f90: New.

4 years agoFix streamer desynchornization caused by streamer debugging patch
Jan Hubicka [Fri, 29 May 2020 10:25:48 +0000 (12:25 +0200)] 
Fix streamer desynchornization caused by streamer debugging patch

it turns out I lost one hunk in the patch disabling extra streaming
which causes streamer to go out of sync in the case non-trivial scc
containing the node being streamed appears in local stream (which seems
quite rare since it does not happen during bootstrap).

2020-05-29  Jan Hubicka  <hubicka@ucw.cz>

PR lto/95362
* lto-streamer-out.c (lto_output_tree): Disable redundant streaming.

(cherry picked from commit 11041c3151e30d197d1c2774721db24332eeccef)

4 years agoDaily bump.
GCC Administrator [Fri, 14 Aug 2020 00:16:58 +0000 (00:16 +0000)] 
Daily bump.

4 years agoc++: constraints and address of template-id
Patrick Palka [Mon, 10 Aug 2020 13:39:29 +0000 (09:39 -0400)] 
c++: constraints and address of template-id

When resolving the address of a template-id, we need to drop functions
whose associated constraints are not satisfied, as per [over.over].  We
do so in resolve_address_of_overloaded_function, but not in
resolve_overloaded_unification or resolve_nondeduced_context, which
seems like an oversight.

gcc/cp/ChangeLog:

* pt.c (resolve_overloaded_unification): Drop functions with
unsatisfied constraints.
(resolve_nondeduced_context): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-fn5.C: New test.
* g++.dg/concepts/fn8.C: Generalize dg-error directive to accept
"no matching function ..." diagnostic.
* g++.dg/cpp2a/concepts-fn1.C: Likewise.
* g++.dg/cpp2a/concepts-ts2.C: Likewise.
* g++.dg/cpp2a/concepts-ts3.C: Likewise.

(cherry picked from commit 41fd9d26108fc98bbffce3d99d218a6a09fa80c6)

4 years agoBump LTO version
Jan Hubicka [Thu, 13 Aug 2020 15:52:45 +0000 (17:52 +0200)] 
Bump LTO version

* lto-streamer.h (LTO_minor_version): Bump version.

4 years agoFix ICE in ODR enum streaming [PR95548]
Jan Hubicka [Sat, 6 Jun 2020 20:19:46 +0000 (22:19 +0200)] 
Fix ICE in ODR enum streaming [PR95548]

gcc/ChangeLog:

2020-06-06  Jan Hubicka  <hubicka@ucw.cz>

PR lto/95548
* ipa-devirt.c (struct odr_enum_val): Turn values to wide_int.
(ipa_odr_summary_write): Update streaming.
(ipa_odr_read_section): Update streaming.

gcc/testsuite/ChangeLog:

2020-06-06  Jan Hubicka  <hubicka@ucw.cz>

* g++.dg/torture/pr95548.C: New test.

(cherry picked from commit eca7a60bd24ebd91addd785e420a06d8f5086634)

4 years agoOptimize ODR enum streaming
Jan Hubicka [Wed, 3 Jun 2020 19:16:43 +0000 (21:16 +0200)] 
Optimize ODR enum streaming

it turns out that half of the global decl stream of cc1 LTO build consits
TREE_LISTS, identifiers and integer cosntats representing TYPE_VALUES of enums.
Those are streamed only to produce ODR warning and used otherwise, so this
patch moves the info to a separate section that is represented and streamed
more effectively.

This also adds place for more info that may be used for ODR diagnostics
(i.e. at the moment we do not warn when the declarations differs i.e. by the
associated member functions and their types) and the type inheritance graph
rather then poluting the global stream.

I was bit unsure what enums we want to store into the section.  All parsed
enums is probably too expensive, only those enums streamed to represent IL is
bit hard to get, so I went for those seen by free lang data.

As a plus we now get bit more precise warning because also the location of
mismatched enum CONST_DECL is streamed.

It changes:
[WPA] read 4608466 unshared trees
[WPA] read 2942094 mergeable SCCs of average size 1.365328
[WPA] 8625389 tree bodies read in total
[WPA] tree SCC table: size 524287, 247652 elements, collision ratio: 0.383702
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 2694442 SCCs, 228 collisions (0.000085)
[WPA] Merged 2694419 SCCs
[WPA] Merged 3731982 tree bodies
[WPA] Merged 633335 types
[WPA] 122077 types prevailed (155548 associated trees)
...
[WPA] Compression: 110593119 input bytes, 287696614 uncompressed bytes (ratio: 2.601397)
[WPA] Size of mmap'd section decls: 85628556 bytes
[WPA] Size of mmap'd section function_body: 13842928 bytes

[WPA] read 1720989 unshared trees
[WPA] read 1252217 mergeable SCCs of average size 1.858507
[WPA] 4048243 tree bodies read in total
[WPA] tree SCC table: size 524287, 226524 elements, collision ratio: 0.491759
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 1025693 SCCs, 196 collisions (0.000191)
[WPA] Merged 1025670 SCCs
[WPA] Merged 2063373 tree bodies
[WPA] Merged 633497 types
[WPA] 122299 types prevailed (155827 associated trees)
...
[WPA] Compression: 103428770 input bytes, 281151423 uncompressed bytes (ratio: 2.718310)
[WPA] Size of mmap'd section decls: 49390917 bytes
[WPA] Size of mmap'd section function_body: 13858258 bytes
...
[WPA] Size of mmap'd section odr_types: 29054816 bytes

So number of SCCs streamed drops to 38% and the number of unshared trees (that
are bit misnamed since it is mostly integer_cst) to 37%.

Things speeds up correspondingly, but I did not save time report from previous
build.

The enum values are still quite surprisingly large.  I may take a look into
ways getting it smaller incrementally, but it streams reasonably fast:

Time variable                                   usr           sys          wall               GGC
 phase opt and generate             :  25.20 ( 68%)  10.88 ( 72%)  36.13 ( 69%)  868060 kB ( 52%)
 phase stream in                    :   4.46 ( 12%)   0.90 (  6%)   5.38 ( 10%)  790724 kB ( 48%)
 phase stream out                   :   6.69 ( 18%)   3.32 ( 22%)  10.03 ( 19%)       8 kB (  0%)
 ipa lto gimple in                  :   0.79 (  2%)   1.86 ( 12%)   2.39 (  5%)  252612 kB ( 15%)
 ipa lto gimple out                 :   2.48 (  7%)   0.78 (  5%)   3.26 (  6%)       0 kB (  0%)
 ipa lto decl in                    :   1.71 (  5%)   0.46 (  3%)   2.34 (  4%)  417883 kB ( 25%)
 ipa lto decl out                   :   3.28 (  9%)   0.07 (  0%)   3.27 (  6%)       0 kB (  0%)
 whopr wpa I/O                      :   0.40 (  1%)   2.24 ( 15%)   2.77 (  5%)       8 kB (  0%)
 lto stream decompression           :   1.38 (  4%)   0.31 (  2%)   1.36 (  3%)       0 kB (  0%)
 ipa ODR types                      :   0.18 (  0%)   0.02 (  0%)   0.25 (  0%)       0 kB (  0%)
 ipa inlining heuristics            :  11.64 ( 31%)   1.45 ( 10%)  13.12 ( 25%)  453160 kB ( 27%)
 ipa pure const                     :   1.74 (  5%)   0.00 (  0%)   1.76 (  3%)       0 kB (  0%)
 ipa icf                            :   1.72 (  5%)   5.33 ( 35%)   7.06 ( 13%)   16593 kB (  1%)
 whopr partitioning                 :   2.22 (  6%)   0.01 (  0%)   2.23 (  4%)    5689 kB (  0%)
 TOTAL                              :  37.17         15.20         52.46        1660886 kB

LTO-bootstrapped/regtested x86_64-linux, will comit it shortly.

gcc/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* ipa-devirt.c: Include data-streamer.h, lto-streamer.h and
streamer-hooks.h.
(odr_enums): New static var.
(struct odr_enum_val): New struct.
(class odr_enum): New struct.
(odr_enum_map): New hashtable.
(odr_types_equivalent_p): Drop code testing TYPE_VALUES.
(add_type_duplicate): Likewise.
(free_odr_warning_data): Do not free TYPE_VALUES.
(register_odr_enum): New function.
(ipa_odr_summary_write): New function.
(ipa_odr_read_section): New function.
(ipa_odr_summary_read): New function.
(class pass_ipa_odr): New pass.
(make_pass_ipa_odr): New function.
* ipa-utils.h (register_odr_enum): Declare.
* lto-section-in.c: (lto_section_name): Add odr_types section.
* lto-streamer.h (enum lto_section_type): Add odr_types section.
* passes.def: Add odr_types pass.
* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
TYPE_VALUES.
(hash_tree): Likewise.
* tree-streamer-in.c (lto_input_ts_type_non_common_tree_pointers):
Likewise.
* tree-streamer-out.c (write_ts_type_non_common_tree_pointers):
Likewise.
* timevar.def (TV_IPA_ODR): New timervar.
* tree-pass.h (make_pass_ipa_odr): Declare.
* tree.c (free_lang_data_in_type): Regiser ODR types.

gcc/lto/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (compare_tree_sccs_1): Do not compare TYPE_VALUES.

gcc/testsuite/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* g++.dg/lto/pr84805_0.C: Update.

(cherry picked from commit 3fb68f2e666d9de7e0326af9f43b12c9e98f19a6)

Fix typo.

4 years agoDo not stream redundant stuff
Jan Hubicka [Mon, 25 May 2020 12:41:33 +0000 (14:41 +0200)] 
Do not stream redundant stuff

as discussed on IRC this adds knob to disable stuff we stream "just for fun"
(or to make it easier to debug streamer desychnonization).

Te size of .o files in gcc subdirectory is reduced form 506MB to 492MB

gcc/

* lto-streamer-out.c (lto_output_tree): Add streamer_debugging check.
* lto-streamer.h (streamer_debugging): New constant
* tree-streamer-in.c (streamer_read_tree_bitfields): Add
streamer_debugging check.
(streamer_get_pickled_tree): Likewise.
* tree-streamer-out.c (pack_ts_base_value_fields): Likewise.

(cherry picked from commit a746f952abb78af9db28a7f3bce442e113877c9c)
(cherry picked from commit 9d679bd7b621c93c000b7d548f34f3438e0d57a8)

4 years agoAvoid streaming stray references.
Jan Hubicka [Fri, 22 May 2020 14:37:06 +0000 (16:37 +0200)] 
Avoid streaming stray references.

this patch avoids stremaing completely useless stray references to gobal decl
stream.  I am re-testing the patch (rebased to current tree) on x86_64-linux
and intend to commit once testing finishes.

gcc/ChangeLog:

2020-05-22  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-out.c (lto_output_tree): Do not stream final ref if
it is not needed.

gcc/lto/ChangeLog:

2020-05-22  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (lto_read_decls): Do not skip stray refs.

(cherry picked from commit bcb63eb2cbd3caf212b9cf42d8c218c09dc6ff8b)
(cherry picked from commit 57400cf273f8052c601d90d86a47705faa17aaa9)

4 years agoFix hashing of prestreamed nodes
Jan Hubicka [Fri, 22 May 2020 10:31:34 +0000 (12:31 +0200)] 
Fix hashing of prestreamed nodes

this patch seems to solve basically all collisions while building cc1.
From:

[WPA] read 3312246 unshared trees
[WPA] read 1144381 mergeable SCCs of average size 4.833785
[WPA] 8843938 tree bodies read in total
[WPA] tree SCC table: size 524287, 197767 elements, collision ratio: 0.506446
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 946614 SCCs, 775077 collisions (0.818789)

to

[WPA] read 3314520 unshared trees
[WPA] read 1144763 mergeable SCCs of average size 4.835021
[WPA] 8849473 tree bodies read in total
[WPA] tree SCC table: size 524287, 200574 elements, collision ratio: 0.486418
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 944189 SCCs, 179 collisions (0.000190)

The problem is that preloaded nodes all have hash code 0 because
cache->nodes.length is not updated while streaming out.

I also added an arbitrary constant to avoid clash with constant of 0 used to
hash NULL pointers and 1 used to hash pointers inside SCC.

* tree-streamer.c (record_common_node): Fix hash value of pre-streamed
nodes.

(cherry picked from commit 1089a367c4b05b5e3f072adca8913904ed65928c)
(cherry picked from commit 5c7ed52a039cfafb63c27fa8c1535e02dfc1ae09)

4 years agoSimplify streaming of SCC components
Jan Hubicka [Fri, 22 May 2020 10:29:19 +0000 (12:29 +0200)] 
Simplify streaming of SCC components

this patch saves few bytes from SCC streaming.  First we stream end markers
that are fully ignored at stream in.
Second I missed streaming of emtry_len in the previous change so it is
pointlessly streamed for LTO_trees. Moreover entry_len is almost always 1
(always during gcc bootstrap) and thus it makes sense to avoid stremaing it
in majority of cases.

gcc/ChangeLog:

2020-05-21  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-in.c (lto_read_tree): Do not stream end markers.
(lto_input_scc): Optimize streaming of entry lengths.
* lto-streamer-out.c (lto_write_tree): Do not stream end markers
(DFS::DFS): Optimize stremaing of entry lengths

(cherry picked from commit 47273df0bcdd552385f25049dce71943aac8321e)
(cherry picked from commit f55838d8ec18a499ff2f521bea66bbb54f70c56b)

4 years agoAvoid SCC hashing on unmergeable trees
Jan Hubicka [Wed, 20 May 2020 13:58:22 +0000 (15:58 +0200)] 
Avoid SCC hashing on unmergeable trees

This is new incarantion of patch to identify unmergeable tree at streaming out
time rather than streaming in and to avoid pickling them to sccs with with hash
codes.

Building cc1 plus this patch reduces:

[WPA] read 4452927 SCCs of average size 1.986030
[WPA] 8843646 tree bodies read in total
[WPA] tree SCC table: size 524287, 205158 elements, collision ratio: 0.505204
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 947551 SCCs, 780270 collisions (0.823460)
[WPA] Merged 944038 SCCs
[WPA] Merged 5253521 tree bodies
[WPA] Merged 590027 types
...
[WPA] Size of mmap'd section decls: 99229066 bytes
[WPA] Size of mmap'd section function_body: 18398837 bytes
[WPA] Size of mmap'd section refs: 733678 bytes
[WPA] Size of mmap'd section jmpfuncs: 2965981 bytes
[WPA] Size of mmap'd section pureconst: 170248 bytes
[WPA] Size of mmap'd section profile: 17985 bytes
[WPA] Size of mmap'd section symbol_nodes: 3392736 bytes
[WPA] Size of mmap'd section inline: 2693920 bytes
[WPA] Size of mmap'd section icf: 435557 bytes
[WPA] Size of mmap'd section offload_table: 0 bytes
[WPA] Size of mmap'd section lto: 4320 bytes
[WPA] Size of mmap'd section ipa_sra: 651660 bytes

... to ...

[WPA] read 3312246 unshared trees
[WPA] read 1144381 mergeable SCCs of average size 4.833785
[WPA] 8843938 tree bodies read in total
[WPA] tree SCC table: size 524287, 197767 elements, collision ratio: 0.506446
[WPA] tree SCC max chain length 43 (size 1)
[WPA] Compared 946614 SCCs, 775077 collisions (0.818789)
[WPA] Merged 943798 SCCs
[WPA] Merged 5253336 tree bodies
[WPA] Merged 590105 types
....
[WPA] Size of mmap'd section decls: 81262144 bytes
[WPA] Size of mmap'd section function_body: 14702611 bytes
[WPA] Size of mmap'd section ext_symtab: 0 bytes
[WPA] Size of mmap'd section refs: 733695 bytes
[WPA] Size of mmap'd section jmpfuncs: 2332150 bytes
[WPA] Size of mmap'd section pureconst: 170292 bytes
[WPA] Size of mmap'd section profile: 17986 bytes
[WPA] Size of mmap'd section symbol_nodes: 3393358 bytes
[WPA] Size of mmap'd section inline: 2567939 bytes
[WPA] Size of mmap'd section icf: 435633 bytes
[WPA] Size of mmap'd section lto: 4320 bytes
[WPA] Size of mmap'd section ipa_sra: 651824 bytes

so results in about 22% reduction in global decl stream and 24% reduction on
function bodies stream (which is read mostly by ICF)

Martin, the zstd compression breaks the compression statistics (it works when
GCC is configured for zlib)

At first ltrans I get:

[LTRANS] Size of mmap'd section decls: 3734248 bytes
[LTRANS] Size of mmap'd section function_body: 4895962 bytes

... to ...

[LTRANS] Size of mmap'd section decls: 3479850 bytes
[LTRANS] Size of mmap'd section function_body: 3722935 bytes

So 7% reduction of global stream and 31% reduction of function bodies.

Stream in seems to get about 3% faster and stream out about 5% but it is
close to noise factor of my experiment.  I expect bigger speedups on
Firefox but I did not test it today since my Firefox setup broke again.
GCC is not very good example on the problem with anonymous namespace
types since we do not have so many of them.

Sice of object files in gcc directory is reduced by 11% (because hash
numbers do not compress well I guess).

The patch makes DFS walk to recognize trees that are not merged (anonymous
namespace, local function/variable decls, anonymous types etc).  As discussed
on IRC this is now done during the SCC walk rather than during the hash
computation.  When local tree is discovered we know that SCC components of everything that is on
the stack reffers to it and thus is also local. Moreover we mark trees into hash set in output block
so if we get a cross edge referring to local tree it gets marked too.

Patch also takes care of avoiding SCC wrappers around some trees. In particular
 1) singleton unmergeable SCCs are now streamed inline in global decl stream
    This includes INTEGER_CSTs and IDENTIFIER_NODEs that are shared by different
    code than rest of tree merging.
 2) We use LTO_trees instead of LTO_tree_scc to wrap unmergeable SCC components.
    It is still necessary to mark them because of forward references.  LTO_trees
    has simple header with number of trees and then things are streamed same way
    as for LTO_tree_scc. That is tree headers first followed by pickled references
    so things may point to future.

    Of course it is not necessary for LTO_tree_scc to be single component and
    streamer out may group more components together, but I decided to not snowball
    the patch even more
 3) In local streams when lto_output_tree is called and the topmost SCC components
    turns out to be singleton we stream the tree directly
    instead of LTO_tree_scc, hash code, pickled tree, reference to just stremaed tree.

    LTO_trees is used to wrap all trees needed to represent tree being streamed.
    It would make sense again to use only one LTO_trees rather than one per SCC
    but I think this can be done incrementally.

In general local trees are now recognized by new predicate local_tree_p

Bit subtle is handing of TRANLSATION_UNIT_DECL, INTEGER_CST and
IDENTIFIER_NODE.

TRANSLATION_UNIT_DECL a local tree but references to it does not make
other trees local (because we also understand local decls now).
So I check for it later after localness propagation is done.

INTEGER_CST and IDENTIFIER_NODEs are merged but not via the tree merging
machinery. So it makes sense to stream them as unmergeable trees but we
still need to compute their hashes so SCCs referring them do not get too
large collision chains.  For this reason they are checked just prior
stream out.

lto-bootstrapped/regteted x86_64-linux, OK?

gcc/ChangeLog:

2020-05-19  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-in.c (lto_input_scc): Add SHARED_SCC parameter.
(lto_input_tree_1): Strenghten sanity check.
(lto_input_tree): Update call of lto_input_scc.
* lto-streamer-out.c: Include ipa-utils.h
(create_output_block): Initialize local_trees if merigng is going
to happen.
(destroy_output_block): Destroy local_trees.
(DFS): Add max_local_entry.
(local_tree_p): New function.
(DFS::DFS): Initialize and maintain it.
(DFS::DFS_write_tree): Decide on streaming format.
(lto_output_tree): Stream inline singleton SCCs
* lto-streamer.h (enum LTO_tags): Add LTO_trees.
(struct output_block): Add local_trees.
(lto_input_scc): Update prototype.

gcc/lto/ChangeLog:

2020-05-19  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (compare_tree_sccs_1): Sanity check that we never
read TRANSLATION_UNIT_DECL.
(process_dref): Break out from ...
(unify_scc): ... here.
(process_new_tree): Break out from ...
(lto_read_decls): ... here; handle streaming of singleton trees.
(print_lto_report_1): Update statistics.

(cherry picked from commit 03d90a20a1afcbb9c30da8d4adf4922b0685061f)
(cherry picked from commit c6328b32770132efa004a3cad127cf74be84e911)

4 years agoipa: fix ICE in get_default_value
Martin Liska [Thu, 13 Aug 2020 07:38:41 +0000 (09:38 +0200)] 
ipa: fix ICE in get_default_value

The patch aligns code with ipcp_bits_lattice::set_to_constant
where we properly mask m_value with m_mask. The same should
be done here.

gcc/ChangeLog:

PR ipa/96482
* ipa-cp.c (ipcp_bits_lattice::meet_with_1): Mask m_value
with m_mask.

gcc/testsuite/ChangeLog:

PR ipa/96482
* gcc.dg/ipa/pr96482-2.c: New test.

(cherry picked from commit f91770216eade83f068528c1e4f00e2ac3b23044)

4 years agoDaily bump.
GCC Administrator [Thu, 13 Aug 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

4 years agoRe: PR96493, powerpc local call linkage failure
Alan Modra [Mon, 10 Aug 2020 13:31:12 +0000 (23:01 +0930)] 
Re: PR96493, powerpc local call linkage failure

PR target/96525
* gcc.target/powerpc/pr96493.c: Make it a link test when no
power10_hw.  Require power10_ok.

(cherry picked from commit 2ba0674c657fb2089d8aae4f8c254ce0559c8f53)

4 years agoPR96493, powerpc local call linkage failure
Alan Modra [Thu, 6 Aug 2020 04:42:21 +0000 (14:12 +0930)] 
PR96493, powerpc local call linkage failure

This corrects current_file_function_operand, an operand predicate used
to determine whether a symbol_ref is safe to use with the local_call
patterns.  Calls between pcrel and non-pcrel code need to go via
linker stubs.  In the case of non-pcrel code to pcrel the stub saves
r2 but there needs to be a nop after the branch for the r2 restore.
So the local_call patterns can't be used there.  For pcrel code to
non-pcrel the local_call patterns could still be used, but I thought
it better to not use them since the call isn't direct.  Code generated
by the corresponding call_nonlocal_aix for pcrel is identical anyway.

Incidentally, without the TREE_CODE () == FUNCTION_DECL test,
gcc.c-torture/compile/pr37433.c and pr37433-1.c ICE.  Also, if you
make the test more strict by disallowing an op without a
SYMBOL_REF_DECL then a bunch of go and split-stack tests fail.  That's
because a prologue call to __morestack can't have a following nop.
(__morestack calls its caller at a fixed offset from the __morestack
call!)

gcc/
PR target/96493
* config/rs6000/predicates.md (current_file_function_operand): Don't
accept functions that differ in r2 usage.

gcc/testsuite/
* gcc.target/powerpc/pr96493.c: New file.

(cherry picked from commit f8ac30f1653ff69706c35af6d725f1d330600f11)

4 years agonvptx: Add support for subword compare-and-swap
Kwok Cheung Yeung [Wed, 12 Aug 2020 19:37:20 +0000 (12:37 -0700)] 
nvptx: Add support for subword compare-and-swap

This adds support for __sync_val_compare_and_swap and
__sync_bool_compare_and_swap for 1-byte and 2-byte long
values, which are not natively supported on nvptx.

2020-08-12  Kwok Cheung Yeung  <kcy@codesourcery.com>

libgcc/
* config/nvptx/atomic.c: New.
* config/nvptx/t-nvptx (LIB2ADD): Add atomic.c.

gcc/testsuite/
* gcc.target/nvptx/sync.c: New.

libgomp/
* testsuite/libgomp.c-c++-common/reduction-16.c: New.

4 years agoipa: fix bit CPP when combined with IPA bit CP
Martin Liska [Wed, 12 Aug 2020 07:21:51 +0000 (09:21 +0200)] 
ipa: fix bit CPP when combined with IPA bit CP

As mentioned in the PR, let's consider the following example:

int
__attribute__((noinline))
foo(int arg)
{
  if (arg == 3)
    return 1;
  if (arg == 4)
    return 123;

  __builtin_unreachable ();
}

during WPA we find all calls of the function
(yes the call with value 5 is UBSAN):

  Node: foo/0:
    param [0]: 5 [loc_time: 4, loc_size: 2, prop_time: 0, prop_size: 0]
               3 [loc_time: 3, loc_size: 3, prop_time: 0, prop_size: 0]
         ctxs: VARIABLE
         Bits: value = 0x5, mask = 0x6

in LTRANS we have the following VRP info:

  # RANGE [3, 3] NONZERO 3

when we AND masks in get_default_value we end up with 6 & 3 = 2 (0x010).
That means the only second (least significant bit) is unknown and
value (5 = 0x101) & ~mask gives us either 7 (0x111) or 5 (0x101).

That's why if (arg_2(D) == 3) gets optimized to false.

gcc/ChangeLog:

PR ipa/96482
* ipa-cp.c (ipcp_bits_lattice::meet_with_1): Drop value bits
for bits that are unknown.
(ipcp_bits_lattice::set_to_constant): Likewise.
* tree-ssa-ccp.c (get_default_value): Add sanity check that
IPA CP bit info has all bits set to zero in bits that
are unknown.

gcc/testsuite/ChangeLog:

PR ipa/96482
* gcc.dg/ipa/pr96482.c: New test.

(cherry picked from commit d58f078ce2d53e5dab6b3d0d5f960504268e1894)

4 years agoipa/96291: don't crash on unoptimized lto functions
Sergei Trofimovich [Sat, 25 Jul 2020 18:26:50 +0000 (19:26 +0100)] 
ipa/96291: don't crash on unoptimized lto functions

In PR ipa/96291 the test contained an SCC with one
unoptimized function. This tricked ipa-cp into NULL dereference.

has_undead_caller_from_outside_scc_p() did not take into account
that unoptimized funtions don't have IPA summary analysis. And
dereferenced NULL pointer causing an ICE.

gcc/
PR ipa/96291
* ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider
unoptimized callers as undead.

gcc/testsuite/
PR ipa/96291
* gcc.dg/lto/pr96291_0.c: New testcase.
* gcc.dg/lto/pr96291_1.c: Support file.
* gcc.dg/lto/pr96291_2.c: Likewise.
* gcc.dg/lto/pr96291.h: Likewise.

(cherry picked from commit cbf10ac51c0b889e930f260a3d1fb601332befdf)

4 years agobpf: remove trailing whitespaces from source files
Jose E. Marchesi [Wed, 12 Aug 2020 14:56:07 +0000 (16:56 +0200)] 
bpf: remove trailing whitespaces from source files

This patch is a little cleanup that removes trailing whitespaces from
the bpf backend source files.

(cherry pick of commit e87c540fe43e29663140ed67b98ee437c25696bb)

2020-08-07  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.md: Remove trailing whitespaces.
* config/bpf/constraints.md: Likewise.
* config/bpf/predicates.md: Likewise.

gcc/testsuite/
* gcc.target/bpf/diag-funargs-2.c: Remove trailing whitespaces.
* gcc.target/bpf/skb-ancestor-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-meta.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-head.c: Likewise.
* gcc.target/bpf/helper-tcp-check-syncookie.c: Likewise.
* gcc.target/bpf/helper-sock-ops-cb-flags-set.c
* gcc.target/bpf/helper-sysctl-set-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-name.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-current-value.c: Likewise.
* gcc.target/bpf/helper-strtoul.c: Likewise.
* gcc.target/bpf/helper-strtol.c: Likewise.
* gcc.target/bpf/helper-sock-map-update.c: Likewise.
* gcc.target/bpf/helper-sk-storage-get.c: Likewise.
* gcc.target/bpf/helper-sk-storage-delete.c: Likewise.
* gcc.target/bpf/helper-sk-select-reuseport.c: Likewise.
* gcc.target/bpf/helper-sk-release.c: Likewise.
* gcc.target/bpf/helper-sk-redirect-map.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-upd.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-tcp.c: Likewise.
* gcc.target/bpf/helper-skb-change-head.c: Likewise.
* gcc.target/bpf/helper-skb-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-skb-adjust-room.c: Likewise.
* gcc.target/bpf/helper-set-hash.c: Likewise.
* gcc.target/bpf/helper-setsockopt.c: Likewise.
* gcc.target/bpf/helper-redirect-map.c: Likewise.
* gcc.target/bpf/helper-rc-repeat.c: Likewise.
* gcc.target/bpf/helper-rc-keydown.c: Likewise.
* gcc.target/bpf/helper-probe-read-str.c: Likewise.
* gcc.target/bpf/helper-perf-prog-read-value.c: Likewise.
* gcc.target/bpf/helper-perf-event-read-value.c: Likewise.
* gcc.target/bpf/helper-override-return.c: Likewise.
* gcc.target/bpf/helper-msg-redirect-map.c: Likewise.
* gcc.target/bpf/helper-msg-pull-data.c: Likewise.
* gcc.target/bpf/helper-msg-cork-bytes.c: Likewise.
* gcc.target/bpf/helper-msg-apply-bytes.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-store-bytes.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-adjust-srh.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-action.c: Likewise.
* gcc.target/bpf/helper-lwt-push-encap.c: Likewise.
* gcc.target/bpf/helper-get-socket-uid.c: Likewise.
* gcc.target/bpf/helper-get-socket-cookie.c: Likewise.
* gcc.target/bpf/helper-get-local-storage.c: Likewise.
* gcc.target/bpf/helper-get-current-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-getsockopt.c: Likewise.
* gcc.target/bpf/diag-funargs-3.c: Likewise.

4 years agobpf: more flexible support for kernel helpers
Jose E. Marchesi [Wed, 12 Aug 2020 14:55:49 +0000 (16:55 +0200)] 
bpf: more flexible support for kernel helpers

This patch changes the existing support for BPF kernel helpers to be
more flexible, in two main ways.

First, there is no longer a hardcoded list of kernel helpers defined
in the compiler internals.  This is replaced by a new target-specific
attribute `kernel_helper' that the user can use to define her own
helpers, annotating function prototypes.

Second, following feedback from the kernel hackers, the pre-defined
helpers in the distributed bpf-helpers.h are no longer available
conditionally depending on the kernel version used in -mkernel.  The
command-line option stays for now, as it may be useful for other
things.

Target tests and documentation updated.

(cherry pick of commit af30b83b50953fbbe671d93d44ea6ac2f7a50ce9)

2020-08-06  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf-helpers.h (KERNEL_HELPER): Define.
(KERNEL_VERSION): Remove.
* config/bpf/bpf-helpers.def: Delete.
* config/bpf/bpf.c (bpf_handle_fndecl_attribute): New function.
(bpf_attribute_table): Define.
(bpf_helper_names): Delete.
(bpf_helper_code): Likewise.
(enum bpf_builtins): Adjust to new helpers mechanism.
(bpf_output_call): Likewise.
(bpf_init_builtins): Likewise.
(bpf_init_builtins): Likewise.
* doc/extend.texi (BPF Function Attributes): New section.
(BPF Kernel Helpers): Delete section.

gcc/testsuite/
* gcc.target/bpf/helper-bind.c: Adjust to new kernel helpers
mechanism.
* gcc.target/bpf/helper-bpf-redirect.c: Likewise.
* gcc.target/bpf/helper-clone-redirect.c: Likewise.
* gcc.target/bpf/helper-csum-diff.c: Likewise.
* gcc.target/bpf/helper-csum-update.c: Likewise.
* gcc.target/bpf/helper-current-task-under-cgroup.c: Likewise.
* gcc.target/bpf/helper-fib-lookup.c: Likewise.
* gcc.target/bpf/helper-get-cgroup-classid.c: Likewise.
* gcc.target/bpf/helper-get-current-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-get-current-comm.c: Likewise.
* gcc.target/bpf/helper-get-current-pid-tgid.c: Likewise.
* gcc.target/bpf/helper-get-current-task.c: Likewise.
* gcc.target/bpf/helper-get-current-uid-gid.c: Likewise.
* gcc.target/bpf/helper-get-hash-recalc.c: Likewise.
* gcc.target/bpf/helper-get-listener-sock.c: Likewise.
* gcc.target/bpf/helper-get-local-storage.c: Likewise.
* gcc.target/bpf/helper-get-numa-node-id.c: Likewise.
* gcc.target/bpf/helper-get-prandom-u32.c: Likewise.
* gcc.target/bpf/helper-get-route-realm.c: Likewise.
* gcc.target/bpf/helper-get-smp-processor-id.c: Likewise.
* gcc.target/bpf/helper-get-socket-cookie.c: Likewise.
* gcc.target/bpf/helper-get-socket-uid.c: Likewise.
* gcc.target/bpf/helper-get-stack.c: Likewise.
* gcc.target/bpf/helper-get-stackid.c: Likewise.
* gcc.target/bpf/helper-getsockopt.c: Likewise.
* gcc.target/bpf/helper-ktime-get-ns.c: Likewise.
* gcc.target/bpf/helper-l3-csum-replace.c: Likewise.
* gcc.target/bpf/helper-l4-csum-replace.c: Likewise.
* gcc.target/bpf/helper-lwt-push-encap.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-action.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-adjust-srh.c: Likewise.
* gcc.target/bpf/helper-lwt-seg6-store-bytes.c: Likewise.
* gcc.target/bpf/helper-map-delete-elem.c: Likewise.
* gcc.target/bpf/helper-map-lookup-elem.c: Likewise.
* gcc.target/bpf/helper-map-peek-elem.c: Likewise.
* gcc.target/bpf/helper-map-pop-elem.c: Likewise.
* gcc.target/bpf/helper-map-push-elem.c: Likewise.
* gcc.target/bpf/helper-map-update-elem.c: Likewise.
* gcc.target/bpf/helper-msg-apply-bytes.c: Likewise.
* gcc.target/bpf/helper-msg-cork-bytes.c: Likewise.
* gcc.target/bpf/helper-msg-pop-data.c: Likewise.
* gcc.target/bpf/helper-msg-pull-data.c: Likewise.
* gcc.target/bpf/helper-msg-push-data.c: Likewise.
* gcc.target/bpf/helper-msg-redirect-hash.c: Likewise.
* gcc.target/bpf/helper-msg-redirect-map.c: Likewise.
* gcc.target/bpf/helper-override-return.c: Likewise.
* gcc.target/bpf/helper-perf-event-output.c: Likewise.
* gcc.target/bpf/helper-perf-event-read-value.c: Likewise.
* gcc.target/bpf/helper-perf-event-read.c: Likewise.
* gcc.target/bpf/helper-perf-prog-read-value.c: Likewise.
* gcc.target/bpf/helper-probe-read-str.c: Likewise.
* gcc.target/bpf/helper-probe-read.c: Likewise.
* gcc.target/bpf/helper-probe-write-user.c: Likewise.
* gcc.target/bpf/helper-rc-keydown.c: Likewise.
* gcc.target/bpf/helper-rc-pointer-rel.c: Likewise.
* gcc.target/bpf/helper-rc-repeat.c: Likewise.
* gcc.target/bpf/helper-redirect-map.c: Likewise.
* gcc.target/bpf/helper-set-hash-invalid.c: Likewise.
* gcc.target/bpf/helper-set-hash.c: Likewise.
* gcc.target/bpf/helper-setsockopt.c: Likewise.
* gcc.target/bpf/helper-sk-fullsock.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-tcp.c: Likewise.
* gcc.target/bpf/helper-sk-lookup-upd.c: Likewise.
* gcc.target/bpf/helper-sk-redirect-hash.c: Likewise.
* gcc.target/bpf/helper-sk-redirect-map.c: Likewise.
* gcc.target/bpf/helper-sk-release.c: Likewise.
* gcc.target/bpf/helper-sk-select-reuseport.c: Likewise.
* gcc.target/bpf/helper-sk-storage-delete.c: Likewise.
* gcc.target/bpf/helper-sk-storage-get.c: Likewise.
* gcc.target/bpf/helper-skb-adjust-room.c: Likewise.
* gcc.target/bpf/helper-skb-cgroup-id.c: Likewise.
* gcc.target/bpf/helper-skb-change-head.c: Likewise.
* gcc.target/bpf/helper-skb-change-proto.c: Likewise.
* gcc.target/bpf/helper-skb-change-tail.c: Likewise.
* gcc.target/bpf/helper-skb-change-type.c: Likewise.
* gcc.target/bpf/helper-skb-ecn-set-ce.c: Likewise.
* gcc.target/bpf/helper-skb-get-tunnel-key.c: Likewise.
* gcc.target/bpf/helper-skb-get-tunnel-opt.c: Likewise.
* gcc.target/bpf/helper-skb-get-xfrm-state.c: Likewise.
* gcc.target/bpf/helper-skb-load-bytes-relative.c: Likewise.
* gcc.target/bpf/helper-skb-load-bytes.c: Likewise.
* gcc.target/bpf/helper-skb-pull-data.c: Likewise.
* gcc.target/bpf/helper-skb-set-tunnel-key.c: Likewise.
* gcc.target/bpf/helper-skb-set-tunnel-opt.c: Likewise.
* gcc.target/bpf/helper-skb-store-bytes.c: Likewise.
* gcc.target/bpf/helper-skb-under-cgroup.c: Likewise.
* gcc.target/bpf/helper-skb-vlan-pop.c: Likewise.
* gcc.target/bpf/helper-skb-vlan-push.c: Likewise.
* gcc.target/bpf/helper-skc-lookup-tcp.c: Likewise.
* gcc.target/bpf/helper-sock-hash-update.c: Likewise.
* gcc.target/bpf/helper-sock-map-update.c: Likewise.
* gcc.target/bpf/helper-sock-ops-cb-flags-set.c: Likewise.
* gcc.target/bpf/helper-spin-lock.c: Likewise.
* gcc.target/bpf/helper-spin-unlock.c: Likewise.
* gcc.target/bpf/helper-strtol.c: Likewise.
* gcc.target/bpf/helper-strtoul.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-current-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-name.c: Likewise.
* gcc.target/bpf/helper-sysctl-get-new-value.c: Likewise.
* gcc.target/bpf/helper-sysctl-set-new-value.c: Likewise.
* gcc.target/bpf/helper-tail-call.c: Likewise.
* gcc.target/bpf/helper-tcp-check-syncookie.c: Likewise.
* gcc.target/bpf/helper-tcp-sock.c: Likewise.
* gcc.target/bpf/helper-trace-printk.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-head.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-meta.c: Likewise.
* gcc.target/bpf/helper-xdp-adjust-tail.c: Likewise.
* gcc.target/bpf/skb-ancestor-cgroup-id.c: Likewise.

4 years agobpf: do not save/restore callee-saved registers in function prolog/epilog
Jose E. Marchesi [Wed, 12 Aug 2020 14:55:30 +0000 (16:55 +0200)] 
bpf: do not save/restore callee-saved registers in function prolog/epilog

BPF considers that every call to a function allocates a fresh set of
registers that are available to the callee, of which the first five
may have bee initialized with the function arguments.  This is
implemented by both interpreter and JIT in the Linux kernel.

This is enforced by the kernel BPF verifier, which will reject any
code in which non-initialized registers are accessed before being
written.  Consequently, the spill instructions generated in function
prologue were causing the verifier to reject our compiled programs.

This patch makes GCC to not save/restore callee-saved registers in
function prologue/epilogue, unless xBPF mode is enabled.

(cherry pick of commit 98456a64b0b5c20eeb8f964c7718072ba9b0e568)

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.c (bpf_compute_frame_layout): Include space for
callee saved registers only in xBPF.
(bpf_expand_prologue): Save callee saved registers only in xBPF.
(bpf_expand_epilogue): Likewise for restoring.
* doc/invoke.texi (eBPF Options): Document this is activated by
-mxbpf.

gcc/testsuite/
* gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test.
* gcc.target/bpf/xbpf-callee-saved-regs-2.c: Likewise.

4 years agobpf: add support for the -mxbpf option
Jose E. Marchesi [Wed, 12 Aug 2020 14:54:53 +0000 (16:54 +0200)] 
bpf: add support for the -mxbpf option

This patch adds support for a new option -mxbpf.  This tells GCC to
generate code for an expanded version of BPF that relaxes some of the
restrictions imposed by BPF.

(cherry pick of 51e10276d6792f67f1d88d90f299e7ac1b1f1f24)

2020-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/
* config/bpf/bpf.opt (mxbpf): New option.
* doc/invoke.texi (Option Summary): Add -mxbpf.
(eBPF Options): Document -mxbbpf.

4 years agotestsuite: Fix gcc.target/arm/stack-protector-1.c for Cortex-M
Christophe Lyon [Wed, 12 Aug 2020 09:22:38 +0000 (09:22 +0000)] 
testsuite: Fix gcc.target/arm/stack-protector-1.c for Cortex-M

The stack-protector-1.c test fails when compiled for Cortex-M:
- for Cortex-M0/M1, str r0, [sp #-8]! is not supported
- for Cortex-M3/M4..., the assembler complains that "use of r13 is
  deprecated"

This patch replaces the str instruction with
     sub   sp, sp, #8
     str r0, [sp]
and removes the check for r13, which is unlikely to leak the canary
value.

2020-08-11  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/stack-protector-1.c: Adapt code to Cortex-M
restrictions.

(cherry picked from commit 6606fdc0aad85cbca1bb58e1b2ffe05611aabd7a)

4 years agotestsuite: Fix gcc.target/arm/multilib.exp use of gcc_opts
Christophe Lyon [Wed, 12 Aug 2020 08:59:22 +0000 (08:59 +0000)] 
testsuite: Fix gcc.target/arm/multilib.exp use of gcc_opts

This patch fixes an incorrect parameter passing for $gcc_opts, which
produces a DejaGnu error: (DejaGnu) proc "gcc_opts" does not exist.

2020-08-12  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/multilib.exp: Fix parameter passing for gcc_opts.

(cherry picked from commit 73d2b6d4a3f0db82b2bfaba6c275412e5830680d)

4 years agoDaily bump.
GCC Administrator [Wed, 12 Aug 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

4 years agolibstdc++: Disable net tests that depend on threads [PR 89760]
Jonathan Wakely [Tue, 11 Aug 2020 15:55:01 +0000 (16:55 +0100)] 
libstdc++: Disable net tests that depend on threads [PR 89760]

libstdc++-v3/ChangeLog:

PR libstdc++/89760
* testsuite/experimental/net/execution_context/make_service.cc:
Add dg-require-gthreads.
* testsuite/experimental/net/executor/1.cc: Likewise.
* testsuite/experimental/net/headers.cc: Likewise.
* testsuite/experimental/net/internet/address/v4/comparisons.cc:
Likewise.
* testsuite/experimental/net/internet/address/v4/cons.cc:
Likewise.
* testsuite/experimental/net/internet/address/v4/creation.cc:
Likewise.
* testsuite/experimental/net/internet/address/v4/members.cc:
Likewise.
* testsuite/experimental/net/internet/resolver/base.cc:
Likewise.
* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
Likewise.
* testsuite/experimental/net/internet/resolver/ops/reverse.cc:
Likewise.
* testsuite/experimental/net/socket/basic_socket.cc: Likewise.
* testsuite/experimental/net/timer/waitable/cons.cc: Likewise.
* testsuite/experimental/net/timer/waitable/dest.cc: Likewise.
* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.

4 years agoc++: abbreviated function template friend matching [PR96106]
Patrick Palka [Thu, 30 Jul 2020 02:06:36 +0000 (22:06 -0400)] 
c++: abbreviated function template friend matching [PR96106]

In the below testcase, duplicate_decls wasn't merging the tsubsted
friend declaration for 'void add(auto)' with its definition, because
reduce_template_parm_level (during tsubst_friend_function) lost the
DECL_VIRTUAL_P flag on the auto's invented template parameter, which
caused template_heads_equivalent_p to deem the two template heads as not
equivalent in C++20 mode.

This patch makes reduce_template_parm_level carry over the
DECL_VIRTUAL_P flag from the original TEMPLATE_PARM_DECL.

gcc/cp/ChangeLog:

PR c++/96106
* pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
from the original TEMPLATE_PARM_DECL to the new lowered one.

gcc/testsuite/ChangeLog:

PR c++/96106
* g++.dg/concepts/abbrev7.C: New test.

(cherry picked from commit f31dd9beb95f4beda1d2bd5c0526c42d0ce455c4)

4 years agoThis patch fixes PR96312. Cures a used uninitialized warning.
Paul Thomas [Mon, 10 Aug 2020 05:22:22 +0000 (06:22 +0100)] 
This patch fixes PR96312. Cures a used uninitialized warning.

2020-08-10  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/96312
* trans-expr.c (fcncall_realloc_result): Only compare shapes if
lhs was allocated..

gcc/testsuite/
PR fortran/96312
* gfortran.dg/pr96312.f90: New test.

(cherry picked from commit abb276d0eca218e62e5ed50babf12ff544250759)

4 years agoc++: constraints and explicit instantiation [PR96164]
Patrick Palka [Thu, 30 Jul 2020 02:06:33 +0000 (22:06 -0400)] 
c++: constraints and explicit instantiation [PR96164]

When considering to instantiate a member of a class template as part of
an explicit instantiation of the class template, we need to first check
the member's constraints before proceeding with the instantiation of the
member.

gcc/cp/ChangeLog:

PR c++/96164
* constraint.cc (constraints_satisfied_p): Return true if
!flags_concepts.
* pt.c (do_type_instantiation): Update a paragraph taken from
[temp.explicit] to reflect the latest specification.  Don't
instantiate a member with unsatisfied constraints.

gcc/testsuite/ChangeLog:

PR c++/96164
* g++.dg/cpp2a/concepts-explicit-inst5.C: New test.

(cherry picked from commit dc3d1e181445fafbbd146eb355a750c41c338794)

4 years agoDaily bump.
GCC Administrator [Tue, 11 Aug 2020 00:17:18 +0000 (00:17 +0000)] 
Daily bump.

4 years agolibstdc++: Use _wstat64 for Windows [PR 95749]
Jonathan Wakely [Mon, 10 Aug 2020 11:04:27 +0000 (12:04 +0100)] 
libstdc++: Use _wstat64 for Windows [PR 95749]

In order to handle large files on Windows we need to use stat API with
64-bit st_size member.

libstdc++-v3/ChangeLog:

PR libstdc++/95749
* src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
(stat_type): Change to __stat64.
(stat): Use _wstat64.

(cherry picked from commit 9939be5758b52ed2fe1a7e56b94ce6d0f4d81580)

4 years agoUsing UNSPEC for vector compare to mask register.
liuhongt [Mon, 20 Jul 2020 02:13:58 +0000 (10:13 +0800)] 
Using UNSPEC for vector compare to mask register.

For rtx like (eq:HI (V8SI 90) (V8SI 91)), cse will take it as a
boolean value and try to do some optimization. But it is not true for
vector compare, also other places in rtl passes hold the same
assumption.

2020-07-20  Hongtao Liu  <hongtao.liu@intel.com>

gcc/
PR target/96243
* config/i386/i386-expand.c (ix86_expand_sse_cmp): Refine for
maskcmp.
(ix86_expand_mask_vec_cmp): Change prototype.
* config/i386/i386-protos.h (ix86_expand_mask_vec_cmp): Change prototype.
* config/i386/i386.c (ix86_print_operand): Remove operand
modifier 'I'.
* config/i386/sse.md
(*<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>): Deleted.
(*<avx512>_cmp<mode>3<mask_scalar_merge_name>): Ditto.
(*<avx512>_ucmp<mode>3<mask_scalar_merge_name>): Ditto.
(*<avx512>_ucmp<mode>3<mask_scalar_merge_name>,
avx512f_maskcmp<mode>3): Ditto.

gcc/testsuite
* gcc.target/i386/pr92865-1.c: Adjust testcase.

4 years agoFill up {,un}compression stats for ZSTD in LTO.
Martin Liska [Wed, 20 May 2020 12:39:21 +0000 (14:39 +0200)] 
Fill up {,un}compression stats for ZSTD in LTO.

* lto-compress.c (lto_compression_zstd): Fill up
num_compressed_il_bytes.
(lto_uncompression_zstd): Likewise for num_uncompressed_il_bytes here.

(cherry picked from commit 053dc901e0227bb62b65f3a8d7a9deccb61dffa1)

4 years agors6000: MMA built-ins reject typedefs of MMA types
Peter Bergner [Sat, 8 Aug 2020 16:54:48 +0000 (11:54 -0500)] 
rs6000: MMA built-ins reject typedefs of MMA types

We do not allow conversions between the MMA types and other types.
However, we are being too strict in not matching MMA types with
typdefs of those types.  Use TYPE_CANONICAL to see through the
types to their canonical types before comparing them.

2020-08-08  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96530
* config/rs6000/rs6000.c (rs6000_invalid_conversion): Use canonical
types for type comparisons.  Refactor code to simplify it.

gcc/testsuite/
PR target/96530
* gcc.target/powerpc/pr96530.c: New test.

(cherry picked from commit e2882e76089cecdc268d0835c54cabfa80b5b0be)

4 years agoDaily bump.
GCC Administrator [Mon, 10 Aug 2020 00:17:05 +0000 (00:17 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 9 Aug 2020 00:17:08 +0000 (00:17 +0000)] 
Daily bump.

4 years agors6000: Don't ICE when spilling an MMA accumulator
Peter Bergner [Thu, 6 Aug 2020 15:03:03 +0000 (10:03 -0500)] 
rs6000: Don't ICE when spilling an MMA accumulator

When we spill an accumulator that has a known zero value, LRA will emit
a new (set (reg:PXI ...) 0) insn, but it does not use the mma_xxsetaccz
pattern to do it, leading to an unrecognized insn ICE.  The solution here
is to move the xxsetaccz instruction into the movpxi pattern and have the
xxsetaccz pattern call the move pattern.

2020-08-06  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96446
* config/rs6000/mma.md (*movpxi): Add xxsetaccz generation.
Disable split for zero constant source operand.
(mma_xxsetaccz): Change to define_expand.  Call gen_movpxi.

gcc/testsuite/
PR target/96446
* gcc.target/powerpc/pr96446.c: New test.

(cherry picked from commit 9c376d1c166e7c8b10bba6f1675d2471ffe8447f)

4 years agoDaily bump.
GCC Administrator [Sat, 8 Aug 2020 00:17:07 +0000 (00:17 +0000)] 
Daily bump.

4 years agolibstdc++: Fix ambiguous comparisons in __gnu_debug::bitset [PR 96303]
Jonathan Wakely [Fri, 7 Aug 2020 19:29:11 +0000 (20:29 +0100)] 
libstdc++: Fix ambiguous comparisons in __gnu_debug::bitset [PR 96303]

With -pedantic the debug mode bitset has an ambiguous equality
comparison operator, because it tries to compare the non-debug base to
the debug object. The base object can be converted to another debug
bitset, making the same operator== a candidate again.

The fix is to do the comparison on both base objects, so the operator
for the derived type isn't a candidate.

For the inequality operator the same change should be done, but that
operator can be removed entirely for C++20 because it can be synthesized
by the compiler.

I don't think either equality or inequality operators are really needed,
because the public _GLIBCXX_STD_C::bitset base class cam always be
compared using its own comparison operators. I'm not changing that here
though.

libstdc++-v3/ChangeLog:

PR libstdc++/96303
* include/debug/bitset (bitset::operator==): Call _M_base() on
right operand.
(bitset::operator!=): Likewise, but don't define it at all when
default comparisons are supported by the compiler.
* testsuite/23_containers/bitset/operations/96303.cc: New test.

(cherry picked from commit de1e3b8795e507c3cfa5b62984272628ca62a9bd)

4 years agoAArch64: Fix hwasan failure in readline.
Tamar Christina [Mon, 3 Aug 2020 11:03:17 +0000 (12:03 +0100)] 
AArch64: Fix hwasan failure in readline.

My previous fix added an unchecked call to fgets in the new function readline.
fgets can fail when there's an error reading the file in which case it returns
NULL.  It also returns NULL when the next character is EOF.

The EOF case is already covered by the existing code but the error case isn't.
This fixes it by returning the empty string on error.

Also I now use strnlen instead of strlen to make sure we never read outside the
buffer.

This was flagged by Matthew Malcomson during his hwasan work.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (readline): Check return value fgets.

(cherry picked from commit 341573406b392f4d57e052ce22f80e85a7c479e9)

4 years agoAArch64: Add test for -mcpu=native
Tamar Christina [Fri, 17 Jul 2020 12:13:12 +0000 (13:13 +0100)] 
AArch64: Add test for -mcpu=native

This adds some tests to the GCC testsuite for testing the
-mcpu=native code.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cpunative/aarch64-cpunative.exp: New test.
* gcc.target/aarch64/cpunative/info_0: New test.
* gcc.target/aarch64/cpunative/info_1: New test.
* gcc.target/aarch64/cpunative/info_10: New test.
* gcc.target/aarch64/cpunative/info_11: New test.
* gcc.target/aarch64/cpunative/info_12: New test.
* gcc.target/aarch64/cpunative/info_13: New test.
* gcc.target/aarch64/cpunative/info_14: New test.
* gcc.target/aarch64/cpunative/info_15: New test.
* gcc.target/aarch64/cpunative/info_2: New test.
* gcc.target/aarch64/cpunative/info_3: New test.
* gcc.target/aarch64/cpunative/info_4: New test.
* gcc.target/aarch64/cpunative/info_5: New test.
* gcc.target/aarch64/cpunative/info_6: New test.
* gcc.target/aarch64/cpunative/info_7: New test.
* gcc.target/aarch64/cpunative/info_8: New test.
* gcc.target/aarch64/cpunative/info_9: New test.
* gcc.target/aarch64/cpunative/native_cpu_0.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_1.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_10.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_11.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_12.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_13.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_14.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_15.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_2.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_3.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_4.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_5.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_6.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_7.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_8.c: New test.
* gcc.target/aarch64/cpunative/native_cpu_9.c: New test.

(cherry picked from commit 8bc83ee378e1cac65d75752b5137ec35d9e1aca1)

4 years agoTestuite: Document environment setting directives
Tamar Christina [Fri, 17 Jul 2020 12:12:46 +0000 (13:12 +0100)] 
Testuite: Document environment setting directives

This document some of the existing DejaGnu directives to modify
environment variables before test or compiler invocations.

gcc/ChangeLog:

* doc/sourcebuild.texi (dg-set-compiler-env-var,
dg-set-target-env-var): Document.

(cherry picked from commit 7c4491e33d1be16bfb85d448862a8b956d35e4d8)

4 years agoTestsuite: Make it easier to debug environment setting functions
Tamar Christina [Fri, 17 Jul 2020 12:12:23 +0000 (13:12 +0100)] 
Testsuite: Make it easier to debug environment setting functions

This adds verbose output to dg-set-compiler-env-var and dg-set-target-env-var
so you can actually see what they're setting when you add -v -v.

gcc/testsuite/ChangeLog:

* lib/gcc-dg.exp (dg-set-compiler-env-var, dg-set-target-env-var): Add
verbose output.

(cherry picked from commit e410cbff5d5a408b7c64a0c426951afc2a24df93)

4 years agoArm: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:12:00 +0000 (13:12 +0100)] 
Arm: Add GCC_CPUINFO override

This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using these are added later on.

gcc/ChangeLog:

* config/arm/driver-arm.c (host_detect_local_cpu): Add GCC_CPUINFO.

(cherry picked from commit 34a6c43487caf3a2a0ec9c7c79c526d116abc8b9)

4 years agoAArch64: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:10:53 +0000 (13:10 +0100)] 
AArch64: Add GCC_CPUINFO override

This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using this are added later on.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (host_detect_local_cpu):
Add GCC_CPUINFO.

(cherry picked from commit 55f6addc0c102eab2bf19d94de3ce52f9de0ab91)

4 years agoAArch64: Fix bugs in -mcpu=native detection.
Tamar Christina [Fri, 17 Jul 2020 12:10:28 +0000 (13:10 +0100)] 
AArch64: Fix bugs in -mcpu=native detection.

This patch fixes a couple of issues in AArch64's -mcpu=native processing:

The buffer used to read the lines from /proc/cpuinfo is 128 bytes long.  While
this was enough in the past with the increase in architecture extensions it is
no longer enough.   It results in two bugs:

1) No option string longer than 127 characters is correctly parsed.  Features
   that are supported are silently ignored.

2) It incorrectly enables features that are not present on the machine:
  a) It checks for substring matching instead of full word matching.  This makes
     it incorrectly detect sb support when ssbs is provided instead.
  b) Due to the truncation at the 127 char border it also incorrectly enables
     features due to the full feature being cut off and the part that is left
     accidentally enables something else.

This breaks -mcpu=native detection on some of our newer system.

The patch fixes these issues by reading full lines up to the \n in a string.
This gives us the full feature line.  Secondly it creates a set from this string
to:

 1) Reduce matching complexity from O(n*m) to O(n*logm).
 2) Perform whole word matching instead of substring matching.

To make this code somewhat cleaner I also changed from using char* to using
std::string and std::set.

Note that I have intentionally avoided the use of ifstream and stringstream
to make it easier to backport.  I have also not change the substring matching
for the initial line classification as I cannot find a documented cpuinfo format
which leads me to believe there may be kernels out there that require this which
may be why the original code does this.

I also do not want this to break if the kernel adds a new line that is long and
indents the file by two tabs to keep everything aligned.  In short I think an
imprecise match is the right thing here.

Test for this is added as the last thing in this series as it requires some
changes to be made to be able to test this.

gcc/ChangeLog:

* config/aarch64/driver-aarch64.c (INCLUDE_SET): New.
(parse_field): Use std::string.
(split_words, readline, find_field): New.
(host_detect_local_cpu): Fix truncation issues.

(cherry picked from commit b399f3c6425f6c33b64e813899cbd589288ef716)

4 years agoarm: Clear canary value after stack_protect_test [PR96191]
Richard Sandiford [Fri, 7 Aug 2020 11:15:02 +0000 (12:15 +0100)] 
arm: Clear canary value after stack_protect_test [PR96191]

The stack_protect_test patterns were leaving the canary value in the
temporary register, meaning that it was often still in registers on
return from the function.  An attacker might therefore have been
able to use it to defeat stack-smash protection for a later function.

gcc/
PR target/96191
* config/arm/arm.md (arm_stack_protect_test_insn): Zero out
operand 2 after use.
* config/arm/thumb1.md (thumb1_stack_protect_test_insn): Likewise.

gcc/testsuite/
* gcc.target/arm/stack-protector-1.c: New test.
* gcc.target/arm/stack-protector-2.c: Likewise.

(cherry picked from commit 6a3f3e08723063ea2dadb7ddf503f02972a724e2)

4 years agoaarch64: Clear canary value after stack_protect_test [PR96191]
Richard Sandiford [Fri, 7 Aug 2020 11:15:01 +0000 (12:15 +0100)] 
aarch64: Clear canary value after stack_protect_test [PR96191]

The stack_protect_test patterns were leaving the canary value in the
temporary register, meaning that it was often still in registers on
return from the function.  An attacker might therefore have been
able to use it to defeat stack-smash protection for a later function.

gcc/
PR target/96191
* config/aarch64/aarch64.md (stack_protect_test_<mode>): Set the
CC register directly, instead of a GPR.  Replace the original GPR
destination with an extra scratch register.  Zero out operand 3
after use.
(stack_protect_test): Update accordingly.

gcc/testsuite/
PR target/96191
* gcc.target/aarch64/stack-protector-1.c: New test.
* gcc.target/aarch64/stack-protector-2.c: Likewise.

(cherry picked from commit fe1a26429038d7cd17abc53f96a6f3e2639b605f)

4 years agoDaily bump.
GCC Administrator [Fri, 7 Aug 2020 00:17:07 +0000 (00:17 +0000)] 
Daily bump.

4 years agolibstdc++: Fix unnecessary allocations in read_symlink [PR 96484]
Jonathan Wakely [Thu, 6 Aug 2020 17:44:50 +0000 (18:44 +0100)] 
libstdc++: Fix unnecessary allocations in read_symlink [PR 96484]

libstdc++-v3/ChangeLog:

PR libstdc++/96484
* src/c++17/fs_ops.cc (fs::read_symlink): Return an error
immediately for non-symlinks.
* src/filesystem/ops.cc (fs::read_symlink): Likewise.

(cherry picked from commit 6a13a4e3f29fc4ce5eff96d74ba965c9fdc02184)

4 years agotree-optimization/96483 - fix ICE in PRE with POLY_INT_CST
Richard Biener [Thu, 6 Aug 2020 10:16:05 +0000 (12:16 +0200)] 
tree-optimization/96483 - fix ICE in PRE with POLY_INT_CST

This adds a missing case for PRE expression re-materialization.

2020-08-06  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96483
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle
POLY_INT_CST.

(cherry picked from commit 1f4c8afa1b2dac97f2ee78eacafe6eee246a4dae)

4 years agoDaily bump.
GCC Administrator [Thu, 6 Aug 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDaily bump.
GCC Administrator [Wed, 5 Aug 2020 00:17:17 +0000 (00:17 +0000)] 
Daily bump.

5 years agoBackport prefixed instruction tests from master branch.
Michael Meissner [Tue, 4 Aug 2020 20:28:58 +0000 (16:28 -0400)] 
Backport prefixed instruction tests from master branch.

gcc/testsuite/
2020-08-04  Michael Meissner  <meissner@linux.ibm.com>
    David Edelsohn  <dje.gcc@gmail.com>

* gcc.target/powerpc/prefix-add.c: Backport from 2020-06-27 and
2020-06-26 changes.
* gcc.target/powerpc/prefix-di-constant.c: Backport.
* gcc.target/powerpc/prefix-ds-dq.c: Backport.
* gcc.target/powerpc/prefix-large-dd.c: Backport.
* gcc.target/powerpc/prefix-large-df.c: Backport.
* gcc.target/powerpc/prefix-large-di.c: Backport.
* gcc.target/powerpc/prefix-large-hi.c: Backport.
* gcc.target/powerpc/prefix-large-kf.c: Backport.
* gcc.target/powerpc/prefix-large-qi.c: Backport.
* gcc.target/powerpc/prefix-large-sd.c: Backport.
* gcc.target/powerpc/prefix-large-sf.c: Backport.
* gcc.target/powerpc/prefix-large-si.c: Backport.
* gcc.target/powerpc/prefix-large-udi.c: Backport.
* gcc.target/powerpc/prefix-large-uhi.c: Backport.
* gcc.target/powerpc/prefix-large-uqi.c: Backport.
* gcc.target/powerpc/prefix-large-usi.c: Backport.
* gcc.target/powerpc/prefix-large-v2df.c: Backport.
* gcc.target/powerpc/prefix-large.h: Backport.
* gcc.target/powerpc/prefix-no-update.c: Backport.
* gcc.target/powerpc/prefix-pcrel-dd.c: Backport.
* gcc.target/powerpc/prefix-pcrel-df.c: Backport.
* gcc.target/powerpc/prefix-pcrel-di.c: Backport.
* gcc.target/powerpc/prefix-pcrel-hi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-kf.c: Backport.
* gcc.target/powerpc/prefix-pcrel-qi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-sd.c: Backport.
* gcc.target/powerpc/prefix-pcrel-sf.c: Backport.
* gcc.target/powerpc/prefix-pcrel-si.c: Backport.
* gcc.target/powerpc/prefix-pcrel-udi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-uhi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-uqi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-usi.c: Backport.
* gcc.target/powerpc/prefix-pcrel-v2df.c: Backport.
* gcc.target/powerpc/prefix-pcrel.h: Backport.
* gcc.target/powerpc/prefix-si-constant.c: Backport.
* gcc.target/powerpc/prefix-stack-protect.c: Backport.