platform/upstream/gcc.git
3 years agoRevert accidental commit
Jan Hubicka [Fri, 13 Nov 2020 22:32:02 +0000 (23:32 +0100)]
Revert accidental commit

* tree-ssa-alias.c (ao_ref_base_alias_ptr_type): Remove accidental
commit.
(ao_ref_alias_ptr_type): Remove accidental commit.

3 years agotestsuite: guality/redeclaration1.C test workaround
Jakub Jelinek [Fri, 13 Nov 2020 22:27:23 +0000 (23:27 +0100)]
testsuite: guality/redeclaration1.C test workaround

Apparently older GDB versions didn't handle this test right and so while
it has been properly printing 42 on line 14 (e.g. on x86_64), it issued
a weird error on line 17 (and because it didn't print any value, guality
testsuite wasn't marking it as FAIL).
That has been apparently fixed in GDB 10, where it now (on x86_64) prints
properly.
Unfortunately that revealed that the test can suffer from instruction
scheduling, where e.g. on i686 (but various other arches) the very first
insn of the function (or whatever b 14 is on) happens to be load of the
S::i variable from memory and that insn has the inner lexical scope, so
GDB 10 prints there 24 instead of 42.  The following insn is then
the first store to l and there the automatic i is in scope and prints as 42
and then the second store to l where the inner lexical scope is current
and prints 24 again.
The test wasn't meant about insn scheduling but about whether we emit the
DIEs properly, so this hack attempts to prevent the undesirable scheduling.

2020-11-13  Jakub Jelinek  <jakub@redhat.com>

* g++.dg/guality/redeclaration1.C (p): New variable.
(S::f): Increment what p points to before storing S::i into l.  Adjust
gdb-test line numbers.
(main): Initialize p to address of an automatic variable.

3 years agoc++: Predefine __STDCPP_THREADS__ in the compiler if thread model is not single ...
Jakub Jelinek [Fri, 13 Nov 2020 22:23:33 +0000 (23:23 +0100)]
c++: Predefine __STDCPP_THREADS__ in the compiler if thread model is not single [PR63287]

The following patch predefines __STDCPP_THREADS__ macro to 1 if c++11 or
later and thread model (e.g. printed by gcc -v) is not single.
There are two targets not handled by this patch, those that define
THREAD_MODEL_SPEC.  In one case - QNX - it looks just like a mistake
to me, instead of setting thread_model=posix in config.gcc it uses
THREAD_MODEL_SPEC macro to set it unconditionally to posix.
The other is hpux10, which uses -threads option to decide if threads
are enabled or not, but that option isn't really passed to the compiler.
I think that is something that really should be solved in config/pa/
instead, e.g. in the config/xxx/xxx-c.c targets usually set their own
predefined macros and it could handle this, and either pass the option
also to the compiler, or say predefine __STDCPP_THREADS__ if _DCE_THREADS
macro is defined already (or -D_DCE_THREADS found on the command line),
or whatever else.

2020-11-13  Jakub Jelinek  <jakub@redhat.com>

PR c++/63287
* c-cppbuiltin.c: Include configargs.h.
(c_cpp_builtins): For C++11 and later if THREAD_MODEL_SPEC is not
defined, predefine __STDCPP_THREADS__ to 1 unless thread_model is
"single".

3 years agoIn 'gcc/omp-oacc-kernels-decompose.cc', use langhook instead of accessing language...
Kwok Cheung Yeung [Mon, 5 Aug 2019 21:51:22 +0000 (22:51 +0100)]
In 'gcc/omp-oacc-kernels-decompose.cc', use langhook instead of accessing language-specific decl information

gcc/
* omp-oacc-kernels-decompose.cc (maybe_build_inner_data_region):
Use langhook instead of accessing language-specific decl
information.

3 years agoDecompose OpenACC 'kernels' constructs into parts, a sequence of compute constructs
Gergö Barany [Thu, 31 Jan 2019 23:59:30 +0000 (00:59 +0100)]
Decompose OpenACC 'kernels' constructs into parts, a sequence of compute constructs

Not yet enabled by default: for now, the current mode of OpenACC 'kernels'
constructs handling still remains '-fopenacc-kernels=parloops', but that is to
change later.

gcc/
* omp-oacc-kernels-decompose.cc: New.
* Makefile.in (OBJS): Add it.
* passes.def: Instantiate it.
* tree-pass.h (make_pass_omp_oacc_kernels_decompose): Declare.
* flag-types.h (enum openacc_kernels): Add.
* doc/invoke.texi (-fopenacc-kernels): Document.
* gimple.h (enum gf_mask): Add
'GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED',
'GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE',
'GF_OMP_TARGET_KIND_OACC_DATA_KERNELS'.
(is_gimple_omp_oacc, is_gimple_omp_offloaded): Handle these.
* gimple-pretty-print.c (dump_gimple_omp_target): Likewise.
* omp-expand.c (expand_omp_target, build_omp_regions_1)
(omp_make_gimple_edges): Likewise.
* omp-low.c (scan_sharing_clauses, scan_omp_for)
(check_omp_nesting_restrictions, lower_oacc_reductions)
(lower_oacc_head_mark, lower_omp_target): Likewise.
* omp-offload.c (execute_oacc_device_lower): Likewise.
gcc/c-family/
* c.opt (fopenacc-kernels): Add.
gcc/fortran/
* lang.opt (fopenacc-kernels): Add.
gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-1.c: New.
* c-c++-common/goacc/kernels-decompose-2.c: New.
* c-c++-common/goacc/kernels-decompose-ice-1.c: New.
* c-c++-common/goacc/kernels-decompose-ice-2.c: New.
* gfortran.dg/goacc/kernels-decompose-1.f95: New.
* gfortran.dg/goacc/kernels-decompose-2.f95: New.
* c-c++-common/goacc/if-clause-2.c: Adjust.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c:
New.
* testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/declare-vla.c: Adjust.
* testsuite/libgomp.oacc-fortran/pr94358-1.f90: Likewise.

Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
3 years agoMore explicit checking of which OMP constructs we're expecting
Thomas Schwinge [Tue, 13 Oct 2020 12:56:59 +0000 (14:56 +0200)]
More explicit checking of which OMP constructs we're expecting

In particular, more precisely highlight what applies generally vs. the special
handling for the current 'parloops'-based OpenACC 'kernels' implementation.

gcc/
* omp-low.c (scan_sharing_clauses, scan_omp_for)
(lower_oacc_reductions, lower_omp_target): More explicit checking
of which OMP constructs we're expecting.

3 years agoAttach an attribute to all outlined OpenACC compute regions
Thomas Schwinge [Wed, 28 Oct 2020 10:43:49 +0000 (11:43 +0100)]
Attach an attribute to all outlined OpenACC compute regions

This allows for making some things more explicit, later on.

gcc/
* omp-expand.c (expand_omp_target): Attach an attribute to all
outlined OpenACC compute regions.
* omp-offload.c (execute_oacc_device_lower): Adjust.
gcc/testsuite/
* c-c++-common/goacc/classify-parallel.c: Adjust.
* gfortran.dg/goacc/classify-parallel.f95: Likewise.
* c-c++-common/goacc/classify-serial.c: New.
* gfortran.dg/goacc/classify-serial.f95: Likewise.

3 years agoAdd 'libgomp.oacc-fortran/pr94358-1.f90' [PR94358]
Gergö Barany [Mon, 21 Jan 2019 11:08:57 +0000 (03:08 -0800)]
Add 'libgomp.oacc-fortran/pr94358-1.f90' [PR94358]

Document status quo re PR94358 "[OMP] Privatize internal array variables
introduced by the Fortran FE".

libgomp/
PR fortran/94358
* testsuite/libgomp.oacc-fortran/pr94358-1.f90: New.

Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
3 years agoc++: Add feature test macro for C++20 using enum.
Jason Merrill [Fri, 13 Nov 2020 19:15:46 +0000 (14:15 -0500)]
c++: Add feature test macro for C++20 using enum.

Missing piece from the 'using enum' implementation patch.

gcc/c-family/ChangeLog:

* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_using_enum.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/feat-cxx2a.C: Check it.

3 years agoFix modref insertion hook.
Jan Hubicka [Fri, 13 Nov 2020 20:15:40 +0000 (21:15 +0100)]
Fix modref insertion hook.

* ipa-modref.c (modref_summaries::insert,
modref_summaries_lto::insert): Remove summary if ipa-modref is disabled.

3 years agoCopied arguments are readonly
Jan Hubicka [Fri, 13 Nov 2020 20:13:51 +0000 (21:13 +0100)]
Copied arguments are readonly

* attr-fnspec.h (attr_fnspec::arg_readonly_p): Accept '1'...'9'.

3 years agolibstdc++: Avoid more 32-bit time_t overflows in futex calls
Jonathan Wakely [Fri, 13 Nov 2020 19:11:02 +0000 (19:11 +0000)]
libstdc++: Avoid more 32-bit time_t overflows in futex calls

This fixes another overflow in code converting a std::chrono::seconds
duration to a time_t. This time in the new code using a futex wait with
an absolute timeout (so this one doesn't need to be backported to the
release branches).

A timeout after the epochalypse would overflow the tv_sec field,
producing an incorrect value. If that incorrect value happened to be
negative, the syscall would return with EINVAL and then the caller would
keep retrying, spinning until the timeout was reached.  If the value
happened to be positive, we would wake up too soon and incorrectly
report a timeout

libstdc++-v3/ChangeLog:

* src/c++11/futex.cc (relative_timespec): Add [[unlikely]]
attributes.
(__atomic_futex_unsigned_base::_M_futex_wait_until)
(__atomic_futex_unsigned_base::_M_futex_wait_until_steady):
Check for overflow.
* testsuite/30_threads/future/members/wait_until_overflow.cc:
New test.

3 years agoClarify the documentation for the ms_abi fucntion attribute
Peter Jones [Fri, 13 Nov 2020 19:07:45 +0000 (12:07 -0700)]
Clarify the documentation for the ms_abi fucntion attribute

gcc/

* doc/extend.texi: Clarify the documentation for the ms_abi
function attribute.

3 years agoRe: Fix gimple_expr_code?
Andrew MacLeod [Fri, 13 Nov 2020 18:56:01 +0000 (13:56 -0500)]
Re: Fix gimple_expr_code?

have gimple_expr_code return the correct code for GIMPLE_ASSIGN.
use gassign and gcond in gimple_range_handler.

* gimple-range.h (gimple_range_handler): Cast to gimple stmt
kinds before asking for code and type.
* gimple.h (gimple_expr_code): Call gassign and gcond routines
to get their expr_code.

3 years agolibiberty: Support the new ("v0") mangling scheme in rust-demangle
Eduard-Mihai Burtescu [Fri, 13 Nov 2020 18:55:45 +0000 (18:55 +0000)]
libiberty: Support the new ("v0") mangling scheme in rust-demangle

This is the libiberty (mainly for binutils/gdb) counterpart of
https://github.com/alexcrichton/rustc-demangle/pull/23.

Relevant links for the new Rust mangling scheme (aka "v0"):
* Rust RFC: https://github.com/rust-lang/rfcs/pull/2603
* tracking issue: https://github.com/rust-lang/rust/issues/60705
* implementation: https://github.com/rust-lang/rust/pull/57967

This implementation includes full support for UTF-8 identifiers
via punycode, so I've included a testcase for that as well.

libiberty/ChangeLog:
* rust-demangle.c (struct rust_demangler): Add
skipping_printing and bound_lifetime_depth fields.
(eat): Add (v0-only).
(parse_integer_62): Add (v0-only).
(parse_opt_integer_62): Add (v0-only).
(parse_disambiguator): Add (v0-only).
(struct rust_mangled_ident): Add punycode{,_len} fields.
(parse_ident): Support v0 identifiers.
(print_str): Respect skipping_printing.
(print_uint64): Add (v0-only).
(print_uint64_hex): Add (v0-only).
(print_ident): Respect skipping_printing,
Support v0 identifiers.
(print_lifetime_from_index): Add (v0-only).
(demangle_binder): Add (v0-only).
(demangle_path): Add (v0-only).
(demangle_generic_arg): Add (v0-only).
(demangle_type): Add (v0-only).
(demangle_path_maybe_open_generics): Add (v0-only).
(demangle_dyn_trait): Add (v0-only).
(demangle_const): Add (v0-only).
(demangle_const_uint): Add (v0-only).
(basic_type): Add (v0-only).
(rust_demangle_callback): Support v0 symbols.
* testsuite/rust-demangle-expected: Add v0 testcases.

3 years agoMake strstr.c in libiberty ANSI compliant
Seija Kijin [Fri, 13 Nov 2020 18:51:27 +0000 (11:51 -0700)]
Make strstr.c in libiberty ANSI compliant

libiberty/

* strstr.c (strstr): Make implementation ANSI/POSIX compliant.

3 years agoc++: Implement C++20 'using enum'. [PR91367]
Jason Merrill [Tue, 10 Nov 2020 22:17:19 +0000 (17:17 -0500)]
c++: Implement C++20 'using enum'.  [PR91367]

This feature allows the programmer to import enumerator names into the
current scope so later mentions don't need to use the fully-qualified name.
These usings are not subject to the usual restrictions on using-decls: in
particular, they can move between class and non-class scopes, and between
classes that are not related by inheritance.  This last caused difficulty
for our normal approach to using-decls within a class hierarchy, as we
assume that the class where we looked up a used declaration is derived from
the class where it was first declared.  So to simplify things, in that case
we make a clone of the CONST_DECL in the using class.

Thanks to Nathan for the start of this work: in particular, the
lookup_using_decl rewrite.

The changes to dwarf2out revealed an existing issue with the D front-end: we
were doing the wrong thing for importing a D CONST_DECL, because
dwarf2out_imported_module_or_decl_1 was looking through it to its type,
expecting it to be an enumerator, but in one case in thread.d, the constant
had type int.  Adding the ability to import a C++ enumerator also fixed
that, but that led to a crash in force_decl_die, which didn't know what to
do with a CONST_DECL.  So now it does.

Co-authored-by: Nathan Sidwell <nathan@acm.org>
gcc/cp/ChangeLog:

* cp-tree.h (USING_DECL_UNRELATED_P): New.
(CONST_DECL_USING_P): New.
* class.c (handle_using_decl): If USING_DECL_UNRELATED_P,
clone the CONST_DECL.
* name-lookup.c (supplement_binding_1): A clone hides its
using-declaration.
(lookup_using_decl): Rewrite to separate lookup and validation.
(do_class_using_decl): Adjust.
(finish_nonmember_using_decl): Adjust.
* parser.c (make_location): Add cp_token overload.
(finish_using_decl): Split out from...
(cp_parser_using_declaration): ...here.  Don't look through enums.
(cp_parser_using_enum): New.
(cp_parser_block_declaration): Call it.
(cp_parser_member_declaration): Call it.
* semantics.c (finish_id_expression_1): Handle enumerator
used from class scope.

gcc/ChangeLog:

* dwarf2out.c (gen_enumeration_type_die): Call
equate_decl_number_to_die for enumerators.
(gen_member_die): Don't move enumerators to their
enclosing class.
(dwarf2out_imported_module_or_decl_1): Allow importing
individual enumerators.
(force_decl_die): Handle CONST_DECL.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/inh-ctor28.C: Adjust expected diagnostic.
* g++.dg/cpp0x/inh-ctor33.C: Likewise.
* g++.dg/cpp0x/using-enum-1.C: Add comment.
* g++.dg/cpp0x/using-enum-2.C: Allowed in C++20.
* g++.dg/cpp0x/using-enum-3.C: Likewise.
* g++.dg/cpp1z/class-deduction69.C: Adjust diagnostic.
* g++.dg/inherit/using5.C: Likewise.
* g++.dg/cpp2a/using-enum-1.C: New test.
* g++.dg/cpp2a/using-enum-2.C: New test.
* g++.dg/cpp2a/using-enum-3.C: New test.
* g++.dg/cpp2a/using-enum-4.C: New test.
* g++.dg/cpp2a/using-enum-5.C: New test.
* g++.dg/cpp2a/using-enum-6.C: New test.
* g++.dg/debug/dwarf2/using-enum.C: New test.

3 years ago[PATCH] Implementation of asm goto outputs
Vladimir N. Makarov [Fri, 13 Nov 2020 17:45:59 +0000 (12:45 -0500)]
[PATCH] Implementation of asm goto outputs

gcc/
* cfgexpand.c (expand_asm_stmt): Output asm goto with outputs too.
Place insns after asm goto on edges.
* doc/extend.texi: Reflect the changes in asm goto documentation.
* gimple.c (gimple_build_asm_1): Remove an assert checking output
absence for asm goto.
* gimple.h (gimple_asm_label_op, gimple_asm_set_label_op): Take
possible asm goto outputs into account.
* ira.c (ira): Remove critical edges for potential asm goto output
reloads.
(ira_nullify_asm_goto): New function.
* ira.h (ira_nullify_asm_goto): New prototype.
* lra-assigns.c (lra_split_hard_reg_for): Use ira_nullify_asm_goto.
Check that splitting is done inside a basic block.
* lra-constraints.c (curr_insn_transform): Permit output reloads
for any jump insn.
* lra-spills.c (lra_final_code_change): Remove USEs added in ira
for asm gotos.
* lra.c (lra_process_new_insns): Place output reload insns after
jumps in the beginning of destination BBs.
* reload.c (find_reloads): Report error for asm gotos with
outputs.  Modify them to keep CFG consistency to avoid crashes.
* tree-into-ssa.c (rewrite_stmt): Don't put debug stmt after asm
goto.

gcc/c/
* c-parser.c (c_parser_asm_statement): Parse outputs for asm
goto too.
* c-typeck.c (build_asm_expr): Remove an assert checking output
absence for asm goto.

gcc/cp
* parser.c (cp_parser_asm_definition): Parse outputs for asm
goto too.

gcc/testsuite/
* c-c++-common/asmgoto-2.c: Permit output in asm goto.
* gcc.c-torture/compile/asmgoto-2.c: New.
* gcc.c-torture/compile/asmgoto-3.c: New.
* gcc.c-torture/compile/asmgoto-4.c: New.
* gcc.c-torture/compile/asmgoto-5.c: New.

3 years agoopenmp: Support allocate for C/C++ array section reductions
Jakub Jelinek [Fri, 13 Nov 2020 17:57:06 +0000 (18:57 +0100)]
openmp: Support allocate for C/C++ array section reductions

This adds allocate clause support for array section reductions.
Furthermore, it fixes one bug that would cause inscan reductions with
allocate to be rejected by C, and for now just ignores allocate for
inscan/task reductions, that will need slightly more work.

2020-11-13  Jakub Jelinek  <jakub@redhat.com>

gcc/
* omp-low.c (scan_sharing_clauses): For now remove for reduction
clauses with inscan or task modifiers decl from allocate_map.
(lower_private_allocate): Handle TYPE_P (new_var).
(lower_rec_input_clauses): Handle allocate clause for C/C++ array
reductions.
gcc/c/
* c-typeck.c (c_finish_omp_clauses): Don't clear
OMP_CLAUSE_REDUCTION_INSCAN unless reduction_seen == -2.
libgomp/
* testsuite/libgomp.c-c++-common/allocate-1.c (foo): Add tests
for array reductions.
(main): Adjust foo callers.

3 years agoipa-cp: One more safe_add (PR 97816)
Martin Jambor [Fri, 13 Nov 2020 17:30:11 +0000 (18:30 +0100)]
ipa-cp: One more safe_add (PR 97816)

The new behavior of safe_add triggered an ICE because of one use where
it had not been used instead of a simple addition.  I'll fix it with the
following obvious patch so that periodic benchmarkers can continue
working because a proper fix (see below) will need a review.

The testcase showed me, however, that we can propagate time and cost
from one lattice to another more than once even when that was not the
intent.  I'll address that as a follow-up after I verify it does not
affect the IPA-CP heuristics too much or change the corresponding
params accordingly.

Bootstrapped and tested on x86_64-linux.

gcc/ChangeLog:

2020-11-13  Martin Jambor  <mjambor@suse.cz>

PR ipa/97816
* ipa-cp.c (value_topo_info<valtype>::propagate_effects): Use
safe_add instead of a simple addition.

3 years agoDo not warn about unused macros while processing #pragma GCC optimize
Piotr H. Dabrowski [Fri, 13 Nov 2020 17:27:16 +0000 (12:27 -0500)]
Do not warn about unused macros while processing #pragma GCC optimize

libcpp

PR c++/91318
* include/cpplib.h: Added cpp_define_unused(), cpp_define_formatted_unused()
* directives.c: Likewise.

gcc/c-family

PR c++/91318
* c-cppbuiltin.c: c_cpp_builtins_optimize_pragma(): use cpp_define_unused()

3 years agolibstdc++: Avoid 32-bit time_t overflows in futex calls
Jonathan Wakely [Fri, 13 Nov 2020 15:19:04 +0000 (15:19 +0000)]
libstdc++: Avoid 32-bit time_t overflows in futex calls

The existing code doesn't check whether the chrono::seconds value is out
of range of time_t. When using a timeout before the epoch (with a
negative value) subtracting the current time (as time_t) and then
assigning it to a time_t can overflow to a large positive value. This
means that we end up waiting several years even though the specific
timeout was in the distant past.

We do have a check for negative timeouts, but that happens after the
conversion to time_t so happens after the overflow.

The conversion to a relative timeout is done in two places, so this
factors it into a new function and adds the overflow checks there.

libstdc++-v3/ChangeLog:

* src/c++11/futex.cc (relative_timespec): New function to
create relative time from two absolute times.
(__atomic_futex_unsigned_base::_M_futex_wait_until)
(__atomic_futex_unsigned_base::_M_futex_wait_until_steady):
Use relative_timespec.

3 years agoAdd 3 new EVRP testcases.
Andrew MacLeod [Fri, 13 Nov 2020 16:40:41 +0000 (11:40 -0500)]
Add 3 new EVRP testcases.

test new evrp functionality.

gcc/testsuite/
* gcc.dg/tree-ssa/evrp20.c
* gcc.dg/tree-ssa/evrp21.c
* gcc.dg/tree-ssa/evrp22.c

3 years agotestsuite: move expected error location
Martin Liska [Fri, 13 Nov 2020 16:38:41 +0000 (17:38 +0100)]
testsuite: move expected error location

gcc/testsuite/ChangeLog:

PR testsuite/97788
* g++.dg/ubsan/pr61272.C: Move expected error location.

3 years agolibsanitizer: update LOCAL_PATCHES.
Martin Liska [Fri, 13 Nov 2020 16:31:16 +0000 (17:31 +0100)]
libsanitizer: update LOCAL_PATCHES.

libsanitizer/ChangeLog:

* LOCAL_PATCHES: Update to the latest commit.

3 years agolibsanitizer: Apply local patches.
Martin Liska [Fri, 13 Nov 2020 16:21:45 +0000 (17:21 +0100)]
libsanitizer: Apply local patches.

3 years agolibsanitizer: merge from master.
Martin Liska [Fri, 13 Nov 2020 16:03:23 +0000 (17:03 +0100)]
libsanitizer: merge from master.

3 years agoMSP430: Skip index-1.c test
Jozef Lawrynowicz [Fri, 13 Nov 2020 15:36:01 +0000 (15:36 +0000)]
MSP430: Skip index-1.c test

To access the "n - 100000"th element of "a" in this test, GCC will
generate the following code for msp430-elf with -mcpu=msp430x:

  RLAM.W  #1, R12
  MOV.W a-3392(R12), R12

Since there aren't actually 100,000 elements in a, this means that
"a-3392" offset calculated by the linker can overflow, as the address of
"a" can validly be less than 3392.

The relocations used for -mcpu=msp430 and -mlarge are not as strict and
the calculated value is allowed to wrap around the address space,
avoiding relocation overflows.

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/index-1.c: Skip for the default MSP430 430X ISA.

3 years agoMSP430: Implement TARGET_INSN_COST
Jozef Lawrynowicz [Fri, 13 Nov 2020 15:35:52 +0000 (15:35 +0000)]
MSP430: Implement TARGET_INSN_COST

The length of an insn can be used to calculate its cost, when optimizing
for size. When optimizing for speed, this is a good estimate, since the
cycle cost of an MSP430 instruction increases with its length.

gcc/ChangeLog:

* config/msp430/msp430.c (TARGET_INSN_COST): Define.
(msp430_insn_cost): New function.
* config/msp430/msp430.h (BRANCH_COST): Define.
(LOGICAL_OP_NON_SHORT_CIRCUIT): Define.

gcc/testsuite/ChangeLog:

* gcc.target/msp430/rtx-cost-O3-default.c: New test.
* gcc.target/msp430/rtx-cost-O3-f5series.c: New test.
* gcc.target/msp430/rtx-cost-Os-default.c: New test.
* gcc.target/msp430/rtx-cost-Os-f5series.c: New test.

3 years agoMSP430: Add defaulting to the insn length attribute
Jozef Lawrynowicz [Fri, 13 Nov 2020 15:35:47 +0000 (15:35 +0000)]
MSP430: Add defaulting to the insn length attribute

The length of MSP430 instructions is mostly just a function of the type
and number of operands. Setting the "type" attribute on all insns
describes the number of operands, and the position of the source and
destination operands.

In most cases, defaulting in the "length" and "extension" attribute
definitions can then be used to calculate the total length of the
instruction by using the value of the "type" attribute to examine the
operands.

gcc/ChangeLog:

* config/msp430/msp430-protos.h (msp430x_extendhisi): Return int
instead of char *.
(msp430_output_asm_shift_insns): Likewise.
Add new return_length argument.
(msp430x_insn_required): Add prototype.
* config/msp430/msp430.c (msp430_output_asm_shift_insns): Return the
total length, in bytes, of the emitted instructions.
(msp430x_insn_required): New function.
(msp430x_extendhisi): Return the total length, in bytes, of the
emitted instructions.
* config/msp430/msp430.h (ADJUST_INSN_LENGTH): Define.
* config/msp430/msp430.md: New define_attr "type".
New define_attr "extension".
New define_attr "length_multiplier".
New define_attr "extra_length".
Rewrite define_attr "length".
Set type, extension, length, length_multiplier or extra_length insn
attributes on all insns, as appropriate.
(andneghi3): Rewrite using constraints instead of C code to decide
output insns.
* config/msp430/predicates.md (msp430_cheap_operand): New predicate.
(msp430_high_memory_operand): New predicate.

3 years agoMSP430: Implement TARGET_RTX_COSTS
Jozef Lawrynowicz [Fri, 13 Nov 2020 15:35:42 +0000 (15:35 +0000)]
MSP430: Implement TARGET_RTX_COSTS

Costs of MSP430 instructions are mostly just a function of the type and
number of operands; knowledge of the specific instruction often
isn't required to calculate the cost.
In these cases, TARGET_RTX_COSTS just needs to examine the operands to
calculate the cost of the expression.

For more complicated operations where library helper functions are
required, if the cost cannot be accurately calculated, it is estimated
and disparaged relative to the cost of a single instruction.

gcc/ChangeLog:

* config/msp430/msp430.c (use_helper_for_const_shift): Add forward
declaration.
Remove unused argument.
(struct msp430_multlib_costs): New struct.
(msp430_is_mem_indirect): New function.
(msp430_costs): Likewise.
(msp430_shift_costs): Likewise.
(msp430_muldiv_costs): Likewise.
(msp430_get_inner_dest_code): Likewise.
(msp430_single_op_cost): Likewise.
(msp430_rtx_costs): Rewrite from scratch.
(msp430_expand_shift): Adjust use_helper_for_const_shift call.

3 years agoMSP430: Implement TARGET_MEMORY_MOVE_COST
Jozef Lawrynowicz [Fri, 13 Nov 2020 15:35:33 +0000 (15:35 +0000)]
MSP430: Implement TARGET_MEMORY_MOVE_COST

The cycle and size cost of a MOV instruction in different addressing
modes can be used to calculate the TARGET_MEMORY_MOVE_COST relative to
TARGET_REGISTER_MOVE_COST.

gcc/ChangeLog:

* config/msp430/msp430.c (struct single_op_cost): New struct.
(struct double_op_cost): Likewise.
(TARGET_REGISTER_MOVE_COST): Don't define but add comment.
(TARGET_MEMORY_MOVE_COST): Define to...
(msp430_memory_move_cost): New function.
(BRANCH_COST): Don't define but add comment.

3 years agoImprove handling of memory operands in ipa-icf 2/4
Jan Hubicka [Fri, 13 Nov 2020 14:58:41 +0000 (15:58 +0100)]
Improve handling of memory operands in ipa-icf 2/4

this patch iplements new class ao_compare that is derived from operand_compare
and adds a method to compare and hash ao_refs.  This is used by ICF to enable
more merging.

Comparsion is done as follows

1) Verify that the memory access will happen at the same address
   and will have same size.

   For constant addresses this is done by comparing ao_ref_base
   and offset/size

   For varable accesses it uses operand_equal_p but with OEP_ADDRESS
   (that does not match TBAA metadata) and then operand_equal_p on
   type size.

