Commit Graph

178298 Commits

Author SHA1 Message Date
Javier Miranda
d9206abba7 [Ada] Ada2020: AI12-0107 convention of By_Protected_Procedure
gcc/ada/

	* exp_attr.adb (Has_By_Protected_Procedure_Prefixed_View): New
	subprogram.
	(Expand_Access_To_Protected_Op): Adding support for prefixed
	class-wide view with By_Protected_Procedure convention.
	* sem_attr.adb (Get_Convention): New subprogram.
	(Get_Kind): Adapted to use Get_Convention.
	* sem_ch4.adb (Try_By_Protected_Procedure_Prefixed_View): New
	subprogram.
	(Analyze_Selected_Component): Invoke
	Try_By_Protected_Procedure_Prefixed_View.
	* sem_util.ads (Is_By_Protected_Procedure): New subprogram.
	* sem_util.adb (Is_By_Protected_Procedure): New subprogram.
2020-07-16 05:17:58 -04:00
Arnaud Charlet
e4a99831f4 [Ada] Overflow in string streaming
gcc/ada/

	* libgnat/s-ststop.ads: Fix typo.
	* libgnat/s-ststop.adb (Read, Write): Fix block number
	computation to avoid overflows in case of large strings.
2020-07-16 05:17:57 -04:00
Arnaud Charlet
0f6898f9d8 [Ada] Add centralized capacity check in Generic_Bignums
gcc/ada/

	* libgnat/s-genbig.adb ("**"): Remove capacity limit check.
	Improve code by using an extended return.
	(Normalize): Perform capacity limit check here instead which is
	the centralized place where (potentially large) big integers are
	allocated.
2020-07-16 05:17:56 -04:00
Gary Dismukes
7e06a62f5b [Ada] AI12-0042: Type invariant checking rules
gcc/ada/

	* exp_ch4.adb (Expand_N_Type_Conversion): Handle the case of
	applying an invariant check for a conversion to a class-wide
	type whose root type has a type invariant, when the conversion
	appears within the immediate scope of the type and the
	expression is of a specific tagged type.
	* sem_ch3.adb (Is_Private_Primitive): New function to determine
	whether a primitive subprogram is a private operation.
	(Check_Abstract_Overriding): Enforce the restriction imposed by
	AI12-0042 of requiring overriding of an inherited nonabstract
	private operation when the ancestor has a class-wide type
	invariant and the ancestor's private operation is visible.
	(Derive_Subprogram): Set Requires_Overriding on a subprogram
	inherited from a visible private operation of an ancestor to
	which a Type_Invariant'Class expression applies.
2020-07-16 05:17:55 -04:00
Rainer Orth
6805c1c6a6 libsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86
The latest Solaris 11.4/x86 update uncovered a libsanitizer bug that
caused one test to FAIL for 32-bit:

+FAIL: c-c++-common/asan/null-deref-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c -O2 -flto -flto-partition=none
output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -Os  output pattern test

I've identified the problem and the fix has just landed in upstream
llvm-project:

	https://reviews.llvm.org/D83664

Tested on i386-pc-solaris2.11 and x86_64-pc-linux.gnu.

	libsanitizer:
	* sanitizer_common/sanitizer_linux.cpp: Cherry-pick llvm-project
	revision f0e9b76c3500496f8f3ea7abe6f4bf801e3b41e7.
2020-07-16 10:38:48 +02:00
GCC Administrator
fe8185b509 Daily bump. 2020-07-16 00:16:34 +00:00
Uros Bizjak
6c2848ad02 i386: Introduce peephole2 to use flags from CMPXCHG more [PR96189]
CMPXCHG instruction sets ZF flag if the values in the destination operand
and EAX register are equal; otherwise the ZF flag is cleared and value
from destination operand is loaded to EAX. Following assembly:

        movl    %esi, %eax
        lock cmpxchgl   %edx, (%rdi)
        cmpl    %esi, %eax
        sete    %al

