Commit Graph

179957 Commits

Author SHA1 Message Date
Alexandre Oliva 2ad4120746 import elementary functions as intrinsics
Importing them as intrinsics enables GCC to treat them as builtins
whose behavior is known by GCC.

Specifically, if they aren't intrinsics, calls to Sin and Cos won't be
combined into sincos.

We still need to make Sin and Cos wrappers inline in user-exposed
interfaces to get users the benefit of this transformation.
That is forthcoming in a separate patch.


for  gcc/ada/ChangeLog

	* libgnat/a-numaux.ads: Make all imports Intrinsic.
	* libgnat/a-numaux__darwin.ads: Likewise.
	* libgnat/a-numaux__libc-x86.ads: Likewise.
	* libgnat/a-numaux__vxworks.ads: Likewise.
2020-10-11 20:27:27 -03:00
Clément Chigot 4eaf96c56c aix: remove libgomp and libatomic archives before creating FAT archives
AIX caches shared objects in archives with read-other permission.
libgomp and libatomic might be in use during the build or testing, which
may cause archiver operations on them to fail.  This patch adjusts the
Makefile fragments to delete the library archives before creating fresh
archives containing both the 32 bit and 64 bit shared objects.

libatomic/ChangeLog:

2020-10-11  Clement Chigot  <clement.chigot@atos.net>

	* config/t-aix: Delete and recreate libatomic before creating
	FAT library.

libgomp/ChangeLog:

2020-10-11  Clement Chigot  <clement.chigot@atos.net>

	* config/t-aix: Delete and recreate libgomp before creating
	FAT library.
2020-10-11 17:30:24 -04:00
Iain Sandoe 07c7498dc0 Objective-C, Darwin : Make protocols private extern and weak.
Newer linkers want protocols to be private-extern and weak.
This is conditional on the runtime version.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c
	(create_global_decl): Update to allow the caller to
	specify declaration or definition.
	(create_hidden_decl): Likewise.
	(next_runtime_abi_02_protocol_decl): Make the symbol
	weak and hidden for later OS runtime versions.
	(build_v2_protocol_list_address_table): Likewise.
2020-10-11 20:52:09 +01:00
Iain Sandoe dcd9800fcd libobjc, Darwin : Fix powerpc encoding regression.
This corrects a typo in the recipe for the special type alignment
rules that are used for 32bit powerpc Darwin platforms.

libobjc/ChangeLog:

	* encoding.c (_darwin_rs6000_special_round_type_align):
	Use DFMode in the emulation of the special round type.
2020-10-11 19:32:08 +01:00
Iain Sandoe 73699d921d Objective-C++ : Fix bitfield ivars.
This fixes a regression present from 8.x;  It used to be OK
to test for a DECL_INITIAL value to flag that an ivar was a
bitfield (the initial value was the width).  This still works
on C / Objective-C, but no longer on C++.  Replace the test
with DECL_C_BIT_FIELD() which is set for both C and C++.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c (objc_v2_build_ivar_ref): Test
	DECL_C_BIT_FIELD to detect that an ivar is a bitfield.
2020-10-11 17:19:57 +01:00
Iain Sandoe 04103ecbaa testsuite, Objective-c++ : Update diagnostic plugin test.
The @selector() and @protocol() operators produce var decls
these do not work with the example plugin.  Unfortunatetely,
unlike the ObjC front end, it is not so easy to construct a
substitute expression that works reliably.  Where it does not
work we xfail for now.

gcc/testsuite/ChangeLog:

	* obj-c++.dg/plugin/diagnostic-test-expressions-1.mm:
	Adjust testcase to include expressions for @selector and
	@protocol. XFAIL where this is still not sufficient to obtain
	a disgnostic range.
2020-10-11 17:13:35 +01:00
Iain Sandoe cc3014d80e testsuite, objective-c++ : Add a dummy retain/release to testuite object.
On newer systems, the throw/catch process sends retain and release
messages to thrown objects.  While these are not needed in the testsuite
cases, they cause the tests to fail because the selector is not handled.
Add dummy methods to the testsuite object.