2) Compare alignments.  I use get_object_alignment_1 like ipa-icf
   did before revamp to operand_equal_p in gcc 9.
   I noticed that return value is bitodd so added a comment

3) Match MR_DEPENDENCE_CLIQUE

At this point the memory refrences are same except for TBAA information.
We continue by checking

4) ref and base alias sets.  Now if lto streaming is going to happen
   instead of comparing alias sets themselves we compare alias_ptr_types

   (the patch depends on the ao_ref_alias_ptr_tyep and
    ao_ref_base_alias_ptr_type acessors I sent yesterday)

5) See if accesses are view converted.
   If they are we are done since access path is not present

6) Compare the part of access path relevant for TBAA.
   I recall FRE relies on the fact that if base and ref types are same the
   access path is, but I do not thing this is 100% reliable especially with LTO
   alias sets.

   The access path comparsion logic is also useful for modref (for next stage1).
   Tracking the access paths improves quite noticeably disambiguation in C++
   code by being able to distinquish different fields of same type within a
   struct.  I had the comparsion logic in my tree for some time and it seems to
   work quite well.

   During cc1plus build we have some cases where we find mismatch after matching
   the base/ref alias sets.  These are due to failed type merging: access path
   oracle in LTO uses TYPE_MAIN_VARIANTs.

I implemented relatively basic hashing using base and offset.

