Commit Graph

181196 Commits

Author SHA1 Message Date
Jozef Lawrynowicz c746fc40f4 MSP430: Fix inconsistent naming of hwmult libfuncs
The naming scheme used by GCC to reference MSP430 hardware multiply
library functions is inconsistent.

Sometimes the "GCC" names (e.g. mulsi2) are used, other times the
"MSPABI" names (e.g. __mspabi_mpyl) are used.

Also, sometimes an identifier for the hardware multiply support is
appended to the GCC name, when the functions are defined, but this is
not required.

This patch fixes those issues, so the names used to refer to the
hardware multiply library functions follow a consistent pattern.

gcc/ChangeLog:

	* config/msp430/msp430.c (msp430_output_labelref): Don't process mspabi
	hwmult library function names into GCC-style names.

libgcc/ChangeLog:

	* config/msp430/lib2hw_mul.S: Omit _hw* suffix from GCC names for
	hwmult library functions.

gcc/testsuite/ChangeLog:

	* gcc.target/msp430/rtx-cost-Os-f5series.c: Adjust test to use new
	hwmult library function name.
2020-11-15 21:04:56 +00:00
Jozef Lawrynowicz 814949ddce MSP430: Define function to check 16-bit hwmult support
gcc/ChangeLog:

	* config/msp430/msp430.c (msp430_use_16bit_hwmult): New.
	(use_32bit_hwmult): Rename to..
	(msp430_use_32bit_hwmult): ..this.
	(msp430_muldiv_costs): Use msp430_use_16bit_hwmult and
	msp430_use_32bit_hwmult.
	(msp430_expand_helper): Use msp430_use_16bit_hwmult and
	msp430_use_32bit_hwmult.
	(msp430_output_labelref): Use msp430_use_32bit_hwmult.
2020-11-15 21:04:54 +00:00
David Edelsohn 9243f0fba6 testsuite: fix ipa/modref-2.c on ilp32
ipa/modref-2.c output for Parm 1 depends on the word size.  This patch
updates the testcase to expect the appropriate result for ilp32 and lp64.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/modref-2.c: Add ilp32 expected result.
2020-11-15 15:04:32 -05:00
David Edelsohn 6403e02510 testsuite: Update scanning symbol sections to support AIX.
gcc/testsuite:

	* lib/scanasm.exp (parse_section_of_symbols): Also look for AIX
	XCOFF CSECT notation.
	* g++.dg/opt/const4.C: Also look for AIX XCOFF "[RO]".
	* gcc.dg/20021029-1.c: Likewise.
	* gcc.dg/array-quals-1.c: Likewise and "[RW]".
	* g++.dg/gomp/tls-5.C: Also look for AIX XCOFF "[TL]".
	* gcc.dg/pr25376.c: Accept AIX decoration around named section
	and function descriptor.
2020-11-15 14:39:21 -05:00
Maciej W. Rozycki 8b3be949a5 VAX: Use `rtx_code' to hold the RTL expression code in `vax_rtx_costs'
Use `enum rtx_code' rather than `int' to hold the the RTL expression
code in `vax_rtx_costs', matching the type these codes have been defined
with and making debugging just a tiny little bit easier.

	gcc/
	* config/vax/vax.c (vax_rtx_costs): Use `rtx_code' rather than
	`int' for `code'.
2020-11-15 17:41:52 +00:00
Maciej W. Rozycki 9ba5e92690 VAX/testsuite: Fix compilation options for `bswapdi-1.c'
Correct a regression in `vax-netbsdelf' gcc testing:

.../gcc/testsuite/gcc.target/vax/bswapdi-1.c: In function '__bswapdi2':
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:5:19: error: use of C99 long long integer constant [-Wlong-long]
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:6:14: error: use of C99 long long integer constant [-Wlong-long]
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:7:14: error: use of C99 long long integer constant [-Wlong-long]
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:8:14: error: use of C99 long long integer constant [-Wlong-long]
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:9:14: error: use of C99 long long integer constant [-Wlong-long]
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:10:14: error: use of C99 long long integer constant [-Wlong-long]
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:11:14: error: use of C99 long long integer constant [-Wlong-long]
.../gcc/testsuite/gcc.target/vax/bswapdi-1.c:12:14: error: use of C99 long long integer constant [-Wlong-long]
compiler exited with status 1
FAIL: gcc.target/vax/bswapdi-1.c (test for excess errors)