gcc/testsuite/ChangeLog:

	* objc-obj-c++-shared/TestsuiteObject.h: Add dummy retain and
	release method declarations.
	* objc-obj-c++-shared/TestsuiteObject.m: Add dummy retain and
	release implementations.
2020-10-11 16:55:27 +01:00
Iain Sandoe fd36daf64a testsuite, objective-c++ : GC is not available from Darwin16.
Update the dg-skip to cover newer systems.

gcc/testsuite/ChangeLog:

	* obj-c++.dg/objc-gc-3.mm:i Skip for Darwin >= 16.
2020-10-11 16:53:43 +01:00
Clément Chigot 0b9a731127 aix: add FAT library support for libstdc++fs.a
Make libstdc++fs.a a 32/64 bit FAT library.

It is too complicated for the FAT library Makefile fragment to determine if
--enable-libstdcxx-filesystem-ts has been enabled.  This patch checks the
existence of libstdc++fs.a at build time and adds the complementary object
file if it was built.

libstdc++-v3/Changelog:

2020-10-11  Clement Chigot  <clement.chigot@atos.net>

	* config/os/aix/t-aix: Add complementary mode object file to
	libstdc++fs.a
2020-10-11 11:47:00 -04:00
Iain Sandoe 6b468b7556 testsuite, Objective-C++ : Skip an ancient test on newer systems.
This test contains elements incompatible with modern Objective-C
headers, it is only of relevance to Darwin8 or potentially on systems
with SDKs that could target Darwin8, so skip it on newer systems.

gcc/testsuite/ChangeLog:

	* obj-c++.dg/cxx-ivars-3.mm: Skip for macOS >= 10.7.
2020-10-11 16:31:53 +01:00
Iain Sandoe fa99b56c7f testsuite, Objective-c++ : Fix GNU API tests to work with NeXT where possible.
The version 2 GNU Objective C API is mostly compatible with the NeXT one.
However, there are a few testsuite tweaks needed (and one test fails for NeXT
without considerable increase in complexity).

gcc/testsuite/ChangeLog:

	* obj-c++.dg/gnu-api-2-class-meta.mm: Add a flag to cause NeXT
	headers to expose prototypes for messaging.
	* obj-c++.dg/gnu-api-2-class.mm: Likewise.
	* obj-c++.dg/gnu-api-2-objc.mm: Skip this because of the extra
	protocols pulled in by system headers.
2020-10-11 16:11:03 +01:00
Iain Sandoe 5505a9eab9 testsuite, Objective-C : Fix two plugin diagnostics tests for Darwin.
The @selector and @protocol keywords produce a var decl without
useful location information. The current diagnostics plugin does not
look at VAR_DECLs (and it would not be helpful if it did in this
case, since a single decl is shared across all the users).

However, ee can, in this case, make expressions that produce useful
information.

gcc/testsuite/ChangeLog:

	* objc.dg/plugin/diagnostic-test-expressions-1.m: Use assignment
	expressions for @selector and @protocol to obtain a useful
	diagnostic range.
2020-10-11 15:55:02 +01:00
Iain Sandoe b292746ff7 testsuite, Objective-C : Fix call-super-2.m for newer NeXT headers.
We were using a callout to runtime.h which, eventually brings in the system
runtime.h.  One newer versions of the Darwin/NeXT headers this declares the
objc_getClass() function as returning Class, rather than the internal
representation of that.  This breaks a fragile assumption in objc-act that
the use of these internal functions can be deduced by looking at the function
type.  Ultimately, the fragility should be fixed - but this fixes up the test
so that it only uses the compiler's forward declaration of the function.

gcc/testsuite/ChangeLog:

	* objc.dg/call-super-2.m: Remove inclusion of runtime.h.
	Add a FIXME about the test portability.
2020-10-11 15:42:23 +01:00
Iain Sandoe b1b7599ca5 testsuite, Objective-C : Update forward-1.m.
Newer versions of the runtime / NSObject don't respond to forward:.
This uses the replacement.

gcc/testsuite/ChangeLog:

	* objc.dg/torture/forward-1.m: Implement forwarding using the
	native NeXT (NSInvocation) method for Darwin.