gcc/ChangeLog:
* ipa-icf-gimple.c: Include tree-ssa-alias-compare.h.
(find_checker::func_checker): Initialize m_tbaa.
(func_checker::hash_operand): Use hash_ao_ref for memory accesses.
(func_checker::compare_operand): Use compare_ao_refs for memory
accesses.
(func_checker::cmopare_gimple_assign): Do not check LHS types
of memory stores.
* ipa-icf-gimple.h (func_checker): Derive from ao_compare;
add m_tbaa.
* ipa-icf.c: Include tree-ssa-alias-compare.h.
(sem_function::equals_private): Update call of
func_checker::func_checker.
* ipa-utils.h (lto_streaming_expected_p): New inline
predicate.
* tree-ssa-alias-compare.h: New file.
* tree-ssa-alias.c: Include tree-ssa-alias-compare.h
and bultins.h
(view_converted_memref_p): New function.
(types_equal_for_same_type_for_tbaa_p): New function.
(ao_ref_alias_ptr_type, ao_ref_base_alias_ptr_type): New functions.
(ao_compare::compare_ao_refs): New member function.
(ao_compare::hash_ao_ref): New function
* tree-ssa-alias.h (ao_ref_base_alias_ptr_type,
ao_ref_alias_ptr_type): Declare.

gcc/testsuite/ChangeLog:
* c-c++-common/Wstringop-overflow-2.c: Disable ICF.
* g++.dg/warn/Warray-bounds-8.C: Disable ICF.

3 years agoDetermine access types in ipa-icf-gimple.c
Jan Hubicka [Fri, 13 Nov 2020 10:41:13 +0000 (11:41 +0100)]
Determine access types in ipa-icf-gimple.c

This patch adds logic to determine access type (normal or memory) for every
operand.  This makes it possible to compare memory accesses more carefully
which will be implemented in a followup patch.

* ipa-icf-gimple.c: Include gimple-walk.h.
(func_checker::compare_ssa_name): Update call of compare_operand.
(func_checker::hash_operand): Fix comment and add variant taking
operand_access_type parameter.
(func_checker::compare_operand): Add operand_access_type parameter.
(func_checker::compare_asm_inputs_outputs): Add
operand_access_type_map parameter; update use of
func_checker::compare_operand.
(func_checker::compare_gimple_call): Update use of
func_checker::compare_operand.
(func_checker::compare_gimple_assign): Likewise.
(func_checker::compare_gimple_cond): Likewise.
(func_checker::compare_gimple_switch): Likewise.
(func_checker::compare_gimple_return): Likewise.
(func_checker::compare_gimple_goto): Likewise.
(func_checker::compare_gimple_asm): Likewise.
(visit_load_store): New static functio.
(func_checker::classify_operands): New member function.
(func_checker::get_operand_access_type): New member function.
* ipa-icf-gimple.h (func_checker::operand_access_type): New enum
(func_checker::operand_access_type_map): New typedef.
(func_checker::compare_operand): Update prototype.
(func_checker::compare_asm_inputs_outputs): Likewise.
(func_checker::cleassify_operands): Declare.
(func_checker::get_operand_access_type): Declare.
(func_checker::hash_operand): New variant with operand_access_type.
* ipa-icf.c (sem_function::hash_stmt): Update uses of hash_operand.
(sem_function::compare_phi_node): Update use of compare_operand.

3 years agoarm: Make use of RTL predicates
Andrea Corallo [Fri, 13 Nov 2020 11:42:04 +0000 (11:42 +0000)]
arm: Make use of RTL predicates

2020-11-13  Andrea Corallo  <andrea.corallo@arm.com>

* config/arm/aarch-common.c (aarch_accumulator_forwarding): Use
RTL predicates where possible.
* config/arm/arm.c (legitimate_pic_operand_p)
(legitimize_pic_address, arm_is_segment_info_known)
(can_avoid_literal_pool_for_label_p)
(thumb1_legitimate_address_p, arm_legitimize_address)
(arm_tls_referenced_p, thumb_legitimate_constant_p)
(REG_OR_SUBREG_REG, thumb1_rtx_costs, thumb1_size_rtx_costs)
(arm_adjust_cost, arm_coproc_mem_operand_wb)
(neon_vector_mem_operand, neon_struct_mem_operand)
(symbol_mentioned_p, label_mentioned_p, )
(load_multiple_sequence, store_multiple_sequence)
(arm_select_cc_mode, arm_reload_in_hi, arm_reload_out_hi)
(mem_ok_for_ldrd_strd, arm_emit_call_insn, output_move_neon)
(arm_attr_length_move_neon, arm_assemble_integer)
(arm_emit_coreregs_64bit_shift, arm_valid_symbolic_address_p)
(extract_base_offset_in_addr, fusion_load_store): Likewise.

3 years agoCleanup range of address calculations.
Andrew MacLeod [Thu, 12 Nov 2020 16:53:52 +0000 (11:53 -0500)]
Cleanup range of address calculations.

Align EVRP and ranger for how ranges of ADDR_EXPR are calculated.

gcc/
* gimple-range.cc: (gimple_ranger::range_of_range_op): Check for
ADDR_EXPR and call range_of_address.
(gimple_ranger::range_of_address): Rename from
range_of_non_trivial_assignment and match vrp_stmt_computes_nonzero.
* gimple-range.h: (range_of_address): Renamed.
* range-op.cc: (pointer_table): Add INTEGER_CST handler.
gcc/testsuite/
* gcc.dg/tree-ssa/pr78655.c: New.

3 years agoloops: Invoke lim after successful loop interchange
Martin Jambor [Fri, 13 Nov 2020 14:35:18 +0000 (15:35 +0100)]
loops: Invoke lim after successful loop interchange

This patch makes the entry point to loop invariant motion public, so
that it can be called after loop interchange when that pass has
swapped loops.  This avoids the non-LTO -Ofast run-time regressions of
410.bwaves and 503.bwaves_r (which are 19% and 15% faster than current
master on an AMD zen2 machine) while not introducing a full LIM pass
into the pass pipeline.

The patch also adds a parameter which allows not to perform any store
motion so that it is not done after an interchange.

gcc/ChangeLog:

2020-11-12  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/94406
* tree-ssa-loop-im.c (tree_ssa_lim): Renamed to
loop_invariant_motion_in_fun, added a parameter to control store
motion.
(pass_lim::execute): Adjust call to tree_ssa_lim, now
loop_invariant_motion_in_fun.
* tree-ssa-loop-manip.h (loop_invariant_motion_in_fun): Declare.
* gimple-loop-interchange.cc (pass_linterchange::execute): Call
loop_invariant_motion_in_fun if any interchange has been done.

3 years agoimprove VN PHI hashing
Richard Biener [Fri, 13 Nov 2020 12:17:01 +0000 (13:17 +0100)]
improve VN PHI hashing

This reduces the number of collisions for PHIs in the VN hashtable
by always hashing the number of predecessors and separately hashing
the block number when we never merge PHIs from different blocks.

This improves collisions seen for the PR69609 testcase dramatically.

2020-11-13  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vn_phi_compute_hash): Always hash the
number of predecessors.  Hash the block number also for
loop header PHIs.
(expressions_equal_p): Short-cut SSA name compares, remove
test for NULL operands.
(vn_phi_eq): Cache number of predecessors, change inlined
test from expressions_equal_p.

3 years agolibphobos: Update libtool version to 2:0:0
Iain Buclaw [Fri, 13 Nov 2020 11:26:01 +0000 (12:26 +0100)]
libphobos: Update libtool version to 2:0:0

This is so that the library is not to conflict with gcc-10.

libphobos/ChangeLog:

* configure: Regenerate.
* configure.ac (libtool_VERSION): Update to 2:0.0.

3 years agod: Explicitly determine which built-in copysign function to call.
Iain Buclaw [Fri, 13 Nov 2020 08:57:57 +0000 (09:57 +0100)]
d: Explicitly determine which built-in copysign function to call.

For some targets, mathfn_built_in returns NULL as copysign is not
implicitly available, causing an ICE.  Now copysign is explicitly
requested when expanding the intrinsic.

gcc/d/ChangeLog:

* intrinsics.cc (expand_intrinsic_copysign): Explicitly determine
which built-in copysign function to call.

3 years agod: Fix ICE in finish_thunk (PR97644)
Iain Buclaw [Thu, 12 Nov 2020 14:37:46 +0000 (15:37 +0100)]
d: Fix ICE in finish_thunk (PR97644)

Because this what the upstream reference compiler did, thunks for the D
front-end were associated with the class definition, so were forced
code-gen even if the target function was extern.  This has now been
changed so there are now only generated if there is a function
definition, fixing the ICE that occurred in PR 97644, which was caused
by calling expand_thunk() early.

gcc/d/ChangeLog:

PR d/97644
* dmd/MERGE: Merge upstream dmd 95044d8e4.
* d-target.cc (TargetCPP::thunkMangle): New function.
* decl.cc (finish_thunk): Don't force expand thunks for external
functions.
(make_thunk): Emit thunks only if the function has a definition.
Generate correct mangling for thunks to C++ classes.

gcc/testsuite/ChangeLog:

* gdc.dg/pr92216.d: Update scan-assember.

3 years agoclang: fix -Wmisleading-indentation warning.
Martin Liska [Fri, 13 Nov 2020 13:04:09 +0000 (14:04 +0100)]
clang: fix -Wmisleading-indentation warning.

gcc/c-family/c-attribs.c:4698:5: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

gcc/c-family/ChangeLog:

* c-attribs.c (build_attr_access_from_parms): Format properly.

3 years agodoc : Fix build error from r11-4972.
Iain Sandoe [Fri, 13 Nov 2020 11:45:34 +0000 (11:45 +0000)]
doc : Fix build error from r11-4972.

Some tex tools don't allow the @r{} command to be split across
lines.  Fixed by making the change occupy a long line.

gcc/ChangeLog:

* doc/extend.texi: Don't try to line-wrap an @r command.

3 years agotree-optimization/97812 - fix range query in VRP assert discovery
Richard Biener [Fri, 13 Nov 2020 10:31:22 +0000 (11:31 +0100)]
tree-optimization/97812 - fix range query in VRP assert discovery

This makes sure to properly extend the input range before seeing
whether it fits the target.

2020-11-13  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97812
* tree-vrp.c (register_edge_assert_for_2): Extend the range
according to its sign before seeing whether it fits.

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

3 years agoaarch64: Make use of RTL predicates
Andrea Corallo [Tue, 10 Nov 2020 11:23:15 +0000 (11:23 +0000)]
aarch64: Make use of RTL predicates

2020-11-10  Andrea Corallo  <andrea.corallo@arm.com>

* config/aarch64/aarch64.c (tls_symbolic_operand_type)
(aarch64_load_symref_appropriately, aarch64_mov128_immediate)
(aarch64_expand_mov_immediate)
(aarch64_maybe_expand_sve_subreg_move)
(aarch64_tls_referenced_p, aarch64_cannot_force_const_mem)
(aarch64_base_register_rtx_p, aarch64_classify_index)
(aarch64_classify_address, aarch64_symbolic_address_p)
(aarch64_reinterpret_float_as_int, aarch64_float_const_rtx_p)
(aarch64_can_const_movi_rtx_p, aarch64_select_cc_mode)
(aarch64_print_operand, aarch64_label_mentioned_p)
(aarch64_secondary_reload, aarch64_preferred_reload_class)
(aarch64_address_cost, aarch64_tls_symbol_p)
(aarch64_classify_symbol, aarch64_legitimate_pic_operand_p)
(aarch64_legitimate_constant_p)
(aarch64_sve_float_arith_immediate_p)
(aarch64_sve_float_mul_immediate_p, aarch64_mov_operand_p)
(fusion_load_store): Use RTL operands where possible.

3 years agolibstdc++: Add -pthread options to std::future polling test
Jonathan Wakely [Fri, 13 Nov 2020 10:04:33 +0000 (10:04 +0000)]
libstdc++: Add -pthread options to std::future polling test

For linux targets this test doesn't need -lpthread because it only uses
atomics, but for all other targets std::call_once still needs pthreads.
Add the necessary test directives to make that work.

The timings in this test might be too fragile or too target-specific, so
it might need to be adjusted in future, or restricted to only run on
specific targets. For now I've increased the allowed ratio between
wait_for calls before and after the future is made ready, because it was
failing with -O3 -march=native sometimes.

libstdc++-v3/ChangeLog:

* testsuite/30_threads/future/members/poll.cc: Require gthreads
and add -pthread for targets that require it. Relax required
ratio of wait_for calls before/after the future is ready.

3 years agoaarch64: Add backend support for expanding __builtin_memset
Sudakshina Das [Fri, 13 Nov 2020 10:48:27 +0000 (10:48 +0000)]
aarch64: Add backend support for expanding __builtin_memset

This patch implements aarch64 backend expansion for __builtin_memset. Most of
the implementation is based on the expansion of __builtin_memcpy. We change the
values of SET_RATIO and MOVE_RATIO for cases where we do not have to strictly
align and where we can benefit from NEON instructions in the backend.

gcc/ChangeLog:

* config/aarch64/aarch64-protos.h (aarch64_expand_setmem): New
declaration.
* config/aarch64/aarch64.c (aarch64_gen_store_pair): Add case for
E_V16QImode.
(aarch64_set_one_block_and_progress_pointer): New helper for
aarch64_expand_setmem.
(aarch64_expand_setmem): Define the expansion for memset.
* config/aarch64/aarch64.h (CLEAR_RATIO): Tweak to favor
aarch64_expand_setmem when allowed and profitable.
(SET_RATIO): Likewise.
* config/aarch64/aarch64.md: Define pattern for setmemdi.

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/pr90883.C: Remove xfail for aarch64.
* gcc.dg/tree-prof/stringop-2.c: Add xfail for aarch64.
* gcc.target/aarch64/memset-corner-cases.c: New test.
* gcc.target/aarch64/memset-q-reg.c: New test.

3 years agoC-Family, Objective-C : Implement Objective-C nullability Part 1[PR90707].
Iain Sandoe [Sun, 25 Oct 2020 19:33:07 +0000 (19:33 +0000)]
C-Family, Objective-C : Implement Objective-C nullability Part 1[PR90707].

This part of the implementation covers property nullability attributes
and includes the changes to common code. Follow-on changes will be needed
to cover Objective-C method definitions, but those are expected to be
local to the Objective-C front end.

The basis of the implementation is to translate the Objective-C-specific
keywords into an attribute (objc_nullability) which has the required
states to carry the attribute markup.

We introduce the keywords, and these are parsed and validated in the same
manner as other property attributes.  The resulting value is attached to
the property as an objc_nullability attribute.

gcc/c-family/ChangeLog:

PR objc/90707
* c-common.c (c_common_reswords): null_unspecified, nullable,
nonnull, null_resettable: New keywords.
* c-common.h (enum rid): RID_NULL_UNSPECIFIED, RID_NULLABLE,
RID_NONNULL, RID_NULL_RESETTABLE: New.
(OBJC_IS_PATTR_KEYWORD): Include nullability keywords in the
ranges accepted for property attributes.
* c-attribs.c (handle_objc_nullability_attribute): New.
* c-objc.h (enum objc_property_attribute_group): Add
OBJC_PROPATTR_GROUP_NULLABLE.
(enum objc_property_attribute_kind):Add
OBJC_PROPERTY_ATTR_NULL_UNSPECIFIED, OBJC_PROPERTY_ATTR_NULLABLE,
OBJC_PROPERTY_ATTR_NONNULL, OBJC_PROPERTY_ATTR_NULL_RESETTABLE.