which is due to the defaults from `vax.exp':

# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
}

Use an empty override then as the options used do not matter for the
objective of this test case.

	gcc/testsuite/
	* gcc.target/vax/bswapdi-1.c (dg-options): New setting.
2020-11-15 17:41:52 +00:00
Maciej W. Rozycki 075fdf8524 VAX: Fix a typo in NO_EXTERNAL_INDIRECT_ADDRESS
Fix a typo in a NO_EXTERNAL_INDIRECT_ADDRESS macro check around an
assertion verifying DImode addition operands to be valid for PIC.

	gcc/
	* config/vax/vax.c (vax_output_int_add) <E_DImode>: Fix a typo
	in NO_EXTERNAL_INDIRECT_ADDRESS.
2020-11-15 17:41:52 +00:00
Maciej W. Rozycki c454324bff VAX: Correct a typo in PIC symbolic addition operand checks
Fix a typo and check both SImode addition operands for being incorrectly
symbolic in PIC mode before issuing a diagnostic dump of the offending
RTL expression.

	gcc/
	* config/vax/vax.c (vax_output_int_add) <E_SImode>: Also check
	`operands[2]' for being symbolic with PIC rather than checking
	`operands[1]' twice.
2020-11-15 17:41:52 +00:00
Jason Merrill baf38d2e36 c++: Check abstract type only on object creation. [PR86252]
Abstract checking has been problematic for a while; when I implemented an
earlier issue resolution to do more checking it led to undesirable
instantiations, and so backed some of it out.  During the C++20 process we
decided with P0929R2 that we should go the other way, and only check
abstractness when we're actually creating an object, not when merely forming
an array or function type.  This means that we can remove the machinery for
checking whether a newly complete class makes some earlier declaration
ill-formed.  This change was moved as a DR, so I'm applying it to all
standard levels.  This could be reconsidered if it causes problems, but I
don't expect it to.

The change to the libstdc++ result_of test brings the expected behavior in
line with that for incomplete types, but as in PR97841 I think the libstdc++
handling of incomplete types in this and other type_traits is itself wrong,
so I expect these lines and others to change again before long.

gcc/cp/ChangeLog:

	* decl.c (cp_finish_decl): Only check abstractness on definition.
	(require_complete_types_for_parms): Check abstractness here.
	(create_array_type_for_decl): Not here.
	(grokdeclarator, grokparms, complete_vars): Not here.
	* pt.c (tsubst, tsubst_arg_types, tsubst_function_type): Not here.
	* typeck2.c (struct pending_abstract_type): Remove.
	(struct abstract_type_hasher): Remove.
	(abstract_pending_vars, complete_type_check_abstract): Remove.
	(abstract_virtuals_error_sfinae): Handle arrays.
	* call.c (conv_is_prvalue): Split out from...
	(conv_binds_ref_to_prvalue): ...here.
	(implicit_conversion_1): Rename from implicit_conversion.
	(implicit_conversion): An abstract prvalue is bad.
	(convert_like_internal): Don't complain if expr is already
	error_mark_node.

gcc/testsuite/ChangeLog:

	* g++.dg/other/abstract1.C: Adjust.
	* g++.dg/other/abstract2.C: Adjust.
	* g++.dg/other/abstract4.C: Adjust.
	* g++.dg/other/abstract5.C: Adjust.
	* g++.dg/other/abstract8.C: New test.
	* g++.dg/template/sfinae-dr657.C: Adjust.
	* g++.old-deja/g++.other/decl3.C: Adjust.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/result_of/sfinae_friendly_1.cc: Adjust.
2020-11-15 12:07:13 -05:00
Aldy Hernandez 82b6d25d28 Remove duplicate vr_values::extract_range_builtin code.
Now that we know the vr_values and ranger versions are in sync, it is
safe to remove the vr_values version and just call the ranger one.

I am leaving the UBSAN bits in place since they make use of
relationals which are still not implemented in the ranger.

gcc/ChangeLog:

	* vr-values.c (vr_values::extract_range_builtin): Rename to...
	(vr_values::extract_range_from_ubsan_builtin): ...this.
	Remove everything but UBSAN code.
	(vr_values::extract_range_basic): Call ranger version for
	everything except UBSAN built-ins.
	* vr-values.h (class vr_values): Rename extract_range_builtin to
	extract_range_from_ubsan_builtin.
2020-11-15 17:57:08 +01:00
Vladimir N. Makarov 253c415a1a Do not put reload insns in the last empty BB.
gcc/
	* lra.c (lra_process_new_insns): Don't put reload insns in the
	last empty BB.
2020-11-15 11:30:50 -05:00
Jan Hubicka 26285af40f Mare return to clear EAF_UNUSED flag.
gcc/ChangeLog:
	* ipa-modref.c (analyze_ssa_name_flags): Make return to clear
	EAF_UNUSED flag.

gcc/testsuite/ChangeLog:
	* gcc.c-torture/execute/pr97836.c: New test.
2020-11-15 15:10:22 +01:00
GCC Administrator faab61b585 Daily bump. 2020-11-15 00:16:26 +00:00
Iain Sandoe 406b452dc0 testsuite, Objective-C : Amend PR23214 for Darwin11.
The test needs to use Object rather than NSObject on this and earlier
OS versions. Although the PR reports against the GNU runtime, we run
this on NeXT as well.

gcc/testsuite/ChangeLog:

	* objc.dg/pr23214.m: Use Object as the root object before
	Darwin12 (and NSObject after).
2020-11-14 21:20:46 +00:00
Jan Hubicka b1cd56a43d Escape parameters in gcc.dg/torture/pta-ptrarith-1.c
* gcc.dg/torture/pta-ptrarith-1.c: Escape parameters.
2020-11-14 13:53:55 +01:00
Jan Hubicka 520d5ad337 Detect EAF flags in ipa-modref
A minimal patch for the EAF flags discovery.  It works only in local ipa-modref
and gives up on cyclic SSA graphs.  It improves pt_solution_includes
disambiguations twice.

gcc/Changelog:

	* gimple.c: Include ipa-modref-tree.h and ipa-modref.h.
	(gimple_call_arg_flags): Use modref to determine flags.
	* ipa-modref.c: Include gimple-ssa.h, tree-phinodes.h,
	tree-ssa-operands.h, stringpool.h and tree-ssanames.h.
	(analyze_ssa_name_flags): Declare.
	(modref_summary::useful_p): Summary is also useful if arg flags are
	known.
	(dump_eaf_flags): New function.
	(modref_summary::dump): Use it.
	(get_modref_function_summary): Be read for current_function_decl
	being NULL.
	(memory_access_to): New function.
	(deref_flags): New function.
	(call_lhs_flags): New function.
	(analyze_parms): New function.
	(analyze_function): Use it.
	* ipa-modref.h (struct modref_summary): Add arg_flags.
	* doc/invoke.texi (ipa-modref-max-depth): Document.
	* params.opt (ipa-modref-max-depth): New param.
2020-11-14 13:52:36 +01:00
Jakub Jelinek 2873c8af66 dwarf2: Emit DW_TAG_unspecified_parameters even in late DWARF [PR97599]
Aldy's PR71855 fix avoided emitting multiple redundant
DW_TAG_unspecified_parameters sub-DIEs of a single DIE by restricting
it to early dwarf only.  That unfortunately means if we need to emit
another DIE for the function (whether it is for LTO, or e.g. because of
IPA cloning), we don't emit DW_TAG_unspecified_parameters, it remains
solely in the DW_AT_abstract_origin's referenced DIE.
But DWARF consumers don't really use DW_TAG_unspecified_parameters
from there, like we duplicate DW_TAG_formal_parameter sub-DIEs even in the
clones because either they have some more specific location, or e.g.
a function clone could have fewer or different argument types etc.,
they need to assume that originally stdarg function isn't later stdarg etc.
Unfortunately, while for DW_TAG_formal_parameter sub-DIEs, we can use the
hash tabs to look the PARM_DECLs if we already have the DIEs, for
DW_TAG_unspecified_parameters we don't have an easy way to look it up.

The following patch handles it by trying to figure out if we are creating a
fresh new DIE (in that case we add DW_TAG_unspecified_parameters if it is
stdarg), or if gen_subprogram_die is called again on an pre-existing DIE
to fill in some further details (then it will not touch it).

Except for lto, subr_die != old_die would be good enough, but unfortunately
for LTO the new DIE that will refer to early dwarf created DIE is created
on the fly during lookup_decl_die.  So the patch tracks if the DIE has
no children before any children are added to it.

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

	PR debug/97599
	* dwarf2out.c (gen_subprogram_die): Call
	gen_unspecified_parameters_die even if not early dwarf, but only
	if subr_die is a newly created DIE.
2020-11-14 09:14:19 +01:00
Matthew Glazar 8270a7238b Simplify testing symbol sections
gcc/testsuite

	* lib/scanasm.exp (dg-scan): Extract file globbing code ...
	(dg_glob_remote): ... into this new procedure.
	(scan-assembler-symbol-section): Define.
	(scan-symbol-section): Define.
	* g++.dg/gomp/tls-5.C: Add symbol section test.
	* g++.dg/opt/const4.C: Likewise.
	* gcc.dg/20021029-1.c: Likewise.
	* gcc.dg/array-quals-1.c: Likewise.
	* gcc.dg/darwin-sections.c: Likewise.
	* gcc.dg/pr25376.c: Likewise.
	* gcc.test-framework/test-framework.exp: Load scanasm and test .S files.
	* gcc.test-framework/dg-scan-symbol-section-1-exp-F.S: New test.
	* gcc.test-framework/dg-scan-symbol-section-2-exp-F.S: New test.
	* gcc.test-framework/dg-scan-symbol-section-3-exp-F.S: New test.
	* gcc.test-framework/dg-scan-symbol-section-exp-P.S: New test.
2020-11-14 00:02:02 -05:00
Monk Chiang 207de83922 PR target/97682 - Fix to reuse t1 register between call address and epilogue.
- When expanding the call pattern, choose t1 register be a jump register.
    Epilogue also uses a t1 register to adjust Stack point. The call pattern
    and epilogue will initial t1 twice, if both are generated in the same
    function. The call pattern will emit 'la t1,symbol' and 'jalr t1'instructions.
    Epilogue also emits 'li t1,4096' and 'addi sp,sp,t1' instructions.
    But li and addi instructions will be placed between la and jalr instructions.
    The la instruction will be removed by some optimizations,
    because t1 register define twice, the first define instruction look
    likes duplicate.

  - To resolve this issue, Prologue and Epilogue use the t0 register
    be a temporary register, the call pattern use the t1 register be
    a temporary register.

gcc/
2020-11-13  Monk Chiang  <monk.chiang@sifive.com>

	PR target/97682
	* config/riscv/riscv.h (RISCV_PROLOGUE_TEMP_REGNUM): Change register
	to t0.
	(RISCV_CALL_ADDRESS_TEMP_REGNUM): New Marco, define t1 register.
	(RISCV_CALL_ADDRESS_TEMP): Use it for call instructions.
	* config/riscv/riscv.c (riscv_legitimize_call_address): Use
	RISCV_CALL_ADDRESS_TEMP.
	(riscv_compute_frame_info): Change temporary register to t0 form t1.
	(riscv_trampoline_init): Adjust comment.

gcc/testsuite/
2020-11-13  Monk Chiang  <monk.chiang@sifive.com>

	PR target/97682
	* g++.target/riscv/pr97682.C: New test.
	* gcc.target/riscv/interrupt-3.c: Check register for t0.
	* gcc.target/riscv/interrupt-4.c: Likewise.
2020-11-13 20:04:26 -08:00
Jim Wilson dcf0dde488 Asan changes for RISC-V.
We have only riscv64 asan support, there is no riscv32 support as yet.  So I
need to be able to conditionally enable asan support for the riscv target.  I
implemented this by returning zero from the asan_shadow_offset function.  This
requires a change to toplev.c and docs in target.def.

	gcc/
	* config/riscv/riscv.c (riscv_asan_shadow_offset): New.
	(TARGET_ASAN_SHADOW_OFFSET): New.
	* doc/tm.texi: Regenerated.
	* target.def (asan_shadow_offset); Mention that it can return zero.
	* toplev.c (process_options): Check for and handle zero return from
	targetm.asan_shadow_offset call.

Co-Authored-By: cooper.joshua <cooper.joshua@linux.alibaba.com>
2020-11-13 18:12:35 -08:00
Jakub Jelinek a4dd85e015 openmp: Add support for non-VLA {,first}private allocate on omp task
This patch adds support for custom allocators on private/firstprivate
clauses for task (and taskloop) constructs.  Private didn't need anything
special, but firstprivate if it is passed by reference needs the GOMP_alloc
calls in the copyfn and GOMP_free in the task body.

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

	* gimplify.c (gimplify_omp_for): Add OMP_CLAUSE_ALLOCATE_ALLOCATOR
	decls as firstprivate on task clauses even when allocate clause
	decl is not lastprivate.
	* omp-low.c (install_var_field): Don't dereference omp_is_reference
	types if mask is 33 rather than 1.
	(scan_sharing_clauses): Populate allocate_map even for task
	constructs.  For now remove it back for variables mentioned in
	reduction and in_reduction clauses on task/taskloop constructs
	or on VLA task firstprivates.  For firstprivate on task construct,
	install the var field into field_map with by_ref and 33 instead
	of false and 1 if mentioned in allocate clause.
	(lower_private_allocate): Set TREE_THIS_NOTRAP on the created
	MEM_REF.
	(lower_rec_input_clauses): Handle allocate for task firstprivatized
	non-VLA variables.
	(create_task_copyfn): Likewise.

	* testsuite/libgomp.c-c++-common/allocate-1.c (struct S): New type.
	(foo): Add tests for non-VLA private and firstprivate clauses on
	omp task.
	(bar): Likewise.  Remove taking of address from private/firstprivate
	variables.
	* testsuite/libgomp.c++/allocate-1.C (struct S): New type.
	(foo): Add p, q, px and s arguments.  Add tests for array reductions
	and for non-VLA private and firstprivate clauses on omp task.
	(bar): Removed.
	(main): Adjust foo caller.  Don't call bar.
2020-11-14 01:46:16 +01:00
GCC Administrator 77f67db2a4 Daily bump. 2020-11-14 00:16:38 +00:00
Jonathan Wakely 4d039cb9a1 libstdc++: Use custom timespec in system calls [PR 93421]
On 32-bit targets where userspace has switched to 64-bit time_t, we
cannot pass struct timespec to SYS_futex or SYS_clock_gettime, because
the userspace definition of struct timespec will not match what the
kernel expects.

We use the existence of the SYS_futex_time64 or SYS_clock_gettime_time64
macros to imply that userspace *might* have switched to the new timespec
definition.  This is a conservative assumption. It's possible that the
new syscall numbers are defined in the libc headers but that timespec
hasn't been updated yet (as is the case for glibc currently). But using
the alternative struct with two longs is still OK, it's just redundant
if userspace timespec still uses a 32-bit time_t.

We also check that SYS_futex_time64 != SYS_futex so that we don't try
to use a 32-bit tv_sec on modern targets that only support the 64-bit
system calls and define the old macro to the same value as the new one.

We could possibly check #ifdef __USE_TIME_BITS64 to see whether
userspace has actually been updated, but it's not clear if user code
is meant to inspect that or if it's only for libc internal use.

libstdc++-v3/ChangeLog:

	PR libstdc++/93421
	* src/c++11/chrono.cc [_GLIBCXX_USE_CLOCK_GETTIME_SYSCALL]
	(syscall_timespec): Define a type suitable for SYS_clock_gettime
	calls.
	(system_clock::now(), steady_clock::now()): Use syscall_timespec
	instead of timespec.
	* src/c++11/futex.cc (syscall_timespec): Define a type suitable
	for SYS_futex and SYS_clock_gettime calls.
	(relative_timespec): Use syscall_timespec instead of timespec.
	(__atomic_futex_unsigned_base::_M_futex_wait_until): Likewise.
	(__atomic_futex_unsigned_base::_M_futex_wait_until_steady):
	Likewise.
2020-11-13 23:08:35 +00:00
Jonathan Wakely b8d36dcc91 libstdc++: Remove redundant overflow check for futex timeout [PR 93456]
The relative_timespec function already checks for the case where the
specified timeout is in the past, so the difference can never be
negative. That means we dn't need to check if it's more negative than
the minimum time_t value.

libstdc++-v3/ChangeLog:

	PR libstdc++/93456
	* src/c++11/futex.cc (relative_timespec): Remove redundant check
	negative values.
	* testsuite/30_threads/future/members/wait_until_overflow.cc: Moved to...
	* testsuite/30_threads/future/members/93456.cc: ...here.
2020-11-13 23:08:34 +00:00
Joseph Myers e400a64936 c: C2x binary constants
C2x adds binary integer constants (approved at the last WG14 meeting,
though not yet added to the working draft in git).  Configure libcpp
to consider these a standard feature in C2x mode, with appropriate
updates to diagnostics including support for diagnosing them with
-std=c2x -Wc11-c2x-compat.

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

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

	* gcc.dg/binary-constants-2.c, gcc.dg/binary-constants-3.c,
	gcc.dg/system-binary-constants-1.c: Update expected diagnostics.
	* gcc.dg/c11-binary-constants-1.c,
	gcc.dg/c11-binary-constants-2.c, gcc.dg/c2x-binary-constants-1.c,
	gcc.dg/c2x-binary-constants-2.c, gcc.dg/c2x-binary-constants-3.c:
	New tests.

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

	* expr.c (cpp_classify_number): Update diagnostic for binary
	constants for C.  Also diagnose binary constants for
	-Wc11-c2x-compat.
	* init.c (lang_defaults): Enable binary constants for GNUC2X and
	STDC2X.
2020-11-13 22:45:22 +00:00
Jan Hubicka f3dc991fba Revert accidental commit
* tree-ssa-alias.c (ao_ref_base_alias_ptr_type): Remove accidental
	commit.
	(ao_ref_alias_ptr_type): Remove accidental commit.
2020-11-13 23:32:02 +01:00
Jakub Jelinek 5cd4f8901a 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.
2020-11-13 23:27:23 +01:00
Jakub Jelinek 1d9a8675d3 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".
2020-11-13 23:23:33 +01:00
Kwok Cheung Yeung ccd56db898 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.
2020-11-13 22:58:57 +01:00
Gergö Barany e898ce7997 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>
2020-11-13 22:58:57 +01:00
Thomas Schwinge bd78857554 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.
2020-11-13 22:58:57 +01:00
Thomas Schwinge 703e4f8649 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.
2020-11-13 22:58:57 +01:00
Gergö Barany d1ba078d9b 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>
2020-11-13 22:58:56 +01:00
Jason Merrill d4a3152d3f 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.
2020-11-13 16:34:06 -05:00
Jan Hubicka 1a90e99fa2 Fix modref insertion hook.
* ipa-modref.c (modref_summaries::insert,
	modref_summaries_lto::insert): Remove summary if ipa-modref is disabled.
2020-11-13 21:15:40 +01:00
Jan Hubicka 8fca8142bc Copied arguments are readonly
* attr-fnspec.h (attr_fnspec::arg_readonly_p): Accept '1'...'9'.
2020-11-13 21:14:37 +01:00
Jonathan Wakely 91004436da 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.
2020-11-13 19:11:07 +00:00
Peter Jones 500e7efee9 Clarify the documentation for the ms_abi fucntion attribute
gcc/

	* doc/extend.texi: Clarify the documentation for the ms_abi
	function attribute.
2020-11-13 12:08:48 -07:00
Andrew MacLeod fcbb6018ab 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.
2020-11-13 13:59:44 -05:00
Eduard-Mihai Burtescu 84096498a7 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.
2020-11-13 18:59:09 +00:00
Seija Kijin 16b00dc63f Make strstr.c in libiberty ANSI compliant
libiberty/

	* strstr.c (strstr): Make implementation ANSI/POSIX compliant.
2020-11-13 11:53:16 -07:00
Jason Merrill d50310408f 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.
2020-11-13 13:36:29 -05:00
Vladimir N. Makarov e3b3b59683 [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.
2020-11-13 13:01:51 -05:00
Jakub Jelinek 67100cb50e 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.
2020-11-13 18:57:06 +01:00
Martin Jambor 2e97d6443f 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.
2020-11-13 18:30:11 +01:00
Piotr H. Dabrowski 6f1ae1ecd3 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()
2020-11-13 12:28:33 -05:00
Jonathan Wakely e7e0eeeb6e 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.
2020-11-13 17:19:12 +00:00
Andrew MacLeod 0d1189b4e6 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
2020-11-13 11:43:38 -05:00
Martin Liska 2935ff7eb7 testsuite: move expected error location
gcc/testsuite/ChangeLog:

	PR testsuite/97788
	* g++.dg/ubsan/pr61272.C: Move expected error location.
2020-11-13 17:40:15 +01:00
Martin Liska a98ebdc50a libsanitizer: update LOCAL_PATCHES.
libsanitizer/ChangeLog:

	* LOCAL_PATCHES: Update to the latest commit.
2020-11-13 17:31:16 +01:00