can be optimized by removing the unneeded comparison, since set ZF flag
signals that no update to EAX happened.

2020-15-07  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	PR target/95355
	* config/i386/sync.md
	(peephole2 to remove unneded compare after CMPXCHG): New pattern.

gcc/testsuite/ChangeLog:
	PR target/95355
	* gcc.target/i386/pr96189.c: New test.
2020-07-15 21:29:59 +02:00
Tobias Burnus
51542d9254 libgomp.fortran/alloc-1.F90: Fix testcase for 32bit size_t
libgomp/ChangeLog:

	* testsuite/libgomp.fortran/alloc-1.F90: Use c_size_t to
	avoid conversion on 32bit systems from 32bit to 64bit due
	to -fdefault-integer-8.
2020-07-15 17:23:04 +02:00
Jakub Jelinek
79c12969ec openmp: Fix up loop-21.c
I've missed
+FAIL: libgomp.c/loop-21.c execution test
during testing of the recent patch.  The problem is that while
for the number of iterations computation it doesn't matter if we compute
min_inner_iterations as (m2 * first + n2 + (adjusted step) + m1 * first + n1) / step
or (m2 * last + n2 + (adjusted step) + m1 * last + n1) / step provided that
in the second case we use as factor (m1 - m2) * ostep / step rather than
(m2 - m1) * ostep / step, for the logical to actual iterator values computation
it does matter and in my hand written C implementations of all the cases (outer
vs. inner loop with increasing vs. decreasing iterator) I'm using the same computation
and it worked well for all the pseudo-random iterators testing it was doing.

It also means min_inner_iterations is misnamed, because it is not really
minimum number of inner iterations, whether the first or last outer iteration
results in the smaller or larger value of this can be (sometimes) only
determined at runtime.
So this patch also renames it to first_inner_iterations.

2020-07-15  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/96198
	* omp-general.h (struct omp_for_data): Rename min_inner_iterations
	member to first_inner_iterations, adjust comment.
	* omp-general.c (omp_extract_for_data): Adjust for the above change.
	Always use n1first and n2first to compute it, rather than depending
	on single_nonrect_cond_code.  Similarly, always compute factor
	as (m2 - m1) * outer_step / inner_step rather than sometimes m1 - m2
	depending on single_nonrect_cond_code.
	* omp-expand.c (expand_omp_for_init_vars): Rename min_inner_iterations
	to first_inner_iterations and min_inner_iterationsd to
	first_inner_iterationsd.
2020-07-15 16:45:02 +02:00
Nathan Sidwell
765fbbf9bb c++: refactor some parser code
cp_parser_declaration copies tokens to local variables, before inspecting
(some of) their fields.  There's no need.  Just point at them in the token
buffer -- they don't move.  Also, we never look at the second token if the
first is EOF, so no need for some kind of dummy value in that case.

	gcc/cp/
	* parser.c (cp_parser_declaration): Avoid copying tokens.
	(cp_parser_block_declaration): RAII token pointer.
2020-07-15 07:41:30 -07:00
Piotr Trojanek
790b1f6415 [Ada] Cleanup code related to object overlays
gcc/ada/

	* sem_util.adb (Find_Overlaid_Entity): Fix style in comment.
	(Note_Possible_Modification): Simplify repeated calls to Ekind.
2020-07-15 09:43:01 -04:00
Eric Botcazou
c2ba82add6 [Ada] Cleanup in Convert_To_Positional after previous work
gcc/ada/

	* exp_aggr.adb (Flatten): Adjust description.
	(Convert_To_Positional): Remove obsolete ??? comment and use
	Compile_Time_Known_Value in the final test.