gcc/objc/ChangeLog:

PR objc/90707
* objc-act.c (objc_prop_attr_kind_for_rid): Handle nullability.
(objc_add_property_declaration): Handle nullability attributes.
Check that these are applicable to the property type.
* objc-act.h (enum objc_property_nullability): New.

gcc/testsuite/ChangeLog:

PR objc/90707
* obj-c++.dg/property/at-property-4.mm: Add basic nullability
tests.
* objc.dg/property/at-property-4.m: Likewise.
* obj-c++.dg/attributes/nullability-00.mm: New test.
* obj-c++.dg/property/nullability-00.mm: New test.
* objc.dg/attributes/nullability-00.m: New test.
* objc.dg/property/nullability-00.m: New test.

gcc/ChangeLog:

PR objc/90707
* doc/extend.texi: Document the objc_nullability attribute.

3 years agoObjective-C [3/3] : Implement Wobjc-root-class [PR77404].
Iain Sandoe [Sun, 25 Oct 2020 09:54:21 +0000 (09:54 +0000)]
Objective-C [3/3] : Implement Wobjc-root-class [PR77404].

Add Wno-objc-root-class where needed to the objective-c++
tests.

gcc/testsuite/ChangeLog:

PR objc/77404
* obj-c++.dg/attributes/class-attribute-1.mm:
Add Wno-objc-root-class.
* obj-c++.dg/attributes/class-attribute-2.mm: Likewise.
* obj-c++.dg/attributes/class-attribute-3.mm: Likewise.
* obj-c++.dg/attributes/method-deprecated-1.mm: Likewise.
* obj-c++.dg/attributes/method-deprecated-2.mm: Likewise.
* obj-c++.dg/attributes/method-deprecated-3.mm: Likewise.
* obj-c++.dg/attributes/method-format-1.mm: Likewise.
* obj-c++.dg/attributes/method-nonnull-1.mm: Likewise.
* obj-c++.dg/attributes/method-noreturn-1.mm: Likewise.
* obj-c++.dg/attributes/method-sentinel-1.mm: Likewise.
* obj-c++.dg/attributes/nsobject-01.mm: Likewise.
* obj-c++.dg/attributes/parameter-attribute-1.mm: Likewise.
* obj-c++.dg/attributes/parameter-attribute-2.mm: Likewise.
* obj-c++.dg/attributes/proto-attribute-1.mm: Likewise.
* obj-c++.dg/attributes/proto-attribute-3.mm: Likewise.
* obj-c++.dg/attributes/proto-attribute-4.mm: Likewise.
* obj-c++.dg/attributes/unused-parameter-1.mm: Likewise.
* obj-c++.dg/bad-receiver-type.mm: Likewise.
* obj-c++.dg/bitfield-3.mm: Likewise.
* obj-c++.dg/bitfield-5.mm: Likewise.
* obj-c++.dg/class-extension-1.mm: Likewise.
* obj-c++.dg/class-extension-2.mm: Likewise.
* obj-c++.dg/class-extension-3.mm: Likewise.
* obj-c++.dg/class-extension-4.mm: Likewise.
* obj-c++.dg/class-protocol-1.mm: Likewise.
* obj-c++.dg/comp-types-1.mm: Likewise.
* obj-c++.dg/comp-types-10.mm: Likewise.
* obj-c++.dg/comp-types-2.mm: Likewise.
* obj-c++.dg/comp-types-3.mm: Likewise.
* obj-c++.dg/comp-types-5.mm: Likewise.
* obj-c++.dg/comp-types-6.mm: Likewise.
* obj-c++.dg/comp-types-7.mm: Likewise.
* obj-c++.dg/comp-types-8.mm: Likewise.
* obj-c++.dg/demangle-2.mm: Likewise.
* obj-c++.dg/demangle-3.mm: Likewise.
* obj-c++.dg/duplicate-class-1.mm: Likewise.
* obj-c++.dg/encode-1-next.mm: Likewise.
* obj-c++.dg/encode-1.mm: Likewise.
* obj-c++.dg/enhanced-proto-2.mm: Likewise.
* obj-c++.dg/exceptions-1.mm: Likewise.
* obj-c++.dg/exceptions-3.mm: Likewise.
* obj-c++.dg/exceptions-4.mm: Likewise.
* obj-c++.dg/exceptions-5.mm: Likewise.
* obj-c++.dg/extern-c-1.mm: Likewise.
* obj-c++.dg/fobjc-std-1.mm: Likewise.
* obj-c++.dg/gnu-api-2-class-meta.mm: Likewise.
* obj-c++.dg/gnu-api-2-class.mm: Likewise.
* obj-c++.dg/gnu-api-2-ivar.mm: Likewise.
* obj-c++.dg/gnu-api-2-method.mm: Likewise.
* obj-c++.dg/gnu-api-2-objc.mm: Likewise.
* obj-c++.dg/gnu-api-2-objc_msg_lookup.mm: Likewise.
* obj-c++.dg/gnu-api-2-object.mm: Likewise.
* obj-c++.dg/gnu-api-2-property.mm: Likewise.
* obj-c++.dg/gnu-api-2-protocol.mm: Likewise.
* obj-c++.dg/gnu-api-2-resolve-method.mm: Likewise.
* obj-c++.dg/gnu-api-2-sel.mm: Likewise.
* obj-c++.dg/invalid-method-2.mm: Likewise.
* obj-c++.dg/ivar-invalid-type-1.mm: Likewise.
* obj-c++.dg/ivar-problem-1.mm: Likewise.
* obj-c++.dg/lto/lto.exp: Likewise.
* obj-c++.dg/lto/trivial-1_0.mm: Likewise.
* obj-c++.dg/method-1.mm: Likewise.
* obj-c++.dg/method-12.mm: Likewise.
* obj-c++.dg/method-18.mm: Likewise.
* obj-c++.dg/method-19.mm: Likewise.
* obj-c++.dg/method-20.mm: Likewise.
* obj-c++.dg/method-3.mm: Likewise.
* obj-c++.dg/method-4.mm: Likewise.
* obj-c++.dg/method-5.mm: Likewise.
* obj-c++.dg/method-8.mm: Likewise.
* obj-c++.dg/method-9.mm: Likewise.
* obj-c++.dg/method-namespace-1.mm: Likewise.
* obj-c++.dg/plugin/diagnostic-test-expressions-1.mm:
Likewise.
* obj-c++.dg/pr23709.mm: Likewise.
* obj-c++.dg/pragma-2.mm: Likewise.
* obj-c++.dg/private-1.mm: Likewise.
* obj-c++.dg/private-2.mm: Likewise.
* obj-c++.dg/property/property.exp: Likewise.
* obj-c++.dg/proto-lossage-1.mm: Likewise.
* obj-c++.dg/proto-lossage-5.mm: Likewise.
* obj-c++.dg/proto-qual-1.mm: Likewise.
* obj-c++.dg/protocol-inheritance-1.mm: Likewise.
* obj-c++.dg/protocol-inheritance-2.mm: Likewise.
* obj-c++.dg/protocol-optional-1.mm: Likewise.
* obj-c++.dg/selector-1.mm: Likewise.
* obj-c++.dg/selector-2.mm: Likewise.
* obj-c++.dg/selector-3.mm: Likewise.
* obj-c++.dg/selector-4.mm: Likewise.
* obj-c++.dg/strings/strings.exp: Likewise.
* obj-c++.dg/stubify-1.mm: Likewise.
* obj-c++.dg/stubify-2.mm: Likewise.
* obj-c++.dg/super-dealloc-1.mm: Likewise.
* obj-c++.dg/super-dealloc-2.mm: Likewise.
* obj-c++.dg/sync-3.mm: Likewise.
* obj-c++.dg/syntax-error-2.mm: Likewise.
* obj-c++.dg/syntax-error-4.mm: Likewise.
* obj-c++.dg/syntax-error-7.mm: Likewise.
* obj-c++.dg/syntax-error-9.mm: Likewise.
* obj-c++.dg/template-4.mm: Likewise.
* obj-c++.dg/template-7.mm: Likewise.
* obj-c++.dg/template-8.mm: Likewise.
* obj-c++.dg/threedotthree-abi-1.mm: Likewise.
* obj-c++.dg/torture/dg-torture.exp: Likewise.
* obj-c++.dg/torture/strings/strings.exp: Likewise.
* obj-c++.dg/try-catch-12.mm: Likewise.
* obj-c++.dg/try-catch-13.mm: Likewise.

3 years agoObjective-C [2/3] : Implement Wobjc-root-class [PR77404].
Iain Sandoe [Thu, 12 Nov 2020 13:11:11 +0000 (13:11 +0000)]
Objective-C [2/3] : Implement Wobjc-root-class [PR77404].

Add "Wno-objc-root-class" to tests in the Objective-C suite where
needed.

gcc/testsuite/ChangeLog:

PR objc/77404
* objc.dg/anon-1.m: Add Wno-objc-root-class.
* objc.dg/attributes/class-attribute-1.m: Likewise.
* objc.dg/attributes/class-attribute-2.m: Likewise.
* objc.dg/attributes/class-attribute-3.m: Likewise.
* objc.dg/attributes/method-deprecated-1.m: Likewise.
* objc.dg/attributes/method-deprecated-2.m: Likewise.
* objc.dg/attributes/method-deprecated-3.m: Likewise.
* objc.dg/attributes/method-format-1.m: Likewise.
* objc.dg/attributes/method-nonnull-1.m: Likewise.
* objc.dg/attributes/method-noreturn-1.m: Likewise.
* objc.dg/attributes/method-sentinel-1.m: Likewise.
* objc.dg/attributes/nsobject-01.m: Likewise.
* objc.dg/attributes/objc-exception-1.m: Likewise.
* objc.dg/attributes/parameter-attribute-1.m: Likewise.
* objc.dg/attributes/parameter-attribute-2.m: Likewise.
* objc.dg/attributes/proto-attribute-1.m: Likewise.
* objc.dg/attributes/proto-attribute-2.m: Likewise.
* objc.dg/attributes/proto-attribute-3.m: Likewise.
* objc.dg/attributes/proto-attribute-4.m: Likewise.
* objc.dg/bitfield-2.m: Likewise.
* objc.dg/break-in-ifstmt.m: Likewise.
* objc.dg/class-1.m: Likewise.
* objc.dg/class-extension-1.m: Likewise.
* objc.dg/class-extension-2.m: Likewise.
* objc.dg/class-extension-3.m: Likewise.
* objc.dg/class-extension-4.m: Likewise.
* objc.dg/class-protocol-1.m: Likewise.
* objc.dg/comp-types-7.m: Likewise.
* objc.dg/demangle-1.m: Likewise.
* objc.dg/duplicate-class-1.m: Likewise.
* objc.dg/encode-6-next.m: Likewise.
* objc.dg/encode-6.m: Likewise.
* objc.dg/enhanced-proto-2.m: Likewise.
* objc.dg/exceptions-1.m: Likewise.
* objc.dg/exceptions-3.m: Likewise.
* objc.dg/exceptions-4.m: Likewise.
* objc.dg/exceptions-5.m: Likewise.
* objc.dg/fobjc-std-1.m: Likewise.
* objc.dg/foreach-2.m: Likewise.
* objc.dg/foreach-4.m: Likewise.
* objc.dg/foreach-5.m: Likewise.
* objc.dg/fsyntax-only.m: Likewise.
* objc.dg/gnu-api-2-class-meta.m: Likewise.
* objc.dg/gnu-api-2-class.m: Likewise.
* objc.dg/gnu-api-2-ivar.m: Likewise.
* objc.dg/gnu-api-2-method.m: Likewise.
* objc.dg/gnu-api-2-objc.m: Likewise.
* objc.dg/gnu-api-2-objc_msg_lookup.m: Likewise.
* objc.dg/gnu-api-2-object.m: Likewise.
* objc.dg/gnu-api-2-property.m: Likewise.
* objc.dg/gnu-api-2-protocol.m: Likewise.
* objc.dg/gnu-api-2-resolve-method.m: Likewise.
* objc.dg/gnu-api-2-sel.m: Likewise.
* objc.dg/incomplete-type-1.m: Likewise.
* objc.dg/instancetype-0.m: Likewise.
* objc.dg/invalid-method-2.m: Likewise.
* objc.dg/ivar-invalid-type-1.m: Likewise.
* objc.dg/ivar-problem-1.m: Likewise.
* objc.dg/ivar-scope-1.m: Likewise.
* objc.dg/ivar-scope-2.m: Likewise.
* objc.dg/ivar-scope-4.m: Likewise.
* objc.dg/ivar-visibility-1.m: Likewise.
* objc.dg/ivar-visibility-2.m: Likewise.
* objc.dg/ivar-visibility-3.m: Likewise.
* objc.dg/ivar-visibility-4.m: Likewise.
* objc.dg/local-decl-1.m: Likewise.
* objc.dg/lto/lto.exp: Likewise.
* objc.dg/lto/trivial-1_0.m: Likewise.
* objc.dg/method-1.m: Likewise.
* objc.dg/method-12.m: Likewise.
* objc.dg/method-13.m: Likewise.
* objc.dg/method-14.m: Likewise.
* objc.dg/missing-proto-3.m: Likewise.
* objc.dg/next-runtime-1.m: Likewise.
* objc.dg/objc-foreach-1.m: Likewise.
* objc.dg/objc-foreach-2.m: Likewise.
* objc.dg/objc-foreach-3.m: Likewise.
* objc.dg/objc-nofilename-1.m: Likewise.
* objc.dg/param-1.m: Likewise.
* objc.dg/pch/pch.exp: Likewise.
* objc.dg/plugin/diagnostic-test-expressions-1.m: Likewise.
* objc.dg/pr23709.m: Likewise.
* objc.dg/private-1.m: Likewise.
* objc.dg/private-2.m: Likewise.
* objc.dg/property/property.exp: Likewise.
* objc.dg/proto-hier-1.m: Likewise.
* objc.dg/proto-hier-2.m: Likewise.
* objc.dg/proto-lossage-1.m: Likewise.
* objc.dg/proto-lossage-5.m: Likewise.
* objc.dg/proto-qual-1.m: Likewise.
* objc.dg/protocol-inheritance-1.m: Likewise.
* objc.dg/protocol-inheritance-2.m: Likewise.
* objc.dg/protocol-optional-1.m: Likewise.
* objc.dg/selector-1.m: Likewise.
* objc.dg/selector-2.m: Likewise.
* objc.dg/selector-3.m: Likewise.
* objc.dg/selector-4.m: Likewise.
* objc.dg/shadow-1.m: Likewise.
* objc.dg/shadow-2.m: Likewise.
* objc.dg/special/load-category-1.m: Likewise.
* objc.dg/special/load-category-2.m: Likewise.
* objc.dg/special/load-category-3.m: Likewise.
* objc.dg/special/special.exp: Likewise.
* objc.dg/special/unclaimed-category-1.h: Likewise.
* objc.dg/special/unclaimed-category-1.m: Likewise.
* objc.dg/stabs-1.m: Likewise.
* objc.dg/strings/strings.exp: Likewise.
* objc.dg/stubify-1.m: Likewise.
* objc.dg/stubify-2.m: Likewise.
* objc.dg/super-class-2.m: Likewise.
* objc.dg/super-dealloc-1.m: Likewise.
* objc.dg/super-dealloc-2.m: Likewise.
* objc.dg/sync-3.m: Likewise.
* objc.dg/threedotthree-abi-1.m: Likewise.
* objc.dg/torture/dg-torture.exp: Likewise.
* objc.dg/torture/strings/strings.exp: Likewise.
* objc.dg/try-catch-11.m: Likewise.
* objc.dg/try-catch-12.m: Likewise.
* objc.dg/type-size-2.m: Likewise.
* objc.dg/type-size-3.m: Likewise.
* objc.dg/type-size-4.m: Likewise.
* objc.dg/type-size-5.m: Likewise.
* objc.dg/undeclared-selector.m: Likewise.
* objc.dg/volatile-1.m: Likewise.