2020-10-11 15:32:20 +01:00
Iain Sandoe 40330e7077 testsuite, Objective-C : Add initialize method to root class.
Older versions of the runtime don't like it when the root class
has a missing initialize method.  They try to forward to an non-
existent super class resulting in a crash.

TODO: maybe we can diagnose this.

gcc/testsuite/ChangeLog:

	* objc.dg/ivar-scope-4.m: Add inititialize method to the
	root class.
2020-10-11 15:18:02 +01:00
Iain Sandoe bae828f7bb testsuite, Objective-C : Adjust gnu-api tests for Darwin.
The GNU v2 API matches the next v2 API in most respects.

However, some of the tests depend on access to items that the
later NeXT headers consider to be 'internal implementation details'
and are not exposed (we arrange that with a DEFINE).

One test is skipped here because, although it works internally, the
number of objects returned is larger for the NeXT runtime in some
cases (where the headers have been updated to bring in more of the
system details).

gcc/testsuite/ChangeLog:

	* objc.dg/gnu-api-2-class-meta.m: Add a flag to cause NeXT
	headers to expose prototypes for messaging. Mark the root
	class if the objc_root_class attribute is available. Use
	char ** as the second arg to main.
	* objc.dg/gnu-api-2-class.m: Use dispatch prototype.
	* objc.dg/gnu-api-2-objc.m: Skip on NeXT because of extra
	prototypes pulled in by headers.
2020-10-11 14:57:35 +01:00
Iain Sandoe f2ac4fc035 testsuite, Objective-C : Update a test for newer OS versions.
Objective-C GC is not available for any recent Darwin version, nor
is it available for the upcoming release of Darwin20.

gcc/testsuite/ChangeLog:

	* objc.dg/objc-gc-4.m: Disable for macOS 10.15 and 11.x.
2020-10-11 14:43:56 +01:00
Iain Sandoe 67f984d62e testsuite, Objective-C : Compatibility fixes.
Changes to deal with warnings and/or errors seen when compiling the
tests with clang.

gcc/testsuite/ChangeLog:

	* objc-obj-c++-shared/TestsuiteObject.h: If the compiler
	supports objc_root_object attributes, then mark the testsuite
	object accordingly.
	* objc-obj-c++-shared/TestsuiteObject.m: Avoid direct access
	to isa, which is an error for modern Objective-C.
	* objc/execute/class-tests-1.h: Declare a string function we
	use locally (avoid pulling in the whole of string.h).
2020-10-11 14:28:53 +01:00
Iain Sandoe 8703bf5d31 Darwin, Objective-C : Adjust objective-c symbol linkage with version.
Earlier linkers cannot handle publicly-visible (or linker-visible)
metadata, so we need to make the output of these conditional on version.

gcc/ChangeLog:

	* config/darwin.c (darwin_globalize_label): Make a subset of
	metadate symbols global.
	(darwin_label_is_anonymous_local_objc_name): Make a subset of
	metadata symbols linker-visible.
	(darwin_override_options): Track more target OS versions, make
	the next_runtime version track this (unless it's set to 0 for
	GNU runtime).

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c (FIXUP_NEEDED): Rename ...
	(USE_FIXUP_BEFORE): ... to this.
	(next_runtime_02_initialize): Likewise.
	(next_runtime_abi_02_get_arg_type_list_base): Likewise.
	(next_runtime_abi_02_build_objc_method_call): Likewise.
2020-10-11 14:12:43 +01:00
Iain Sandoe 336fdc8ba8 Darwin, Objective-C : Update meta-data linkage.
Newer versions of ld64 require that some meta-data symbols are
global, and that a larger set are linker-visible.

gcc/ChangeLog:

	* config/darwin.c (darwin_globalize_label): Add protocol
	meta-data labels to the set that are global.
	(darwin_label_is_anonymous_local_objc_name): Arrange for meta-
	data start labels to be linker-visible.
2020-10-11 13:56:25 +01:00
Iain Sandoe 3ba0afac60 Objective-C, Darwin : Update message call codegen.
Platform compilers based on LLVM do not use the objc_sendMsg_fixit
and friends for newer editions of the OS (runtimes for Arm64 do not even
have those entries).