2020-07-15 09:43:01 -04:00
Arnaud Charlet
8092c19930 [Ada] Ongoing work for AI12-0212: container aggregates
gcc/ada/

	* par-ch4.adb (P_Iterated_Component_Association): Extended to
	recognzize the similar Iterated_Element_Association. This node
	is only generated when an explicit Key_Expression is given.
	Otherwise the distinction between the two iterated forms is done
	during semantic analysis.
	* sinfo.ads: New node N_Iterated_Element_Association, for
	Ada202x container aggregates.  New field Key_Expression.
	* sinfo.adb: Subprograms for new node and newn field.
	* sem_aggr.adb (Resolve_Iterated_Component_Association): Handle
	the case where the Iteration_Scheme is an
	Iterator_Specification.
	* exp_aggr.adb (Wxpand_Iterated_Component): Handle a component
	with an Iterated_Component_Association, generate proper loop
	using given Iterator_Specification.
	* exp_util.adb (Insert_Axtions): Handle new node as other
	aggregate components.
	* sem.adb, sprint.adb: Handle new node.
	* tbuild.adb (Make_Implicit_Loop_Statement): Handle properly a
	loop with an Iterator_ specification.
2020-07-15 09:43:00 -04:00
Arnaud Charlet
1c5f82019a [Ada] Fix logic in Allocate_Any_Controlled
gcc/ada/

	* libgnat/s-stposu.adb (Allocate_Any_Controlled): Fix logic in
	lock/unlock.
2020-07-15 09:42:59 -04:00
Piotr Trojanek
b2410a1f02 [Ada] Target name is an object reference
gcc/ada/

	* sem_util.adb (Is_Object_Reference): Return True on
	N_Target_Name.
2020-07-15 09:42:58 -04:00
Arnaud Charlet
5849018425 [Ada] Spurious error on Predicate_Failure aspect
gcc/ada/

	* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Add proper
	handling of Aspect_Predicate_Failure, consistent with
	Check_Aspect_At_Freeze_Point.
2020-07-15 09:42:57 -04:00
Arnaud Charlet
580fe036c8 [Ada] Mention -gnat2020 in error message
gcc/ada/

	* sem_ch13.adb (Check_Aspect_Too_Late): Mention -gnat2020 switch
	in error message.
2020-07-15 09:42:56 -04:00
Eric Botcazou
4c1e539511 [Ada] Do not generate elaboration code for alignment aspect
gcc/ada/

	* einfo.ads (Delayed Freezing and Elaboration): Adjust description.
	* freeze.adb (Freeze_Object_Declaration): Likewise.
	* sem_ch3.adb (Delayed_Aspect_Present): Likewise.  Do not return
	true for Alignment.
	* sem_ch13.adb (Analyze_Aspect_Specifications): Do not always delay
	for Alignment.  Moreover, for Alignment and various Size aspects,
	do not delay if the expression is an attribute whose prefix is the
	Standard package.
2020-07-15 09:42:55 -04:00
Eric Botcazou
ae6fec84da [Ada] Do not generate extra copies inside initialization procedures
gcc/ada/

	* exp_ch6.adb (Requires_Atomic_Or_Volatile_Copy): Return false
	inside an initialization procedure.
2020-07-15 09:42:54 -04:00
Ghjuvan Lacambre
fbaadba246 [Ada] Guard against access to wrong fields in Is_Renaming
gcc/ada/

	* sem_util.adb (Is_Renaming): Add ekind checks.
2020-07-15 09:42:53 -04:00
Arnaud Charlet
ae265cdd5b [Ada] Remove doc on obsolete tools
gcc/ada/

	* doc/gnat_ugn/gnat_utility_programs.rst: Remove doc on obsolete
	tools.
	* gnat_ugn.texi: Regenerate.
2020-07-15 09:42:52 -04:00
Arnaud Charlet
d15dc6fb72 [Ada] Assert failure with -gnatwr
gcc/ada/

	* sem_res.adb (Resolve_Type_Conversion): Protect against null
	entity.  Add proper tag for -gnatwr warning.