3 years agoC-family, Objective-C [1/3] : Implement Wobjc-root-class [PR77404].
Iain Sandoe [Sun, 25 Oct 2020 07:49:16 +0000 (07:49 +0000)]
C-family, Objective-C [1/3] : Implement Wobjc-root-class [PR77404].

This warning catches the case that the user has left the
superclass specification from a class interface.  Root
classes are, of course, permitted and an attribute is added
to mark these so that the diagnostic is suppressed.

The warning and attribute spellings have been kept in sync
with the language reference implementation (clang).

The diagnostic location information present in the objective-c
interface and class definitions is relatively poor.  This patch
adds a location for the class name to the interface and makes use
of it in existing warnings.

Part 1 is the changes to code and added tests.

Many entries in the testsuite make use of root classes so
there are a large number of mechanical changes there adding
"-Wno-objc-root-class" to the options.

The test changes are parts 2 (objective-c) and 3 (objective-c++)
in the patch series.

gcc/c-family/ChangeLog:

PR objc/77404
* c-attribs.c (handle_objc_root_class_attribute): New
* c-objc.h (objc_start_class_interface): Add a location
value for the position of the class name.
* c.opt: Add Wobjc-root-class.
* stub-objc.c (objc_start_class_interface): Add a location
value for the position of the class name.

gcc/c/ChangeLog:

PR objc/77404
* c-parser.c (c_parser_objc_class_definition): Pass the
location of the class name to the interface declaration.

gcc/cp/ChangeLog:

PR objc/77404
* parser.c (cp_parser_objc_class_interface): Pass the
location of the class name to the interface declaration.

gcc/objc/ChangeLog:

PR objc/77404
* objc-act.c (objc_start_class_interface): Accept the location
of the class name, use it in existing diagnostic.
(start_class): Accept obj_root_class type attributes.  Warn when
the interface for an implementation does not contain a super
class (unless the diagnostic is suppressed by the the command
line flag or the objc_root_class type attribute).

gcc/testsuite/ChangeLog:

PR objc/77404
* objc.dg/attributes/root-class-01.m: New test.
* objc.dg/root-class-00.m: New test.
* obj-c++.dg/attributes/root-class-01.mm: New test.
* obj-c++.dg/root-class-00.mm: New test.

gcc/ChangeLog:

PR objc/77404
* doc/extend.texi: Document the objc_root_class attribute.
* doc/invoke.texi: Document -Wobjc-root-class.

3 years agoremove almost all users of gimple_expr_code
Richard Biener [Fri, 13 Nov 2020 10:33:22 +0000 (11:33 +0100)]
remove almost all users of gimple_expr_code

This replaces the old-school gimple_expr_code with more selective
functions throughout the compiler, in all cases making the code
shorter or more clear.

2020-11-13  Richard Biener  <rguenther@suse.de>

* cfgexpand.c (gimple_assign_rhs_to_tree): Use
gimple_assign_rhs_class.
(expand_gimple_stmt_1): Likewise.
* gimplify-me.c (gimple_regimplify_operands): Use
gimple_assign_single_p.
* ipa-icf-gimple.c (func_checker::compare_gimple_assign):
Remove redundant compare.
(func_checker::compare_gimple_cond): Use gimple_cond_code.
* tree-ssa-tail-merge.c (gimple_equal_p): Likewise.
* predict.c (predict_loops): Use gimple_assign_rhs_code.

3 years agoInline delegators in vrp_folder.
Aldy Hernandez [Wed, 11 Nov 2020 20:09:16 +0000 (21:09 +0100)]
Inline delegators in vrp_folder.

gcc/ChangeLog:

* tree-vrp.c (class vrp_folder): Make visit_stmt, visit_phi,
and m_vr_values private.
(vrp_folder::vrp_evaluate_conditional): Remove.
(vrp_folder::vrp_simplify_stmt_using_ranges): Remove.
(vrp_folder::fold_predicate_in): Inline
vrp_evaluate_conditional and vrp_simplify_stmt_using_ranges.
(vrp_folder::fold_stmt): Same.

3 years agoMove vr_values out of vrp_prop into execute_vrp so it can be shared.
Aldy Hernandez [Wed, 11 Nov 2020 20:04:58 +0000 (21:04 +0100)]
Move vr_values out of vrp_prop into execute_vrp so it can be shared.

vr_values is being shared among the propagator and the folder and
passed around.  I've pulled it out from the propagator so it can be
passed around to each, instead of being publicly accessible from the
propagator.

gcc/ChangeLog:

* tree-vrp.c (class vrp_prop): Rename vr_values to m_vr_values.
(vrp_prop::vrp_prop): New.
(vrp_prop::initialize): Rename vr_values to m_vr_values.
(vrp_prop::visit_stmt): Same.
(vrp_prop::visit_phi): Same.
(vrp_prop::finalize): Same.
(execute_vrp): Instantiate vrp_vr_values and pass it to folder
and propagator.

3 years agoMove vrp_prop before vrp_folder.
Aldy Hernandez [Wed, 11 Nov 2020 19:48:34 +0000 (20:48 +0100)]
Move vrp_prop before vrp_folder.

gcc/ChangeLog:

* tree-vrp.c (class vrp_prop): Move entire class...
(class vrp_folder): ...before here.

3 years agoRefactor VRP threading code into vrp_jump_threader class.
Aldy Hernandez [Wed, 11 Nov 2020 19:10:42 +0000 (20:10 +0100)]
Refactor VRP threading code into vrp_jump_threader class.

gcc/ChangeLog:

* tree-vrp.c (identify_jump_threads): Refactor to..
(vrp_jump_threader::vrp_jump_threader): ...here
(vrp_jump_threader::~vrp_jump_threader): ...and here.
(vrp_jump_threader::after_dom_children): Rename vr_values to
m_vr_values.
(execute_vrp): Use vrp_jump_threader.

3 years agoGroup tree-vrp.c by functionality.
Aldy Hernandez [Wed, 11 Nov 2020 17:30:01 +0000 (18:30 +0100)]
Group tree-vrp.c by functionality.

Earlier in this cycle there was some work by Giuliano Belinassi and
myself to refactor tree-vrp.c.  A lot of functions and globals were
moved into independent classes, but the haphazard layout remained.
Assertion methods were indispersed with the propagation code, and with
the jump threading code, etc etc.

This series of patches moves things around so that common
functionality is geographically close.  There is no change in
behavior.

I know this is all slated to go in the next release, but finding
things in the current code base, even if just to compare with the
ranger, is difficult.

Since I keep getting bit by aarch64 regressions, I've tested the whole
set of patches on aarch64, as well as individually on x86-64 Linux.

gcc/ChangeLog:

* tree-vrp.c (struct assert_locus): Move.
(class vrp_insert): Rename to vrp_asserts.
(vrp_insert::build_assert_expr_for): Move to vrp_asserts.
(fp_predicate): Same.
(vrp_insert::dump): Same.
(vrp_insert::register_new_assert_for): Same.
(extract_code_and_val_from_cond_with_ops): Move.
(vrp_insert::finish_register_edge_assert_for): Move to vrp_asserts.
(maybe_set_nonzero_bits): Move.
(vrp_insert::find_conditional_asserts): Move to vrp_asserts.
(stmt_interesting_for_vrp): Move.
(struct case_info): Move.
(compare_case_labels): Move.
(lhs_of_dominating_assert): Move.
(find_case_label_index): Move.
(find_case_label_range): Move.
(class vrp_asserts): New.
(vrp_asserts::build_assert_expr_for): Rename from vrp_insert.
(vrp_asserts::dump): Same.
(vrp_asserts::register_new_assert_for): Same.
(vrp_asserts::finish_register_edge_assert_for): Same.
(vrp_asserts::find_conditional_asserts): Same.
(vrp_asserts::compare_case_labels): Same.
(vrp_asserts::find_switch_asserts): Same.
(vrp_asserts::find_assert_locations_in_bb): Same.
(vrp_asserts::find_assert_locations): Same.
(vrp_asserts::process_assert_insertions_for): Same.
(vrp_asserts::compare_assert_loc): Same.
(vrp_asserts::process_assert_insertions): Same.
(vrp_asserts::insert_range_assertions): Same.
(vrp_asserts::all_imm_uses_in_stmt_or_feed_cond): Same.
(vrp_asserts::remove_range_assertions): Same.
(class vrp_prop): Move.
(all_imm_uses_in_stmt_or_feed_cond): Move.
(vrp_prop::vrp_initialize): Move.
(class vrp_folder): Move.
(vrp_folder::fold_predicate_in): Move.
(vrp_folder::fold_stmt): Move.
(vrp_prop::initialize): Move.
(vrp_prop::visit_stmt): Move.
(enum ssa_prop_result): Move.
(vrp_prop::visit_phi): Move.
(vrp_prop::finalize): Move.
(class vrp_dom_walker): Rename to...
(class vrp_jump_threader): ...this.
(vrp_jump_threader::before_dom_children): Rename from
vrp_dom_walker.
(simplify_stmt_for_jump_threading): Rename to...
(vrp_jump_threader::simplify_stmt): ...here.
(vrp_jump_threader::after_dom_children): Same.
(identify_jump_threads): Move.
(vrp_prop::vrp_finalize): Move array bounds setup code to...
(execute_vrp): ...here.

3 years agoMAINTAINERS: add myself for write after approval
Haochen Gui [Fri, 13 Nov 2020 03:01:12 +0000 (11:01 +0800)]
MAINTAINERS: add myself for write after approval

ChangeLog:

2020-11-13  Haochen Gui  <guihaoc@gcc.gnu.org>

* MAINTAINERS (Write After Approval): add myself

3 years agoChange range_handler, was Re: Fix gimple_expr_code?
Andrew MacLeod [Fri, 13 Nov 2020 00:25:59 +0000 (19:25 -0500)]
Change range_handler, was  Re: Fix gimple_expr_code?

Adjust the range_handler to not use gimple_expr_code/type.

* gimple-range.h (gimple_range_handler): Use gimple_assign and
gimple_cond routines to get type and code.
* range-op.cc (range_op_handler): Check for integral types.

3 years agoDaily bump.
GCC Administrator [Fri, 13 Nov 2020 00:16:35 +0000 (00:16 +0000)]
Daily bump.

3 years agoc++: Don't form a templated TARGET_EXPR in finish_compound_literal
Patrick Palka [Fri, 13 Nov 2020 00:07:40 +0000 (19:07 -0500)]
c++: Don't form a templated TARGET_EXPR in finish_compound_literal

The atom_cache in normalize_atom relies on the assumption that two
equivalent (templated) trees (in the sense of cp_tree_equal) must use
the same template parameters (according to find_template_parameters).

This assumption unfortunately doesn't always hold for TARGET_EXPRs,
because cp_tree_equal ignores an artificial target of a TARGET_EXPR, but
find_template_parameters walks this target (and its DECL_CONTEXT).

Hence two TARGET_EXPRs built by force_target_expr with the same
initializer and under different settings of current_function_decl will
compare equal according to cp_tree_equal, but find_template_parameters
may return a different set of template parameters for them.  This breaks
the below testcase because during normalization we build two such
TARGET_EXPRs (one under current_function_decl=f and another under =g),
and then share the same ATOMIC_CONSTR for the two corresponding atoms,
leading to a crash during satisfaction of g's associated constraints.

This patch works around this issue by removing the source of these
templated TARGET_EXPRs.  The relevant call to get_target_expr_sfinae was
added in r9-6043, and it seems it's no longer necessary (according to
https://gcc.gnu.org/pipermail/gcc-patches/2019-February/517323.html, the
call was added in order to avoid regressing on initlist109.C at the time).

gcc/cp/ChangeLog:

* semantics.c (finish_compound_literal): Don't wrap the original
compound literal in a TARGET_EXPR when inside a template.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-decltype3.C: New test.

3 years agolibstdc++: Optimise std::future::wait_for and fix futex polling
Jonathan Wakely [Thu, 12 Nov 2020 21:25:14 +0000 (21:25 +0000)]
libstdc++: Optimise std::future::wait_for and fix futex polling

To poll a std::future to see if it's ready you have to call one of the
timed waiting functions. The most obvious way is wait_for(0s) but this
was previously very inefficient because it would turn the relative
timeout to an absolute one by calling system_clock::now(). When the
relative timeout is zero (or less) we're obviously going to get a time
that has already passed, but the overhead of obtaining the current time
can be dozens of microseconds. The alternative is to call wait_until
with an absolute timeout that is in the past. If you know the clock's
epoch is in the past you can use a default constructed time_point.
Alternatively, using some_clock::time_point::min() gives the earliest
time point supported by the clock, which should be safe to assume is in
the past. However, using a futex wait with an absolute timeout before
the UNIX epoch fails and sets errno=EINVAL. The new code using futex
waits with absolute timeouts was not checking for this case, which could
result in hangs (or killing the process if the libray is built with
assertions enabled).

This patch checks for times before the epoch before attempting to wait
on a futex with an absolute timeout, which fixes the hangs or crashes.
It also makes it very fast to poll using an absolute timeout before the
epoch (because we skip the futex syscall).

It also makes future::wait_for avoid waiting at all when the relative
timeout is zero or less, to avoid the unnecessary overhead of getting
the current time. This makes polling with wait_for(0s) take only a few
cycles instead of dozens of milliseconds.

libstdc++-v3/ChangeLog:

* include/std/future (future::wait_for): Do not wait for
durations less than or equal to zero.
* src/c++11/futex.cc (_M_futex_wait_until)
(_M_futex_wait_until_steady): Do not wait for timeouts before
the epoch.
* testsuite/30_threads/future/members/poll.cc: New test.

3 years agojit: add support for inline asm [PR87291]
David Malcolm [Thu, 12 Nov 2020 22:28:17 +0000 (17:28 -0500)]
jit: add support for inline asm [PR87291]

This patch adds various entrypoints to libgccjit for directly embedding
asm statements into a compile, analogous to inline asm in the C frontend:
  gcc_jit_block_add_extended_asm
  gcc_jit_block_end_with_extended_asm_goto
  gcc_jit_extended_asm_as_object
  gcc_jit_extended_asm_set_volatile_flag
  gcc_jit_extended_asm_set_inline_flag
  gcc_jit_extended_asm_add_output_operand
  gcc_jit_extended_asm_add_input_operand
  gcc_jit_extended_asm_add_clobber
  gcc_jit_context_add_top_level_asm