We need to arrange to allow for this codegen on modern Darwin.

The _fixit versions are needed for some OS versions (at least, up to
10.6) since the super2 call is not implemented there.  It does not
seem worth making the codegen more fine-grained at present.

Other parts of the codegen need to be made conditional on either the
runtime version or the linker capabilities.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c (TAG_MSGSENDSUPER): Revised
	spelling.
	(TAG_MSGSENDID): Likewise.
	(TAG_MSGSENDSUPER_STRET): Likewise.
	(TAG_MSGSENDID_STRET): Likewise.
	(FIXUP_NEEDED): Likewise.
	(TAG_FIXUP): New.
	(next_runtime_02_initialize): Adjust message calls to use
	fixup variants only when required.
	(next_runtime_abi_02_get_arg_type_list_base): Correct
	indent.
	(build_v2_build_objc_method_call): New.
	(build_v2_objc_method_fixup_call): Split out from ...
	(next_runtime_abi_02_build_objc_method_call): ... here.
	Arrange to adjust the call on the basis of the target
	runtime.
2020-10-11 13:38:29 +01:00
Iain Sandoe 75d4d7bc69 Objective-C, Darwin : Revise the runtime selection options.
For the NeXT/Darwin runtime as installed on macOS, we now
need to deal with changes in ABI and APIs over the range
of system versions supported.

For the first phase of these changes, we will make the
existing flag_next_runtime carry a value that represents
the target OS version.  It might be necessary to extend the
value to represent the ABI ('fragile', V1/V2) or the linker
capabilities (some changes to the linker-visible and public
symbols are dependent on linker version).

TODO: arrange to set the default NEXT_OBJC_RUNTIME on the
basis of the configured target version.

gcc/ChangeLog:

	* config/darwin.c (darwin_objc2_section): Allow for
	values > 1 to represent the next runtime.
	(darwin_objc1_section): Likewise.
	* config/darwin.h (NEXT_OBJC_RUNTIME): Set the default
	next runtime value to be 10.5.8.
2020-10-11 12:58:29 +01:00
Iain Sandoe 1cc7476610 Objective-C++, Darwin : Make metadata 'extern "C"'.
For current system toolchains NeXT runtime metadata symbols are not
mangled for Objective-C++ (i.e. they are considered to be
'extern "C"').

This change becomes essential when we start to emit metadata refs
as hidden and weak which is required by later editions of the runtime
and linkers.

gcc/objc/ChangeLog:

	* objc-runtime-shared-support.c (start_var_decl): Make the
	decl_assembler_name follow the metadata name for C++ on NeXT
	runtime platforms.
2020-10-11 11:52:44 +01:00
Iain Sandoe 1174b08b14 Ojective-C, Darwin : Adjust category superclass ref names (NFC).
Make the order of the class and superclass match the metadata
order from clang.  Makes it easier to compare produced meta-
data between implementations.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c
	(next_runtime_abi_02_category_decl): Adjust category
	superclass name ordering.
2020-10-11 11:33:25 +01:00
Iain Sandoe 6224a8aa1b Objective-C, Darwin : Update protocol metadata to current version.
Later versions of the NeXT runtime protocol metadata contain additional
fields.  This patch adds these fields and populates a new list of
method types.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c (build_v2_super_template): Add new
	fields to the template.
	(build_v2_protocol_template): Build new field entries.
	(generate_v2_meth_descriptor_table): Adjust to allow recording all
	method types.
	(generate_v2_meth_type_list): New.
	(build_v2_protocol_initializer): Initialize the additional fields.
	(generate_v2_protocols): Record method types for all entries and
	generate the additional method type table.