2020-07-15 09:42:51 -04:00
Arnaud Charlet
00847335c8 [Ada] Missing error on operator call
gcc/ada/

	* sem_ch6.adb (Analyze_Procedure_Call): Detect use of operators
	in a procedure call.
	* sem_util.adb: Minor edit.
2020-07-15 09:42:50 -04:00
Piotr Trojanek
7fe05755eb [Ada] Fix for possibly null ranges in 'Update and delta_aggregate
gcc/ada/

	* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Apply scalar
	range checks against the base type of an index type, not against
	the index type itself.
2020-07-15 09:42:49 -04:00
Eric Botcazou
257baf5ab9 [Ada] Small addition and tweaks in documentation on freezing
gcc/ada/

	* einfo.ads (Delayed Freezing and Elaboration): Minor tweaks.
	Document the discrepancy between the aspect and the non-aspect
	cases for alignment settings in object declarations.
2020-07-15 09:42:48 -04:00
Arnaud Charlet
d0f6dd47fd [Ada] ACATS 4.1P [BDB4001] - 13.11.4(22-23/3) not enforced
gcc/ada/

	* exp_ch3.adb (Freeze_Type): Remove warning in expander,
	replaced by a corresponding error in sem_ch13.adb. Replace
	RTE_Available by RTU_Loaded to avoid adding unnecessary
	dependencies.
	* sem_ch13.adb (Associate_Storage_Pool): New procedure.
	(Analyze_Attribute_Definition_Clause
	[Attribute_Simple_Storage_Pool| Attribute_Storage_Pool]): Call
	Associate_Storage_Pool to add proper legality checks on
	subpools.
2020-07-15 09:42:47 -04:00
Yannick Moy
3221be1444 [Ada] Mark standard containers as not in SPARK
gcc/ada/

	* libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads,
	libgnat/a-cbhama.adb, libgnat/a-cbhama.ads,
	libgnat/a-cbhase.adb, libgnat/a-cbhase.ads,
	libgnat/a-cbmutr.adb, libgnat/a-cbmutr.ads,
	libgnat/a-cborma.adb, libgnat/a-cborma.ads,
	libgnat/a-cborse.adb, libgnat/a-cborse.ads,
	libgnat/a-cbprqu.adb, libgnat/a-cbprqu.ads,
	libgnat/a-cbsyqu.adb, libgnat/a-cbsyqu.ads,
	libgnat/a-cdlili.adb, libgnat/a-cdlili.ads,
	libgnat/a-cidlli.adb, libgnat/a-cidlli.ads,
	libgnat/a-cihama.adb, libgnat/a-cihama.ads,
	libgnat/a-cihase.adb, libgnat/a-cihase.ads,
	libgnat/a-cimutr.adb, libgnat/a-cimutr.ads,
	libgnat/a-ciorma.adb, libgnat/a-ciorma.ads,
	libgnat/a-ciormu.adb, libgnat/a-ciormu.ads,
	libgnat/a-ciorse.adb, libgnat/a-ciorse.ads,
	libgnat/a-cohama.adb, libgnat/a-cohama.ads,
	libgnat/a-cohase.adb, libgnat/a-cohase.ads,
	libgnat/a-coinve.adb, libgnat/a-coinve.ads,
	libgnat/a-comutr.adb, libgnat/a-comutr.ads,
	libgnat/a-convec.adb, libgnat/a-convec.ads,
	libgnat/a-coorma.adb, libgnat/a-coorma.ads,
	libgnat/a-coormu.adb, libgnat/a-coormu.ads,
	libgnat/a-coorse.adb, libgnat/a-coorse.ads: Add SPARK_Mode =>
	Off.
2020-07-15 09:42:46 -04:00
Eric Botcazou
bdeeeaf71f [Ada] Fix oversight in Delayed_Aspect_Present predicate
gcc/ada/

	* sem_ch3.adb (Delayed_Aspect_Present): Fix oversight in loop.
	* freeze.adb (Freeze_Object_Declaration): Use Declaration_Node
	instead of Parent for the sake of consistency.