gcc/jit/ChangeLog:
PR jit/87291
* docs/cp/topics/asm.rst: New file.
* docs/cp/topics/index.rst (Topic Reference): Add it.
* docs/topics/asm.rst: New file.
* docs/topics/compatibility.rst (LIBGCCJIT_ABI_15): New.
* docs/topics/functions.rst (Statements): Add link to extended
asm.
* docs/topics/index.rst (Topic Reference): Add asm.rst.
* docs/topics/objects.rst: Add gcc_jit_extended_asm to ASCII art.
* docs/_build/texinfo/Makefile: Regenerate.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-common.h (gcc::jit::recording::extended_asm): New forward
decl.
(gcc::jit::recording::top_level_asm): Likewise.
* jit-playback.c: Include "stmt.h".
(build_string): New.
(gcc::jit::playback::context::new_string_literal): Disambiguate
build_string call.
(gcc::jit::playback::context::add_top_level_asm): New.
(build_operand_chain): New.
(build_clobbers): New.
(build_goto_operands): New.
(gcc::jit::playback::block::add_extended_asm): New.
* jit-playback.h (gcc::jit::playback::context::add_top_level_asm):
New decl.
(struct gcc::jit::playback::asm_operand): New struct.
(gcc::jit::playback::block::add_extended_asm): New decl.
* jit-recording.c (gcc::jit::recording::context::dump_to_file):
Dump top-level asms.
(gcc::jit::recording::context::add_top_level_asm): New.
(gcc::jit::recording::block::add_extended_asm): New.
(gcc::jit::recording::block::end_with_extended_asm_goto): New.
(gcc::jit::recording::asm_operand::asm_operand): New.
(gcc::jit::recording::asm_operand::print): New.
(gcc::jit::recording::asm_operand::make_debug_string): New.
(gcc::jit::recording::output_asm_operand::write_reproducer): New.
(gcc::jit::recording::output_asm_operand::print): New.
(gcc::jit::recording::input_asm_operand::write_reproducer): New.
(gcc::jit::recording::input_asm_operand::print): New.
(gcc::jit::recording::extended_asm::add_output_operand): New.
(gcc::jit::recording::extended_asm::add_input_operand): New.
(gcc::jit::recording::extended_asm::add_clobber): New.
(gcc::jit::recording::extended_asm::replay_into): New.
(gcc::jit::recording::extended_asm::make_debug_string): New.
(gcc::jit::recording::extended_asm::write_flags): New.
(gcc::jit::recording::extended_asm::write_clobbers): New.
(gcc::jit::recording::extended_asm_simple::write_reproducer): New.
(gcc::jit::recording::extended_asm::maybe_populate_playback_blocks):
New.
(gcc::jit::recording::extended_asm_goto::extended_asm_goto): New.
(gcc::jit::recording::extended_asm_goto::replay_into): New.
(gcc::jit::recording::extended_asm_goto::write_reproducer): New.
(gcc::jit::recording::extended_asm_goto::get_successor_blocks):
New.
(gcc::jit::recording::extended_asm_goto::maybe_print_gotos): New.
(gcc::jit::recording::extended_asm_goto::maybe_populate_playback_blocks):
New.
(gcc::jit::recording::top_level_asm::top_level_asm): New.
(gcc::jit::recording::top_level_asm::replay_into): New.
(gcc::jit::recording::top_level_asm::make_debug_string): New.
(gcc::jit::recording::top_level_asm::write_to_dump): New.
(gcc::jit::recording::top_level_asm::write_reproducer): New.
* jit-recording.h
(gcc::jit::recording::context::add_top_level_asm): New decl.
(gcc::jit::recording::context::m_top_level_asms): New field.
(gcc::jit::recording::block::add_extended_asm): New decl.
(gcc::jit::recording::block::end_with_extended_asm_goto): New
decl.
(gcc::jit::recording::asm_operand): New class.
(gcc::jit::recording::output_asm_operand): New class.
(gcc::jit::recording::input_asm_operand): New class.
(gcc::jit::recording::extended_asm): New class.
(gcc::jit::recording::extended_asm_simple): New class.
(gcc::jit::recording::extended_asm_goto): New class.
(gcc::jit::recording::top_level_asm): New class.
* libgccjit++.h (gccjit::extended_asm): New forward decl.
(gccjit::context::add_top_level_asm): New.
(gccjit::block::add_extended_asm): New.
(gccjit::block::end_with_extended_asm_goto): New.
(gccjit::extended_asm): New class.
(gccjit::extended_asm::extended_asm): New ctors.
(gccjit::extended_asm::set_volatile_flag): New.
(gccjit::extended_asm::set_inline_flag): New.
(gccjit::extended_asm::add_output_operand): New.
(gccjit::extended_asm::add_input_operand): New.
(gccjit::extended_asm::add_clobber): New.
(gccjit::extended_asm::get_inner_extended_asm): New.
* libgccjit.c (struct gcc_jit_extended_asm): New.
(jit_error): Make "loc" param take a gcc::jit::recording::location *
rather than a gcc_jit_location *.
(gcc_jit_block_add_extended_asm): New entrypoint.
(gcc_jit_block_end_with_extended_asm_goto): New entrypoint.
(gcc_jit_extended_asm_as_object): New entrypoint.
(gcc_jit_extended_asm_set_volatile_flag): New entrypoint.
(gcc_jit_extended_asm_set_inline_flag): New entrypoint.
(gcc_jit_extended_asm_add_output_operand): New entrypoint.
(gcc_jit_extended_asm_add_clobber): New entrypoint.
(gcc_jit_context_add_top_level_asm): New entrypoint.
* libgccjit.h: Add gcc_jit_extended_asm to ASCII art.
(gcc_jit_extended_asm): New typedef.
(LIBGCCJIT_HAVE_ASM_STATEMENTS): New define.
(gcc_jit_block_add_extended_asm): New entrypoint.
(gcc_jit_block_end_with_extended_asm_goto): New entrypoint.
(gcc_jit_extended_asm_as_object): New entrypoint.
(gcc_jit_extended_asm_set_volatile_flag): New entrypoint.
(gcc_jit_extended_asm_set_inline_flag): New entrypoint.
(gcc_jit_extended_asm_add_output_operand): New entrypoint.
(gcc_jit_extended_asm_add_input_operand): New entrypoint.
(gcc_jit_extended_asm_add_clobber): New entrypoint.
(gcc_jit_context_add_top_level_asm): New entrypoint.
* libgccjit.map (LIBGCCJIT_ABI_15): New.

gcc/testsuite/ChangeLog:
PR jit/87291
* jit.dg/jit.exp: Load target-supports-dg.exp.
Set dg-do-what-default.
(jit-dg-test): Set dg-do-what and call dg-get-options, skipping
the test if it's not supported on the given target.
* jit.dg/test-asm.c: New test.
* jit.dg/test-asm.cc: New test.

3 years agojit: fix string escaping
David Malcolm [Thu, 12 Nov 2020 22:27:28 +0000 (17:27 -0500)]
jit: fix string escaping

This patch fixes a bug in recording::string::make_debug_string in which
'\t' and '\n' were "escaped" by simply prepending a '\', thus emitting
'\' then '\n', rather than '\' then 'n'.  It also removes a hack that
determined if a string is to be escaped by checking for a leading '"',
by instead adding a flag.

gcc/jit/ChangeLog:
* jit-recording.c (recording::context::new_string): Add "escaped"
param and use it when creating the new recording::string instance.
(recording::string::string): Add "escaped" param and use it to
initialize m_escaped.
(recording::string::make_debug_string): Replace check that first
char is double-quote with use of m_escaped.  Fix escaping of
'\t' and '\n'.  Set "escaped" on the result.
* jit-recording.h (recording::context::new_string): Add "escaped"
param.
(recording::string::string): Add "escaped" param.
(recording::string::m_escaped): New field.

gcc/testsuite/ChangeLog:
* jit.dg/test-debug-strings.c (create_code): Add tests of
string literal escaping.

3 years agolibgccjit.h: fix typo in comment
David Malcolm [Thu, 12 Nov 2020 22:26:01 +0000 (17:26 -0500)]
libgccjit.h: fix typo in comment

gcc/jit/ChangeLog:
* libgccjit.h: Fix typo in comment.

3 years agoRISC-V: Enable ifunc if it was supported in the binutils for linux toolchain.
Nelson Chu [Wed, 11 Nov 2020 03:33:38 +0000 (19:33 -0800)]
RISC-V: Enable ifunc if it was supported in the binutils for linux toolchain.

gcc/
* configure: Regenerated.
* configure.ac: If ifunc was supported in the binutils for
linux toolchain, then set enable_gnu_indirect_function to yes.

3 years agoc: C2x __has_c_attribute
Joseph Myers [Thu, 12 Nov 2020 21:13:51 +0000 (21:13 +0000)]
c: C2x __has_c_attribute

C2x adds the __has_c_attribute preprocessor operator, similar to C++
__has_cpp_attribute.

GCC implements __has_cpp_attribute as exactly equivalent to
__has_attribute.  (The documentation says they differ regarding the
values returned for standard attributes, but that's actually only a
matter of the particular nonzero value returned not being specified in
the documentation for __has_attribute; the implementation makes no
distinction between the two.)

I don't think having them exactly equivalent is actually correct,
either for __has_cpp_attribute or for __has_c_attribute.
Specifically, I think it is only correct for __has_cpp_attribute or
__has_c_attribute to return nonzero if the given attribute is
supported, with the particular pp-tokens passed to __has_cpp_attribute
or __has_c_attribute, with [[]] syntax, not if it's only accepted in
__attribute__ or with gnu:: added in [[]].  For example, they should
return nonzero for gnu::packed, but zero for plain packed, because
[[gnu::packed]] is accepted but [[packed]] is ignored as not a
standard attribute.

This patch implements that for __has_c_attribute, leaving any changes
to __has_cpp_attribute for the C++ maintainers.  A new
BT_HAS_STD_ATTRIBUTE is added for __has_c_attribute (which I think,
based on the above, would actually be correct to use for
__has_cpp_attribute as well).  The code in c_common_has_attribute that
deals with scopes has its C++ conditional removed; instead, whether
the language is C or C++ is used only to determine the numeric values
returned for standard attributes (and which standard attributes are
handled there at all).  A new argument is passed to
c_common_has_attribute to distinguish BT_HAS_STD_ATTRIBUTE from
BT_HAS_ATTRIBUTE, and that argument is used to stop attributes with no
scope specified from being accepted with __has_c_attribute unless they
are one of the known standard attributes and so handled specially.

Although the standard specify constants ending with 'L' as the values
for the standard attributes, there is no correctness issue with the
lack of code in GCC to add that 'L' to the expansion:
__has_c_attribute and __has_cpp_attribute are expanded in #if after
other macro expansion has occurred, with no semantics being specified
if they occur outside #if, so there is no way for a conforming program
to inspect the exact text of the expansion of those macros, only to
use the resulting pp-number in a #if expression, where long and int
have the same set of values.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/
2020-11-12  Joseph Myers  <joseph@codesourcery.com>

* doc/cpp.texi (__has_attribute): Document when scopes are allowed
for C.
(__has_c_attribute): New.

gcc/c-family/
2020-11-12  Joseph Myers  <joseph@codesourcery.com>

* c-lex.c (c_common_has_attribute): Take argument std_syntax.
Allow scope for C.  Handle standard attributes for C.  Do not
accept unscoped attributes if std_syntax and not handled as
standard attributes.
* c-common.h (c_common_has_attribute): Update prototype.

gcc/testsuite/
2020-11-12  Joseph Myers  <joseph@codesourcery.com>

* gcc.dg/c2x-has-c-attribute-1.c, gcc.dg/c2x-has-c-attribute-2.c,
gcc.dg/c2x-has-c-attribute-3.c, gcc.dg/c2x-has-c-attribute-4.c:
New tests.

libcpp/
2020-11-12  Joseph Myers  <joseph@codesourcery.com>

* include/cpplib.h (struct cpp_callbacks): Add bool argument to
has_attribute.
(enum cpp_builtin_type): Add BT_HAS_STD_ATTRIBUTE.
* init.c (builtin_array): Add __has_c_attribute.
(cpp_init_special_builtins): Handle BT_HAS_STD_ATTRIBUTE.
* macro.c (_cpp_builtin_macro_text): Handle BT_HAS_STD_ATTRIBUTE.
Update call to has_attribute for BT_HAS_ATTRIBUTE.
* traditional.c (fun_like_macro): Handle BT_HAS_STD_ATTRIBUTE.

3 years agoopenmp: Implement allocate clause in omp lowering.
Jakub Jelinek [Thu, 12 Nov 2020 20:38:04 +0000 (21:38 +0100)]
openmp: Implement allocate clause in omp lowering.

For now, task/taskloop constructs aren't handled and C/C++ array reductions
and reductions with task or inscan modifiers need further work.
Instead of calling omp_alloc/omp_free (where the former doesn't have
alignment argument and omp_aligned_alloc is 5.1 only feature), this calls
GOMP_alloc/GOMP_free, so that the library can fail if it would fall back
into NULL (exception is zero length allocations).

2020-11-12  Jakub Jelinek  <jakub@redhat.com>

gcc/
* builtin-types.def (BT_FN_PTR_SIZE_SIZE_PTRMODE): New function type.
* omp-builtins.def (BUILT_IN_GOACC_DECLARE): Move earlier.
(BUILT_IN_GOMP_ALLOC, BUILT_IN_GOMP_FREE): New builtins.
* gimplify.c (gimplify_scan_omp_clauses): Force allocator into a
decl if it is not NULL, INTEGER_CST or decl.
(gimplify_adjust_omp_clauses): Clear GOVD_EXPLICIT on explicit clauses
which are being removed.  Remove allocate clauses for variables not seen
if they are private, firstprivate or linear too.  Call
omp_notice_variable on the allocator otherwise.
(gimplify_omp_for): Handle iterator vars mentioned in allocate clauses
similarly to non-is_gimple_reg iterators.
* omp-low.c (struct omp_context): Add allocate_map field.
(delete_omp_context): Delete it.
(scan_sharing_clauses): Fill it from allocate clauses.  Remove it
if mentioned also in shared clause.
(lower_private_allocate): New function.
(lower_rec_input_clauses): Handle allocate clause for privatized
variables, except for task/taskloop, C/C++ array reductions for now
and task/inscan variables.
(lower_send_shared_vars): Don't consider variables in allocate_map
as shared.
* omp-expand.c (expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk): Use expand_omp_build_assign instead of
gimple_build_assign + gsi_insert_after.
* builtins.c (builtin_fnspec): Handle BUILTIN_GOMP_ALLOC and
BUILTIN_GOMP_FREE.
* tree-ssa-ccp.c (evaluate_stmt): Handle BUILTIN_GOMP_ALLOC.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Handle
BUILTIN_GOMP_ALLOC.
(mark_all_reaching_defs_necessary_1): Handle BUILTIN_GOMP_ALLOC
and BUILTIN_GOMP_FREE.
(propagate_necessity): Likewise.
gcc/fortran/
* f95-lang.c (ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST):
Define.
(gfc_init_builtin_functions): Add alloc_size and warn_unused_result
attributes to __builtin_GOMP_alloc.
* types.def (BT_PTRMODE): New primitive type.
(BT_FN_VOID_PTR_PTRMODE, BT_FN_PTR_SIZE_SIZE_PTRMODE): New function
types.
libgomp/
* libgomp.map (GOMP_alloc, GOMP_free): Export at GOMP_5.0.1.
* omp.h.in (omp_alloc): Add malloc and alloc_size attributes.
* libgomp_g.h (GOMP_alloc, GOMP_free): Declare.
* allocator.c (omp_aligned_alloc): New for now static function,
add alignment argument and handle it.
(omp_alloc): Reimplement using omp_aligned_alloc.
(GOMP_alloc, GOMP_free): New functions.
(omp_free): Add ialias.
* testsuite/libgomp.c-c++-common/allocate-1.c: New test.
* testsuite/libgomp.c++/allocate-1.C: New test.