2020-10-11 10:56:03 +01:00
GCC Administrator aab566a4fb Daily bump. 2020-10-11 00:16:25 +00:00
Jan Hubicka 2f61125f6f Fix parameter map computation in ipa-modref
* ipa-modref.c (modref_transform): Fix parameter map computation.
2020-10-11 00:07:11 +02:00
Tom de Vries e88b04bda8 [nvptx] Replace dots in function names
When function splitting clones a function sinf in the host compiler, the clone
is callled sinf.part.0.  However, ptx does not allows dots in identifiers, so
we run into:
...
ptxas test.o, line 23; fatal   : Parsing error near '.part': syntax error
ptxas fatal   : Ptx assembly aborted due to errors
nvptx-as: ptxas returned 255 exit status
...

Rename such functions by replacing the dots with dollar signs.

Tested check-gcc on nvptx.

Tested libgomp on x86_64-linux with nvptx accelerator.

gcc/ChangeLog:

2020-10-10  Tom de Vries  <tdevries@suse.de>

	PR target/97318
	* config/nvptx/nvptx.c (nvptx_replace_dot): New function.
	(write_fn_proto, write_fn_proto_from_insn, nvptx_output_call_insn):
	Use nvptx_replace_dot.
2020-10-10 23:34:24 +02:00
Tom de Vries db52bcfe4a [nvptx] Factor out write_fn_proto_1
Factor out write_fn_proto_1 from write_fn_proto.

Tested check-gcc on nvptx.

Tested libgomp on x86_64-linux with nvptx accelerator.

gcc/ChangeLog:

2020-10-10  Tom de Vries  <tdevries@suse.de>

	* config/nvptx/nvptx.c (write_fn_proto_1): New function, factored out
	of ...
	(write_fn_proto): ... here.  Return void.
2020-10-10 23:34:24 +02:00
Jonathan Wakely 2137aa9241 libstdc++: Replace use of reserved name that clashes [PR 97362]
The name __deref is defined as a macro by Windows headers.

This renames the __deref() helper function to __ref. It doesn't actually
dereference an iterator. it just has the same type as the iterator's
reference type.

libstdc++-v3/ChangeLog:

	PR libstdc++/97362
	* doc/html/manual/source_code_style.html: Regenerate.
	* doc/xml/manual/appendix_contributing.xml: Add __deref to
	BADNAMES.
	* include/debug/functions.h (_Irreflexive_checker::__deref):
	Rename to __ref.
	* testsuite/17_intro/badnames.cc: Check __deref.
2020-10-10 21:22:12 +01:00
Jan Hubicka 988f0466e8 Fix ICE in remap_arguments with removed parameters.
* ipa-modref.c (remap_arguments): Check range in map access.
2020-10-10 22:16:59 +02:00
Jan Hubicka 5d2cedaaa3 Fix modref_transform ICE with more than 32 parameters.
* ipa-modref.c (modref_transform): Use reserve instead of safe_grow.
2020-10-10 22:01:17 +02:00
Jan Hubicka 6a6c85f4e1 Fix ipa-modref ICE with not allocated summaries.
* ipa-modref.c (modref_transform): Check that summaries are allocated.
2020-10-10 21:22:52 +02:00
Jan Hubicka c8fd2be174 Fix modref handling of parameter adjustments and jump functions.
* ipa-modref-tree.h (struct modref_tree): Revert prevoius change.
	* ipa-modref.c (analyze_function): Dump original summary.
	(modref_read): Only set IPA if streaming summary (not optimization
	summary).
	(remap_arguments): New function.
	(modref_transform): New function.
	(compute_parm_map): Fix offset calculation.
	(ipa_merge_modref_summary_after_inlining): Do not merge stores when
	they can be ignored.
2020-10-10 20:55:37 +02:00
Jan Hubicka f1f1008c7c Improve tree-ssa-alias dump files.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Improve debug dumps.
	(call_may_clobber_ref_p_1): Improve debug dumps.
2020-10-10 19:36:03 +02:00
Iain Sandoe c28d91bf23 Objective-C, Darwin : Pick up super refs directly.
The current code assumed that super refs could be computed
indirectly, i.e. that the metadata generated by the compiler
was immutable by the runtime. This does not always hold
(it depends on the NeXT runtime version).  So, compute super
refs directly.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c
	(objc_get_superclass_ref_decl): Split this code out.
	(next_runtime_abi_02_get_class_super_ref): Compute
	super refs using the objc_get_superclass_ref_decl().
	(next_runtime_abi_02_get_category_super_ref): Likewise.