2020-07-15 09:42:45 -04:00
Javier Miranda
3a9222bcb3 [Ada] Wrong resolution of 'access in protected subprogram
gcc/ada/

	* sem_attr.adb (Resolve_Attribute): Resolve overloaded
	N_Selected_Component prefix of 'Access. Required to handle
	overloaded prefixed view of protected subprograms.
2020-07-15 09:42:44 -04:00
Arnaud Charlet
3c75d0f23c [Ada] Documentation cleanups
gcc/ada/

	* doc/gnat_ugn/about_this_guide.rst: Remove old section and
	update for Ada 202x.
	* doc/gnat_ugn/getting_started_with_gnat.rst: Add a system
	requirements section. Remove obsolete section and minimal
	rewording on the getting started section.
	* gnat_ugn.texi: Regenerate.
2020-07-15 09:42:43 -04:00
Piotr Trojanek
9fdf1cebaf [Ada] Fix slices and qualified expressions being effectively volatile
gcc/ada/

	* exp_ch5.adb (Expand_Assign_Array): Use short-circuit operator
	(style).
	* sem_res.adb (Resolve_Indexed_Component): Fix style in comment.
	* sem_util.adb (Is_Effectively_Volatile_Object): Handle slices
	just like indexed components; handle qualified expressions and
	type conversions lie in Is_OK_Volatile_Context.
	(Is_OK_Volatile_Context): Handle qualified expressions just like
	type conversions.
2020-07-15 09:42:42 -04:00
Piotr Trojanek
98e663f597 [Ada] Cleanup condition for an effectively volatile array type
gcc/ada/

	* sem_prag.adb (Atomic_Components): Simplify with Ekind_In.
	(Complex_Representation): Fix type of E_Id, which just like when
	for pragma Atomic_Components will hold an N_Identifier node, not
	an entity.
	* sem_util.adb (Is_Effectively_Volatile): Refactor to avoid
	unnecessary computation.
2020-07-15 09:42:41 -04:00
Arnaud Charlet
8cd5951d68 [Ada] Extend static functions
gcc/ada/

	* inline.adb, inline.ads
	(Inline_Static_Expression_Function_Call): Renamed
	Inline_Static_Function_Call.
	* sem_ch13.adb (Analyze_Aspect_Static): Allow static intrinsic
	imported functions under -gnatX.
	* sem_util.ads, sem_util.adb (Is_Static_Expression_Function):
	Renamed Is_Static_Function.
	(Is_Static_Expression_Function_Call): Renamed
	Is_Static_Function_Call.
	* sem_ch6.adb, sem_elab.adb, sem_res.adb: Update calls to
	Is_Static_Function*.
	* sem_eval.adb (Fold_Dummy, Eval_Intrinsic_Call, Fold_Shift):
	New.
	(Eval_Call): Add support for intrinsic calls, code refactoring.
	(Eval_Entity_Name): Code refactoring.
	(Eval_Logical_Op): Update comment.
	(Eval_Shift): Call Fold_Shift. Update comments.
	* par-prag.adb (Par [Pragma_Extensions_Allowed]): Set
	Ada_Version to Ada_Version_Type'Last to handle
	Extensions_Allowed (On) consistently.
	* opt.ads (Extensions_Allowed): Update documentation.
	* sem_attr.adb: Update comment.
	* doc/gnat_rm/implementation_defined_pragmas.rst: Update
	documentation of Extensions_Allowed.
	* gnat_rm.texi: Regenerate.
2020-07-15 09:42:40 -04:00
Arnaud Charlet
fa02302bc1 [Ada] Potential access to uninitialized variable
gcc/ada/

	* sem_aggr.adb (Resolve_Iterated_Component_Association): Ensure
	Typ is never accessed uninitialized.