3 years agoAdjust 'libgomp.oacc-fortran/attach-descriptor-1.f90' for improved location information
Thomas Schwinge [Thu, 12 Nov 2020 19:07:25 +0000 (20:07 +0100)]
Adjust 'libgomp.oacc-fortran/attach-descriptor-1.f90' for improved location information

Fix-up for commit b71ff8c15f5a7d6b1cc1524b4d27843f0d88dbda "Fortran: improve
location data for OpenACC/OpenMP directives [PR97782]".

libgomp/
PR fortran/97782
* testsuite/libgomp.oacc-fortran/attach-descriptor-1.f90: Adjust.

3 years agocgraph: Avoid segfault when attempting to dump NULL clone_info
Martin Jambor [Thu, 12 Nov 2020 18:56:07 +0000 (19:56 +0100)]
cgraph: Avoid segfault when attempting to dump NULL clone_info

cgraph_node::materialize_clone segfaulted when I tried compiling
Tramp3D with -fdump-ipa-all because there was no clone_info - IPA-CP
created a clone only for an aggregate constant, adding a note to its
transformation summary but not creating any tree_map nor
param_adjustements.

Fixed with the following obvious extra checks which has passed
bootstrap and testing on x86_64-linux.

gcc/ChangeLog:

2020-11-12  Martin Jambor  <mjambor@suse.cz>

* cgraphclones.c (cgraph_node::materialize_clone): Check that clone
info is not NULL before attempting to dump it.

3 years agoipa-cp: Work with time benefits and frequencies in sreals
Martin Jambor [Thu, 12 Nov 2020 18:56:07 +0000 (19:56 +0100)]
ipa-cp: Work with time benefits and frequencies in sreals

This patch converts the variables that hold time benefits and
frequencies in IPA-CP from plain integers to sreals, avoiding the need
to cap them to avoid overflows and also fixing a potential underflows.

Size costs corresponding to individual constants are left as ints so
that they do not take up too much space.  Care must be taken that
adding it up does not overflow, especially in the case of
prop_size_cost, because in cases of extremely long chains of lattice
dependencies it can overflow (e.g. in testsuite/gcc.dg/ipa/pr50744.c).
The overall size is already tracked in long ints.

gcc/ChangeLog:

2020-11-11  Martin Jambor  <mjambor@suse.cz>

* ipa-cp.c (class ipcp_value_base): Change the type of
local_time_benefit and prop_time_benefit to sreal.  Adjust the
constructor initializer.
(ipcp_lattice::print): Dump sreals.
(struct caller_statistics): Change the type of freq_sum to sreal.
(gather_caller_stats): Work with sreal freq_sum.
(incorporate_penalties): Work with sreal evaluation.
(good_cloning_opportunity_p): Adjusted for sreal sreal time_benefit
and freq_sum.  Bail out if size_cost is INT_MAX.
(perform_estimation_of_a_value): Work with sreal time_benefit.  Avoid
unnecessary capping.
(estimate_local_effects): Pass sreal time benefit to
good_cloning_opportunity_p without capping it.  Adjust dumping.
(safe_add): If there can be overflow, return INT_MAX.
(propagate_effects): Work with sreal times.
(get_info_about_necessary_edges): Work with sreal frequencies.
(decide_about_value): Likewise and with sreal time benefits.

3 years agosystem: Add WARN_UNUSED_RESULT
Marek Polacek [Thu, 12 Nov 2020 01:18:06 +0000 (20:18 -0500)]
system: Add WARN_UNUSED_RESULT

I'd like to have the option of marking functions with
__attribute__ ((__warn_unused_result__)), so this patch adds a macro.
And use it for maybe_wrap_with_location, it's always a bug if the
return value is not used, which happened to me and got me confused.

gcc/ChangeLog:

* system.h (WARN_UNUSED_RESULT): Define for GCC >= 3.4.
* tree.h (maybe_wrap_with_location): Add WARN_UNUSED_RESULT.

3 years agoCompare field offsets in operand_equal_p and OEP_ADDRESS_OF
Jan Hubicka [Thu, 12 Nov 2020 16:15:19 +0000 (17:15 +0100)]
Compare field offsets in operand_equal_p and OEP_ADDRESS_OF

* fold-const.c (operand_compare::operand_equal_p): Compare field
offsets in operand_equal_p and OEP_ADDRESS_OF.
(operand_compare::hash_operand): Update.

3 years agolibstdc++: Simplify __numeric_traits definition
Jonathan Wakely [Thu, 12 Nov 2020 13:31:02 +0000 (13:31 +0000)]
libstdc++: Simplify __numeric_traits definition

This changes the __numeric_traits primary template to assume its
argument is an integer type. For the three floating point types that are
supported by __numeric_traits_floating an explicit specialization of
__numeric_traits chooses the right base class.

This improves the failure mode for using __numeric_traits with an
unsupported type. Previously it would use __numeric_traits_floating as
the base class, and give somewhat obscure errors for trying to access
the static data members. Now it will use __numeric_traits_integer which
has a static_assert to check for supported types.

As a side effect of this change there is no need to instantiate
__conditional_type to decide which base class to use.

libstdc++-v3/ChangeLog:

* include/ext/numeric_traits.h (__numeric_traits): Change
primary template to always derive from __numeric_traits_integer.
(__numeric_traits<float>, __numeric_traits<double>)
(__numeric_traits<long double>): Add explicit specializations.

3 years agoMore PRE compile-time optimizations
Richard Biener [Thu, 12 Nov 2020 14:05:03 +0000 (15:05 +0100)]
More PRE compile-time optimizations

This fixes a bug in bitmap_list_view which could end up with
a NULL head->current which makes followup searches fail.  Oops.

It also further optimizes the PRE DFS walk by removing useless
stuff and special-casing bitmaps with just one element for
EXECUTE_IF_AND_IN_BITMAP which makes a quite big difference.

2020-11-12  Richard Biener  <rguenther@suse.de>

* bitmap.c (bitmap_list_view): Restore head->current.
* tree-ssa-pre.c (pre_expr_DFS): Elide expr_visited bitmap.
Special-case value expression bitmaps with one element.
(bitmap_find_leader): Likewise.
(sorted_array_from_bitmap_set): Elide expr_visited bitmap.

3 years agoSpecify reason of -Winvalid-pch warning
Nicholas Guriev [Thu, 12 Nov 2020 13:59:35 +0000 (08:59 -0500)]
Specify reason of -Winvalid-pch warning

gcc/c-family
PR pch/86674
* c-pch.c (c_common_valid_pch): Use cpp_warning with CPP_W_INVALID_PCH
reason to fix -Werror=invalid-pch and -Wno-error=invalid-pch switches.

libcpp
PR pch/86674
* files.c (_cpp_find_file): Use CPP_DL_NOTE not CPP_DL_ERROR in call to
cpp_error.

3 years agoAdd support for copy specifiers in fnspec
Jan Hubicka [Thu, 12 Nov 2020 13:56:40 +0000 (14:56 +0100)]
Add support for copy specifiers in fnspec

* attr-fnspec.h: Update topleve comment.
(attr_fnspec::arg_direct_p): Accept 1...9.
(attr_fnspec::arg_maybe_written_p): Reject 1...9.
(attr_fnspec::arg_copied_to_arg_p): New member function.
* builtins.c (builtin_fnspec): Update fnspec of block copy.
* tree-ssa-alias.c (attr_fnspec::verify): Update.

3 years agoFortran: improve location data for OpenACC/OpenMP directives [PR97782]
Tobias Burnus [Thu, 12 Nov 2020 13:13:45 +0000 (14:13 +0100)]
Fortran: improve location data for OpenACC/OpenMP directives [PR97782]

gcc/fortran/ChangeLog:

PR fortran/97782
* trans-openmp.c (gfc_trans_oacc_construct, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_do_simd, gfc_trans_omp_parallel_sections,
gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections
gfc_trans_omp_single, gfc_trans_omp_task, gfc_trans_omp_teams
gfc_trans_omp_target, gfc_trans_omp_target_data,
gfc_trans_omp_workshare): Use code->loc instead of input_location
when building the OMP_/OACC_ construct.

gcc/testsuite/ChangeLog:

PR fortran/97782
* gfortran.dg/goacc/classify-kernels-unparallelized.f95: Move dg-message
one line up.
* gfortran.dg/goacc/classify-kernels.f95: Likewise.

3 years agolibstdc++: Fix __numeric_traits_integer<__int20> [PR 97798]
Jonathan Wakely [Thu, 12 Nov 2020 10:29:21 +0000 (10:29 +0000)]
libstdc++: Fix __numeric_traits_integer<__int20> [PR 97798]

The expression used to calculate the maximum value for an integer type
assumes that the number of bits in the value representation is always
sizeof(T) * CHAR_BIT. This is not true for the __int20 type on msp430,
which has only 20 bits in the value representation but 32 bits in the
object representation. This causes an integer overflow in a constant
expression, which is ill-formed.

This problem was already solved by DJ for std::numeric_limits<__int20>
by generalizing the helper macros to use a specified number of bits
instead of assuming sizeof(T) * CHAR_BIT. Then the INT_N_n types can
specify the number of bits using the __GLIBCXX_BITSIZE_INT_N_n macros
that the compiler defines.

I'm using a slightly different approach here. I've replaced the helper
macros entirely, and just expanded the calculations in the initializers
for the static data members. By reordering the data members we can reuse
__is_signed and __digits in the other initializers. This removes the
repetition of expanding __glibcxx_signed(T) and __glibcxx_digits(T)
multiple times in each initializer.

The __is_integer_nonstrict trait now defines a new constant, __width,
which is sizeof(T) * CHAR_BIT by default (defined as an enumerator so
that no storage is needed for a static data member). By specializing
__is_integer_nonstrict for the INT_N types that have padding bits, we
can provide the correct width via the __GLIBCXX_BITSIZE_INT_N_n macros.

libstdc++-v3/ChangeLog:

PR libstdc++/97798
* include/ext/numeric_traits.h (__glibcxx_signed)
(__glibcxx_digits, __glibcxx_min, __glibcxx_max): Remove
macros.
(__is_integer_nonstrict::__width): Define new constant.
(__numeric_traits_integer): Define constants in terms of each
other and __is_integer_nonstrict::__width, rather than the
removed macros.
(_GLIBCXX_INT_N_TRAITS): Macro to define explicit
specializations for non-standard integer types.

3 years agoAdd test case for PR 97799.
Thomas Koenig [Thu, 12 Nov 2020 11:49:53 +0000 (12:49 +0100)]
Add test case for PR 97799.

gcc/testsuite/ChangeLog:

* gfortran.dg/entry_23.f: New test.

3 years agoAvoid PRE insert iteration when possible
Richard Biener [Thu, 12 Nov 2020 10:29:12 +0000 (11:29 +0100)]
Avoid PRE insert iteration when possible