2020-10-10 17:28:04 +01:00
Iain Sandoe bb675539ba Darwin : Only emit Objective-C section switches for older linkers.
At one time, the system linkers needed to have at least a dummy
entry for every Objective-C section in use.  This removes the extra
emitted code when it is not needed by the linker.

gcc/ChangeLog:

	* config/darwin.c (output_objc_section_asm_op): Avoid extra
	objective-c section switches unless the linker needs them.
2020-10-10 17:23:10 +01:00
Iain Sandoe ecd616f680 Objective-C, Darwin : Update metadata section uses.
Newer versions of ld64 are more picky about adherence to placement
rules for objective c metadata.  This adds protocol refs and uses
the ivar refs for all targets.

gcc/ChangeLog:

	* config/darwin-sections.def (objc2_data_section): New.
	(objc2_ivar_section): New.
	* config/darwin.c (darwin_objc2_section): Act on Protocol and
	ivar refs.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c
	(next_runtime_abi_02_init_metadata_attributes): Make protocol
	refs a distinct section.
2020-10-10 17:13:21 +01:00
Iain Sandoe a788c4555c Objective-C, Darwin : Use special string sections for V2 NeXT runtime.
Newer versions of the runtime expect to find strings for class, method
and method types in set-aside sections rather than the general c_strings
one.

gcc/ChangeLog:

	* config/darwin-sections.def (objc2_class_names_section,
	objc2_method_names_section, objc2_method_types_section): New
	* config/darwin.c (output_objc_section_asm_op): Output new
	sections.  (darwin_objc2_section): Select new sections where
	used.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c
	(next_runtime_abi_02_init_metadata_attributes): Attach metadata
	for the special string sections to class, method and method type
	string sections.
2020-10-10 17:04:45 +01:00
Iain Sandoe 900c0ca226 Objective-C: Addess a FIXME (NFC).
This removes references to the next runtime from the gnu runtime
implementation.

gcc/objc/ChangeLog:

	* objc-gnu-runtime-abi-01.c
	(build_shared_structure_initializer): Remove references to
	the NeXT runtime.
	(generate_static_references): Likewise.
2020-10-10 16:55:57 +01:00
Iain Sandoe dcf59c5c01 Darwin : Begin rework of zero-fill sections.
Much of the existing work in the Darwin BSS and common sections
was to accommodate the PowerPC section anchors.  We want to segregate
this, since it might become desirable to support section anchors for
arm64.

First revision (here) is to use the same section conventions as the Xcode
toochains for BSS and COMMON.

We also drop the constraint about putting small items into data/static data
that was a work-around for Java issues (irrelevant for several editions).

gcc/ChangeLog:

	* config/darwin.c (darwin_emit_local_bss): Amend section names to
	match system tools. (darwin_output_aligned_bss): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.dg/darwin-sections.c: Adjust test for renamed BSS and common
	sections.  Cater for 64 and 128 bit long doubles.
2020-10-10 16:45:32 +01:00
H.J. Lu 16664e6e4f x86-64: Check CMPXCHG16B for x86-64-v[234]
x86-64-v2 includes CMPXCHG16B.  Since -mcx16 enables CMPXCHG16B and
defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16, check it in x86-64-v[234]
tests.

	PR target/97250
	* gcc.target/i386/x86-64-v2.c: Verify that
	__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 is defined.
	* gcc.target/i386/x86-64-v3.c: Likewise.
	* gcc.target/i386/x86-64-v4.c: Likewise.
2020-10-10 05:28:19 -07:00
Ville Voutilainen 02cbd79e47 libstdc++: Fix variant build on 32-bit targets [PR95904]
libstdc++-v3/ChangeLog:

	* include/std/variant (__check_visitor_result):
	Use size_t for indexes.
	(__check_visitor_results): Likewise.
2020-10-10 14:03:00 +03:00
Aldy Hernandez 14db1dfcd1 PR97359: Do not cache relops in GORI cache.
logical_stmt_cache::cacheable_p() returns true for relops, but
logical_combine (which does the caching) doesn't handle them and ICEs.
This patch fixes the inconsistency by returning false for relops.