2020-07-15 09:42:39 -04:00
Piotr Trojanek
5f9afe0dc1 [Ada] Fix typo in "accommodate" in docs and comments
gcc/ada/

	* doc/gnat_rm/representation_clauses_and_pragmas.rst: Fix typo.
	* gnat_rm.texi: Regenerate.
	* libgnat/s-secsta.ads (Memory_Alignment): Likewise.
2020-07-15 09:42:38 -04:00
Gary Dismukes
0b4034c06b [Ada] Minor reformatting of comments and some code, plus a typo correction
gcc/ada/

	* exp_ch6.adb: Add a comma and fix a typo (machinary =>
	machinery) in comment.
	* exp_aggr.adb: Reformat, fix capitalization, and add a couple
	of commas in a comment. Adjust columns in several code
	fragments.
	* sem_aggr.adb: Reformat and add a comma in a comment.
2020-07-15 09:42:37 -04:00
Eric Botcazou
1c77806b48 [Ada] Use Sloc of delay statement in timed entry call
gcc/ada/

	* exp_ch9.adb (Expand_N_Timed_Entry_Call): Use the Sloc of
	the delay statement in the expansion.
2020-07-15 09:42:36 -04:00
Ed Schonberg
4f6ebe2a51 [Ada] Ongoing work for unnamed and named container aggregates
gcc/ada/

	* sem_aggr.adb (Resolve_Iterated_Component_Association): New
	procedure, internal to Resolve_Container_Aggregate, to complete
	semantic analysis of Iterated_Component_Associations.
	* exp_aggr.adb (Expand_Iterated_Component): New procedure,
	internal to Expand_Container_Aggregate, to expand the construct
	into an implicit loop that performs individual insertions into
	the target aggregate.
2020-07-15 09:42:35 -04:00
Justin Squirek
3c30eac83c [Ada] Spurious accessibility error on allocator
gcc/ada/

	* exp_ch6.adb (Make_Build_In_Place_Call_Allocator): Normalize
	the associated node for internally generated objects to be like
	their SOAAT counter-parts.
2020-07-15 09:42:34 -04:00
Arnaud Charlet
a2f4fc6f3f [Ada] Fix potentially uninitialized variable flagged by CodePeer
gcc/ada/

	* libgnat/g-socket.adb (Wait_On_Socket): Fix potentially
	uninitialized variable.