The following make sure to only iterate PRE insertion when
necessary - which is when AVAIL_OUT of a predecessor of a
block we already visited changed (that's backedge destinations).

To not regress this also makes sure to locally iterate insertion
since even topological sort of expressions isn't enough to
guarantee we get all opportunities of a block in one iteration.
This avoids costly re-compute of the topologically sorted expression
array (more micro-optimization is possible here).

2020-11-12  Richard Biener  <rguenther@suse.de>

* tree-ssa-pre.c (bitmap_value_replace_in_set): Return
whether we have changed anything.
(do_pre_regular_insertion): Get topologically sorted array
of expressions from caller.
(do_pre_partial_partial_insertion): Likewise.
(insert): Compute topologically sorted arrays of expressions
here and locally iterate actual insertion.  Iterate only
when AVAIL_OUT of an already visited block source changed.

3 years agoaarch64: Fix SVE2 BCAX pattern [PR97730]
Alex Coplan [Thu, 12 Nov 2020 10:03:21 +0000 (10:03 +0000)]
aarch64: Fix SVE2 BCAX pattern [PR97730]

This patch adds a missing not to the SVE2 BCAX (Bitwise clear and
exclusive or) pattern, fixing the PR. Since SVE doesn't have an
unpredicated not instruction, we need to use a (vacuously) predicated
not here.

To ensure that the predicate is instantiated correctly (to all 1s) for
the intrinsics, we pull out a separate expander from the define_insn.

From the ISA reference [1]:
> Bitwise AND elements of the second source vector with the
> corresponding inverted elements of the third source vector, then
> exclusive OR the results with corresponding elements of the first
> source vector.

[1] : https://developer.arm.com/docs/ddi0602/g/a64-sve-instructions-alphabetic-order/bcax-bitwise-clear-and-exclusive-or

gcc/ChangeLog:

PR target/97730
* config/aarch64/aarch64-sve2.md (@aarch64_sve2_bcax<mode>):
Change to define_expand, add missing (trivially-predicated) not
rtx to fix wrong code bug.
(*aarch64_sve2_bcax<mode>): New.

gcc/testsuite/ChangeLog:

PR target/97730
* gcc.target/aarch64/sve2/bcax_1.c (OP): Add missing bitwise not
to match correct bcax semantics.
* gcc.dg/vect/pr97730.c: New test.

3 years agotree-optimization/97806 - fix PRE expression post order
Richard Biener [Thu, 12 Nov 2020 08:10:51 +0000 (09:10 +0100)]
tree-optimization/97806 - fix PRE expression post order

This fixes the postorder compute for the case of multiple
expression leaders for a value.

2020-11-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97806
* tree-ssa-pre.c (pre_expr_DFS): New overload for visiting
values, visiting all leaders for a value.  Use a bitmap
for visited values.
(sorted_array_from_bitmap_set): Walk over values and adjust.

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

3 years agoc++: Fix up constexpr CLEANUP_POINT_EXPR and TRY_FINALLY_EXPR handling [PR97790]
Jakub Jelinek [Thu, 12 Nov 2020 09:46:04 +0000 (10:46 +0100)]
c++: Fix up constexpr CLEANUP_POINT_EXPR and TRY_FINALLY_EXPR handling [PR97790]

As the testcase shows, CLEANUP_POINT_EXPR (and I think TRY_FINALLY_EXPR too)
suffer from the same problem that I was trying to fix in
r10-3597-g1006c9d4395a939820df76f37c7b085a4a1a003f
for CLEANUP_STMT, namely that if in the middle of the body expression of
those stmts is e.g. return stmt, goto, break or continue (something that
changes *jump_target and makes it start skipping stmts), we then skip the
cleanups too, which is not appropriate - the cleanups were either queued up
during the non-skipping execution of the body (for CLEANUP_POINT_EXPR), or
for TRY_FINALLY_EXPR are relevant already after entering the body block.

> Would it make sense to always use a NULL jump_target when evaluating
> cleanups?

I was afraid of that, especially for TRY_FINALLY_EXPR, but it seems that
during constexpr evaluation the cleanups will most often be just very simple
destructor calls (or calls to cleanup attribute functions).
Furthermore, for neither of these 3 tree codes we'll reach that code if
jump_target && *jump_target initially (there is a return NULL_TREE much
earlier for those except for trees that could embed labels etc. in it and
clearly these 3 don't count in that).

2020-11-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/97790
* constexpr.c (cxx_eval_constant_expression) <case CLEANUP_POINT_EXPR,
case TRY_FINALLY_EXPR, case CLEANUP_STMT>: Don't pass jump_target to
cxx_eval_constant_expression when evaluating the cleanups.

* g++.dg/cpp2a/constexpr-dtor9.C: New test.

3 years agoIBM Z: Fix PR97326: Enable fp compares in vec_cmp
Andreas Krebbel [Thu, 12 Nov 2020 07:20:43 +0000 (08:20 +0100)]
IBM Z: Fix PR97326: Enable fp compares in vec_cmp

gcc/ChangeLog:

PR target/97326
* config/s390/vector.md: Support vector floating point modes in
vec_cmp.

3 years agoIBM Z: Rename mode attr tointvec to TOINTVEC
Andreas Krebbel [Thu, 12 Nov 2020 07:20:43 +0000 (08:20 +0100)]
IBM Z: Rename mode attr tointvec to TOINTVEC

Just a preparation to add a lower-case tointvec.

gcc/ChangeLog:

* config/s390/vector.md: Rename tointvec to TOINTVEC.
* config/s390/vx-builtins.md: Likewise.

3 years agodwarf2: Set DW_AT_declaration for undefined fns [PR97060]
Jason Merrill [Tue, 10 Nov 2020 23:02:04 +0000 (18:02 -0500)]
dwarf2: Set DW_AT_declaration for undefined fns [PR97060]

If DECL_INITIAL isn't set, we can't emit anything about the body of the
function, so add the declaration attribute.

gcc/ChangeLog:

PR debug/97060
* dwarf2out.c (gen_subprogram_die): It's a declaration
if DECL_INITIAL isn't set.

gcc/testsuite/ChangeLog:

PR debug/97060
* gcc.dg/debug/dwarf2/pr97060.c: New test.

3 years agotestsuite: Adjust pr96789.c by disabling loop vect
Kewen Lin [Thu, 12 Nov 2020 03:18:23 +0000 (21:18 -0600)]
testsuite: Adjust pr96789.c by disabling loop vect

New test gcc.dg/tree-ssa/pr96789.c fails on
arm-none-linux-gnueabihf since loop vectorizer is able to optimize
the two loops which operate on array tmp with load_lanes feature
support, it make dse3 fail to find expected inputs.

As Richard suggested, this patch is to replace option
-ftree-vectorize to -ftree-slp-vectorize -fno-tree-loop-vectorize.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr96789.c: Adjusted by disabling loop
vectorization.

3 years agoanalyzer: precision-of-wording for -Wanalyzer-stale-setjmp-buffer
David Malcolm [Thu, 12 Nov 2020 02:18:59 +0000 (21:18 -0500)]
analyzer: precision-of-wording for -Wanalyzer-stale-setjmp-buffer

This patch adds a custom event to paths emitted by
-Wanalyzer-stale-setjmp-buffer highlighting the place where the
pertinent stack frame is popped, and updates the final event in
the path to reference this.

gcc/analyzer/ChangeLog:
* checker-path.h (checker_event::get_id_ptr): New.
* diagnostic-manager.cc (path_builder::path_builder): Add "sd"
param and use it to initialize new field "m_sd".
(path_builder::get_pending_diagnostic): New.
(path_builder::m_sd): New field.
(diagnostic_manager::emit_saved_diagnostic): Pass sd to
path_builder ctor.
(diagnostic_manager::add_events_for_superedge): Call new
maybe_add_custom_events_for_superedge vfunc.
* engine.cc (stale_jmp_buf::stale_jmp_buf): Add "setjmp_point"
param and use it to initialize new field "m_setjmp_point".
Initialize new field "m_stack_pop_event".
(stale_jmp_buf::maybe_add_custom_events_for_superedge): New vfunc
implementation.
(stale_jmp_buf::describe_final_event): New vfunc implementation.
(stale_jmp_buf::m_setjmp_point): New field.
(stale_jmp_buf::m_stack_pop_event): New field.
(exploded_node::on_longjmp): Pass setjmp_point to stale_jmp_buf
ctor.
* pending-diagnostic.h
(pending_diagnostic::maybe_add_custom_events_for_superedge): New
vfunc.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/setjmp-5.c: Update expected path output to show
an event where the pertinent stack frame is popped.  Update
expected message from final event to reference this event.

3 years agoanalyzer: warn on invalid shift counts [PR97424]
David Malcolm [Thu, 12 Nov 2020 02:16:45 +0000 (21:16 -0500)]
analyzer: warn on invalid shift counts [PR97424]

This patch implements -Wanalyzer-shift-count-negative
and -Wanalyzer-shift-count-overflow, analogous to the C/C++
warnings -Wshift-count-negative and -Wshift-count-overflow, but
implemented via interprocedural path analysis rather than via parsing
in a front end, and thus capable of detecting interprocedural cases that the
warnings implemented in the front ends can miss.

gcc/analyzer/ChangeLog:
PR tree-optimization/97424
* analyzer.opt (Wanalyzer-shift-count-negative): New.
(Wanalyzer-shift-count-overflow): New.
* region-model.cc (class shift_count_negative_diagnostic): New.
(class shift_count_overflow_diagnostic): New.
(region_model::get_gassign_result): Complain about shift counts that
are negative or are >= the operand's type's width.

gcc/ChangeLog:
PR tree-optimization/97424
* doc/invoke.texi (Static Analyzer Options): Add
-Wno-analyzer-shift-count-negative and
-Wno-analyzer-shift-count-overflow.
(-Wno-analyzer-shift-count-negative): New.
(-Wno-analyzer-shift-count-overflow): New.

gcc/testsuite/ChangeLog:
PR tree-optimization/97424
* gcc.dg/analyzer/invalid-shift-1.c: New test.

3 years agoDaily bump.
GCC Administrator [Thu, 12 Nov 2020 00:16:39 +0000 (00:16 +0000)]
Daily bump.

3 years agoCFI-handling : Add a hook to allow target-specific Personality and LSDA indirections.
Iain Sandoe [Mon, 16 Sep 2019 14:11:00 +0000 (15:11 +0100)]
CFI-handling : Add a hook to allow target-specific Personality and LSDA indirections.

At present, the output of .cfi_personality and .cfi_lsda assumes
ELF semantics for indirections.  This isn't suitable for all targets
and is one blocker to moving Darwin to use .cfi_xxxx.

The patch adds a target hook that allows non-ELF targets to use
indirections appropriate to their needs.

gcc/ChangeLog:

* config/darwin-protos.h (darwin_make_eh_symbol_indirect): New.
* config/darwin.c (darwin_make_eh_symbol_indirect): New. Use
Mach-O semantics for personality and ldsa indirections.
* config/darwin.h (TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT): New.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Add TARGET_ASM_MAKE_EH_SYMBOL_INDIRECT hook.
* dwarf2out.c (dwarf2out_do_cfi_startproc): If the target defines
a hook for indirecting personality and ldsa references, use that
otherwise default to ELF semantics.
* target.def (make_eh_symbol_indirect): New target hook.

3 years agoObjective-C++ : Allow prefix attrs on linkage specs.
Iain Sandoe [Mon, 26 Oct 2020 22:12:22 +0000 (22:12 +0000)]
Objective-C++ : Allow prefix attrs on linkage specs.

For Objective-C++, this combines prefix attributes from before and
after top level linkage specs.  The "reference implementation" for
Objective-C++ allows this, and system headers depend on it.

e.g.

__attribute__((__deprecated__))
extern "C" __attribute__((__visibility__("default")))
@interface MyClass
...
@end

Would consider the list of prefix attributes to the interface for
MyClass to include both the visibility and deprecated ones.

When we are compiling regular C++, this emits a warning and discards
any prefix attributes before a linkage spec.

gcc/cp/ChangeLog:

* parser.c (cp_parser_declaration): Unless we are compiling for
Ojective-C++, warn about and discard any attributes that prefix
a linkage specification.

3 years agoc++: Change the mangling of __alignof__ [PR88115]
Patrick Palka [Wed, 11 Nov 2020 20:11:23 +0000 (15:11 -0500)]
c++: Change the mangling of __alignof__ [PR88115]

This patch changes the mangling of __alignof__ to v111__alignof__,
making its mangling distinct from that of alignof(type) and
alignof(expr).

How we mangle ALIGNOF_EXPR now depends on its ALIGNOF_EXPR_STD_P flag,
which after the previous patch gets consistently set for alignof(type)
as well as alignof(expr).

gcc/c-family/ChangeLog:

PR c++/88115
* c-opts.c (c_common_post_options): Update latest_abi_version.

gcc/ChangeLog:

PR c++/88115
* common.opt (-fabi-version): Document =15.
* doc/invoke.texi (C++ Dialect Options): Likewise.

gcc/cp/ChangeLog:

PR c++/88115
* mangle.c (write_expression): Mangle __alignof_ differently
from alignof when the ABI version is at least 15.

libiberty/ChangeLog:

PR c++/88115
* cp-demangle.c (d_print_comp_inner)
<case DEMANGLE_COMPONENT_EXTENDED_OPERATOR>: Don't print the
"operator " prefix for __alignof__.
<case DEMANGLE_COMPONENT_UNARY>: Always print parens around the
operand of __alignof__.
* testsuite/demangle-expected: Test demangling for __alignof__.

gcc/testsuite/ChangeLog:

PR c++/88115
* g++.dg/abi/macro0.C: Adjust.
* g++.dg/cpp0x/alignof7.C: New test.
* g++.dg/cpp0x/alignof8.C: New test.

3 years agoc++: Correct the handling of alignof(expr) [PR88115]
Patrick Palka [Wed, 11 Nov 2020 19:43:39 +0000 (14:43 -0500)]
c++: Correct the handling of alignof(expr) [PR88115]

We're currently neglecting to set the ALIGNOF_EXPR_STD_P flag on an
ALIGNOF_EXPR when its operand is an expression.  This leads to us
handling alignof(expr) as if it were written __alignof__(expr), and
returning the preferred alignment instead of the ABI alignment.  In the
testcase below, this causes the first and third static_assert to fail on
x86.

gcc/cp/ChangeLog:

PR c++/88115
* cp-tree.h (cxx_sizeof_or_alignof_expr): Add bool parameter.
* decl.c (fold_sizeof_expr): Pass false to
cxx_sizeof_or_alignof_expr.
* parser.c (cp_parser_unary_expression): Pass std_alignof to
cxx_sizeof_or_alignof_expr.
* pt.c (tsubst_copy): Pass false to cxx_sizeof_or_alignof_expr.
(tsubst_copy_and_build): Pass std_alignof to
cxx_sizeof_or_alignof_expr.
* typeck.c (cxx_alignof_expr): Add std_alignof bool parameter
and pass it to cxx_sizeof_or_alignof_type.  Set ALIGNOF_EXPR_STD_P
appropriately.
(cxx_sizeof_or_alignof_expr): Add std_alignof bool parameter
and pass it to cxx_alignof_expr.  Assert op is either
SIZEOF_EXPR or ALIGNOF_EXPR.

libcc1/ChangeLog:

PR c++/88115
* libcp1plugin.cc (plugin_build_unary_expr): Pass true to
cxx_sizeof_or_alignof_expr.

gcc/testsuite/ChangeLog:

PR c++/88115
* g++.dg/cpp0x/alignof6.C: New test.

3 years agoc++: Tweak tsubst_qualified_id location.
Marek Polacek [Tue, 10 Nov 2020 21:39:19 +0000 (16:39 -0500)]
c++: Tweak tsubst_qualified_id location.

Retain the location when tsubstituting a qualified-id so that our
static_assert diagnostic can benefit.  Don't create useless location
wrappers for temporary variables.

gcc/ChangeLog:

PR c++/97518
* tree.c (maybe_wrap_with_location): Don't add a location
wrapper around an artificial and ignored decl.

gcc/cp/ChangeLog:

PR c++/97518
* pt.c (tsubst_qualified_id): Use EXPR_LOCATION of the qualified-id.
Use it to maybe_wrap_with_location the final expression.

gcc/testsuite/ChangeLog:

PR c++/97518
* g++.dg/diagnostic/static_assert3.C: New test.

3 years agoFix PRE NEW_SETS guarding
Richard Biener [Wed, 11 Nov 2020 17:15:57 +0000 (18:15 +0100)]
Fix PRE NEW_SETS guarding

Accesses to NEW_SETS should be properly guarded.  Committed
as obvious.

2020-11-11  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97623
* tree-ssa-pre.c (create_expression_by_pieces): Guard
NEW_SETS access.
(insert_into_preds_of_block): Likewise.

3 years agolibstdc++: Exclude cygwin and mingw from linker relro support
Jonathan Yong [Wed, 11 Nov 2020 15:21:26 +0000 (15:21 +0000)]
libstdc++: Exclude cygwin and mingw from linker relro support

PE format does not have ELF style relro linker support, exclude
from checking. If the host linker supports ELF format, configure
may get confused.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Exclude
cygwin and mingw from relro linker test.
* configure: Regenerate.

3 years agoFix PRE topological expression set sorting
Richard Biener [Wed, 11 Nov 2020 15:09:17 +0000 (16:09 +0100)]
Fix PRE topological expression set sorting

This fixes sorted_array_from_bitmap_set to do a topological sort
as required by re-using what PHI-translation does, namely a DFS
walk with the help of bitmap_find_leader.  The proper result
is verified by extra checking in clean () (which would have tripped
before) and for the testcase I'm working at during the last
patches (PR97623) it is neutral in compile-time cost.

2020-11-11  Richard Biener  <rguenther@suse.de>

* tree-ssa-pre.c (pre_expr_DFS): New function.
(sorted_array_from_bitmap_set): Use it to properly
topologically sort the expression set.
(clean): Verify we've cleaned everything we should.

3 years agotestsuite: Fix up scan-tree-dump-times regexps for 64-bit targets
Jakub Jelinek [Wed, 11 Nov 2020 15:11:17 +0000 (16:11 +0100)]
testsuite: Fix up scan-tree-dump-times regexps for 64-bit targets

The added (?:_ull) match on 32-bit targets, but are equivalent to just
adding _ull into the strings, i.e. require the _ull substrings, while
the intent is that they are optional, so we should use (?:_ull)? instead.

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

* gfortran.dg/gomp/workshare-reduction-3.f90: Use (?:_ull)? instead
of (?:_ull) in the scan-tree-dump-times directives.
* gfortran.dg/gomp/workshare-reduction-26.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-27.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-28.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-36.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-37.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-38.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-39.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-40.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-41.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-42.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-43.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-44.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-45.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-46.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-47.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-56.f90: Likewise.
* gfortran.dg/gomp/workshare-reduction-57.f90: Likewise.