This was working before because even though logical_combine doesn't
handle relops, statements with only one SSA are handled in cache_stmt,
which seems like the only statement we've ever encountered (even through
a full Fedora build).

	lhs = s_5 > 999;

However, with two SSA operands we ICE because logical_combine doesn't
handle them:

	lhs = s_5 > y_8;

We can either return false for relops in cacheable_p, or fix
logical_combine to handle them.  The original idea was to only cache
ANDs and ORs, so I've done the former to unbreak trunk.

We can decide later if there was ever any benefit in caching relops.

gcc/ChangeLog:

	PR tree-optimization/97359
	* gimple-range-gori.cc (logical_stmt_cache::cacheable_p): Only
	handle ANDs and ORs.
	(gori_compute_cache::cache_stmt): Adjust comment.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr97359.c: New test.
2020-10-10 10:26:30 +02:00
GCC Administrator c74a0e82fa Daily bump. 2020-10-10 00:16:26 +00:00
Ville Voutilainen 3427e31331 libstdc++: Diagnose visitors with different return types [PR95904]
libstdc++-v3/ChangeLog:

	PR libstdc++/95904
	* include/std/variant (__deduce_visit_result): Add a nested ::type.
	(__gen_vtable_impl</*base case*/>::_S_apply):
	Check the visitor return type.
	(__same_types): New.
	(__check_visitor_result): Likewise.
	(__check_visitor_results): Likewise.
	(visit(_Visitor&&, _Variants&&...)): Use __check_visitor_results
	in case we're visiting just one variant.
	* testsuite/20_util/variant/visit_neg.cc: Adjust.
2020-10-09 20:48:08 +03:00
Jonathan Wakely 3ee44d4c51 libstdc++: Fix incorrect results in std::seed_seq::generate [PR 97311]
This ensures that intermediate results are done in uint32_t values,
meeting the requirement for operations to be done modulo 2^32.

If the target doesn't define __UINT32_TYPE__ then substitute uint32_t
with a class type that uses uint_least32_t and masks the value to
UINT32_MAX.

I've also split the first loop that goes from k=0 to k<m into three
loops, for k=0, [1,s] and [s+1,m). This avoids branching for those three
cases in the body of the loop, and also avoids the concerns in PR 94823
regarding the k-1 index when k==0.

libstdc++-v3/ChangeLog:

	PR libstdc++/97311
	* include/bits/random.tcc (seed_seq::generate): Use uint32_t for
	calculations. Also split the first loop into three loops to
	avoid branching on k on every iteration, resolving PR 94823.
	* testsuite/26_numerics/random/seed_seq/97311.cc: New test.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-erro
	line number.
2020-10-09 16:58:32 +01:00
Vladimir N. Makarov bb37ad8cc0 Don't keep strict_low_part in reloads for non-registers. [PR97313]
gcc/ChangeLog:

2020-10-09  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/97313
	* lra-constraints.c (match_reload): Don't keep strict_low_part in
	reloads for non-registers.

gcc/testsuite/ChangeLog:

2020-10-09  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/97313
	* gcc.target/i386/pr97313.c: New.
2020-10-09 10:12:42 -04:00
Daniel Lemire 98c37d3bac libstdc++: Optimize uniform_int_distribution using Lemire's algorithm
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/uniform_int_dist.h (uniform_int_distribution::_S_nd):
	New member function implementing Lemire's "nearly divisionless"
	algorithm.
	(uniform_int_distribution::operator()): Use _S_nd when the range
	of the URBG is the full width of the result type.
2020-10-09 14:09:36 +01:00
Jonathan Wakely 6ce2cb116a libstdc++: Adjust variable export in makefile
We usually export variables in recipes this way. I'm not sure it's
necessary, but it's consistent.

libstdc++-v3/ChangeLog:

	* testsuite/Makefile.am: Set and export variable separately.
	* testsuite/Makefile.in: Regenerate.
2020-10-09 14:08:42 +01:00