2020-07-15 09:42:33 -04:00
Nathan Sidwell
f0d0be62db c++: error recovery & pragmas
Parser error recovery can get confused by the tokens within a deferred
pragma, as treats those as regular tokens.  This adjusts the recovery
so that the pragma is treated as a unit.  Also, the preprocessor now
ensures that we never have an EOF token inside a pragma -- the pragma
is always closed first.

	gcc/cp/
	* parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
	meeting a deferred pragma.
	(cp_parser_skip_to_end_of_statement): Likewise.
	(cp_parser_skip_to_end_of_block_or_statement): Likewise.
	(cp_parser_skip_to_pragma_eol): We should never meet EOF.
	(cp_parser_omp_declare_simd): Likewise.
	(cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
	(pragma_lex): Likewise.
	gcc/testsuite/
	* g++.dg/parse/pragma-recovery.C: New.
2020-07-15 06:05:41 -07:00
Tobias Burnus
e0685fadb6 libgomp.fortran/struct-elem-map-1.f90: Add char kind=4 tests
As the Fortran PR 95837 has been fixed, the test could be be added.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/struct-elem-map-1.f90: Remove unused
	variables; add character(kind=4) tests; update TODO comment.
2020-07-15 12:34:03 +02:00
Jakub Jelinek
12d69dbfff fix _mm512_{,mask_}cmp*_p[ds]_mask at -O0 [PR96174]
The _mm512_{,mask_}cmp_p[ds]_mask and also _mm_{,mask_}cmp_s[ds]_mask
intrinsics have an argument which must have a constant passed to it
and so use an inline version only for ifdef __OPTIMIZE__ and have
a #define for -O0.  But the _mm512_{,mask_}cmp*_p[ds]_mask intrinsics
don't need a constant argument, they are essentially the first
set with the constant added to them implicitly based on the comparison
name, and so there is no #define version for them (correctly).
But their inline versions are defined in between the first and s[ds]
set and so inside of ifdef __OPTIMIZE__, which means that with -O0
they aren't defined at all.

This patch fixes that by moving those after the #ifdef __OPTIMIZE #else
use #define #endif block.

2020-07-15  Jakub Jelinek  <jakub@redhat.com>

	PR target/96174
	* config/i386/avx512fintrin.h (_mm512_cmpeq_pd_mask,
	_mm512_mask_cmpeq_pd_mask, _mm512_cmplt_pd_mask,
	_mm512_mask_cmplt_pd_mask, _mm512_cmple_pd_mask,
	_mm512_mask_cmple_pd_mask, _mm512_cmpunord_pd_mask,
	_mm512_mask_cmpunord_pd_mask, _mm512_cmpneq_pd_mask,
	_mm512_mask_cmpneq_pd_mask, _mm512_cmpnlt_pd_mask,
	_mm512_mask_cmpnlt_pd_mask, _mm512_cmpnle_pd_mask,
	_mm512_mask_cmpnle_pd_mask, _mm512_cmpord_pd_mask,
	_mm512_mask_cmpord_pd_mask, _mm512_cmpeq_ps_mask,
	_mm512_mask_cmpeq_ps_mask, _mm512_cmplt_ps_mask,
	_mm512_mask_cmplt_ps_mask, _mm512_cmple_ps_mask,
	_mm512_mask_cmple_ps_mask, _mm512_cmpunord_ps_mask,
	_mm512_mask_cmpunord_ps_mask, _mm512_cmpneq_ps_mask,
	_mm512_mask_cmpneq_ps_mask, _mm512_cmpnlt_ps_mask,
	_mm512_mask_cmpnlt_ps_mask, _mm512_cmpnle_ps_mask,
	_mm512_mask_cmpnle_ps_mask, _mm512_cmpord_ps_mask,
	_mm512_mask_cmpord_ps_mask): Move outside of __OPTIMIZE__ guarded
	section.

	* gcc.target/i386/avx512f-vcmppd-3.c: New test.
	* gcc.target/i386/avx512f-vcmpps-3.c: New test.
2020-07-15 11:34:44 +02:00
Jakub Jelinek
410675cb63 builtins: Avoid useless char/short -> int promotions before atomics [PR96176]
As mentioned in the PR, we generate a useless movzbl insn before lock cmpxchg.
The problem is that the builtin for the char/short cases has the arguments
promoted to int and combine gives up, because the instructions have
MEM_VOLATILE_P arguments and recog in that case doesn't recognize anything
when volatile_ok is false, and nothing afterwards optimizes the
(reg:SI a) = (zero_extend:SI (reg:QI a))
... (subreg:QI (reg:SI a) 0) ...

The following patch fixes it at expansion time, we already have a function
that is meant to undo the promotion, so this just adds the very common case
to that.

2020-07-15  Jakub Jelinek  <jakub@redhat.com>

	PR target/96176
	* builtins.c: Include gimple-ssa.h, tree-ssa-live.h and
	tree-outof-ssa.h.
	(expand_expr_force_mode): If exp is a SSA_NAME with different mode
	from MODE and get_gimple_for_ssa_name is a cast from MODE, use the
	cast's rhs.

	* gcc.target/i386/pr96176.c: New test.
2020-07-15 11:26:22 +02:00
guojiufu
7a9fd18598 rs6000: Refine RTL unroll hook for small loops
For very small loops (< 6 insns), it would be fine to unroll 4
times to run fast with less latency and better cache usage.  Like
below loops:
 while (i) a[--i] = NULL;   while (p < e)  *d++ = *p++;

With this patch enhances, we could see some performance improvement
for some workloads(e.g. SPEC2017).

2020-07-13  Jiufu Guo   <guojiufu@cn.ibm.com>

	* config/rs6000/rs6000.c (rs6000_loop_unroll_adjust): Refine hook.
2020-07-15 16:15:05 +08:00
Tobias Burnus
fff15bad1a libgomp: Add Fortran routine support for allocators
libgomp/ChangeLog:

	* allocator.c: Add ialias for omp_init_allocator and
	omp_destroy_allocator.
	* configure.ac: Set INTPTR_T_KIND.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* fortran.c (omp_init_allocator_, omp_destroy_allocator_,
	omp_set_default_allocator_, omp_get_default_allocator_): New
	functions and ialias_redirect.
	* icv.c: Add ialias for omp_set_default_allocator and
	omp_get_default_allocator.
	* libgomp.map (OMP_5.0.1): Add omp_init_allocator_,
	omp_destroy_allocator_, omp_set_default_allocator_ and
	omp_get_default_allocator_.
	* omp_lib.f90.in: Add allocator traits parameters, declare
	allocator routines and add related kind parameters.
	* omp_lib.h.in: Likewise.
	* testsuite/libgomp.c-c++-common/alloc-2.c: Fix sizeof.
	* testsuite/libgomp.fortran/alloc-1.F90: New test.
	* testsuite/libgomp.fortran/alloc-2.F90: New test.
	* testsuite/libgomp.fortran/alloc-3.F: New test.
	* testsuite/libgomp.fortran/alloc-4.f90: New test.
	* testsuite/libgomp.fortran/alloc-5.f90: New test.
2020-07-15 08:33:20 +02:00
GCC Administrator
8ca07a3072 Daily bump. 2020-07-15 00:16:35 +00:00
Marek Polacek
4358099049 c++: Add new test [PR59978]
Fixed in r224162.  That came without a test so adding this one.
Previously, we issued a bogus "too few arguments to function" error.

gcc/testsuite/ChangeLog:

	PR c++/59978
	* g++.dg/cpp0x/vt-59978.C: New test.
2020-07-14 17:32:03 -04:00
H.J. Lu
b2984e5ada x86: Replace __glibc_unlikely with __builtin_expect
Replace glibc specific __glibc_unlikely with __builtin_expect.

	PR target/95443
	* gcc.target/i386/pr95443-1.c (simple_strstr): Replace
	__glibc_unlikely with __builtin_expect.
2020-07-14 14:04:36 -07:00
Marek Polacek
8e64d18285 c++: Make convert_like complain about bad ck_ref_bind again [PR95789]
convert_like issues errors about bad_p conversions at the beginning
of the function, but in the ck_ref_bind case, it only issues them
after we've called convert_like on the next conversion.

This doesn't work as expected since r10-7096 because when we see
a conversion from/to class type in a template, we return early, thereby
missing the error, and a bad_p conversion goes by undetected.  That
made the attached test to compile even though it should not.

I had thought that I could just move the ck_ref_bind/bad_p errors
above to the rest of them, but that regressed diagnostics because
expr then wasn't converted yet by the nested convert_like_real call.

So, for bad_p conversions, do the normal processing, but still return
the IMPLICIT_CONV_EXPR to avoid introducing trees that the template
processing can't handle well.  This I achieved by adding a wrapper
function.

gcc/cp/ChangeLog:

	PR c++/95789
	PR c++/96104
	PR c++/96179
	* call.c (convert_like_real_1): Renamed from convert_like_real.
	(convert_like_real): New wrapper for convert_like_real_1.

gcc/testsuite/ChangeLog:

	PR c++/95789
	PR c++/96104
	PR c++/96179
	* g++.dg/conversion/ref4.C: New test.
	* g++.dg/conversion/ref5.C: New test.
	* g++.dg/conversion/ref6.C: New test.
2020-07-14 16:02:39 -04:00