Commit Graph

186555 Commits

Author SHA1 Message Date
Arnaud Charlet
076c1a9157 [Ada] Add No_Tasking restriction is system.ads for bootstrap
gcc/ada/

	* gcc-interface/system.ads: Add No_Tasking restriction.
2021-07-08 13:34:17 +00:00
Ed Schonberg
b927d936e3 [Ada] Incorrect iteration over hashed containers after multiple Inserts
gcc/ada/

	* libgnat/a-cohama.ads: Introduce an equality operator over
	cursors.
	* libgnat/a-cohase.ads: Ditto.
	* libgnat/a-cohama.adb: Add body for "=" over cursors.
	(Insert): Do not set the Position component of the cursor that
	denotes the inserted element.
	* libgnat/a-cohase.adb: Ditto.
2021-07-08 13:34:17 +00:00
Arnaud Charlet
c5b1e8e9a5 [Ada] Make runtime code compatible with No_Dynamic_Accessibility_Checks
gcc/ada/

	* libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb,
	libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb,
	libgnat/a-cborma.adb, libgnat/a-cborse.adb,
	libgnat/a-cobove.adb, libgnat/a-textio.adb,
	libgnat/a-witeio.adb, libgnat/a-ztexio.adb: Make code compatible
	with No_Dynamic_Accessibility_Checks restriction.
2021-07-08 13:34:17 +00:00
Arnaud Charlet
a2f91a52b4 [Ada] Revert meaning of -gnatd_b
gcc/ada/

	* debug.adb, sem_util.adb: Revert meaning of -gnatd_b.
	* sem_res.adb: Minor reformatting.
2021-07-08 13:34:16 +00:00
Arnaud Charlet
3cb32058b4 [Ada] Make tools compatible with No_Dynamic_Accessibility_Checks
gcc/ada/

	* make.adb, osint.adb: Make code compatible with
	No_Dynamic_Accessibility_Checks restriction.
2021-07-08 13:34:16 +00:00
Piotr Trojanek
79a8b14237 [Ada] Avoid linear search when ensuring dependency on System
gcc/ada/

	* lib-writ.adb (Ensure_System_Dependency): Replace search in
	Lib.Units with a search in Lib.Unit_Names.
2021-07-08 13:34:16 +00:00
Piotr Trojanek
999a2dd00d [Ada] Simplify string manipulation related to preprocessing
gcc/ada/

	* sinput-l.adb (Load_File): Simplify foreword manipulation with
	concatenation; similar for filename with preprocessed output.
2021-07-08 13:34:16 +00:00
Richard Sandiford
2e9ef3929b vect: Remove always-true condition
vectorizable_reduction had code guarded by:

  if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def
      || STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def)

But that's always true after:

  if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_reduction_def
      && STMT_VINFO_DEF_TYPE (stmt_info) != vect_double_reduction_def
      && STMT_VINFO_DEF_TYPE (stmt_info) != vect_nested_cycle)
    return false;

  if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_nested_cycle)
    {
      …
      return true;
    }

(I wasn't sure at first how the empty “else” for the first “if” above
was supposed to work.)

gcc/
	* tree-vect-loop.c (vectorizable_reduction): Remove always-true
	if condition.
2021-07-08 12:58:13 +01:00
Richard Sandiford
298b0db76d match.pd: Relax rule to include POLY_INT_CSTs
match.pd has a rule to simplify an extension, operation and truncation
back to the original type:

 (simplify
   (convert (op:s@0 (convert1?@3 @1) (convert2?@4 @2)))

Currently it handles cases in which @2 is an INTEGER_CST, but it
also works for POLY_INT_CSTs.[*]

For INTEGER_CST it doesn't matter whether we test @2 or @4,
but for POLY_INT_CST it is possible to have unfolded (convert …)s.

Originally I saw this leading to some bad ivopts decisions, because
we weren't folding away redundancies from candidate iv expressions.
It's also possible to test the fold directly using the SVE ACLE.

[*] Not all INTEGER_CST rules work for POLY_INT_CSTs, since extensions
    don't necessarily distribute over the internals of the POLY_INT_CST.
    But in this case that isn't an issue.

gcc/
	* match.pd: Simplify an extend-operate-truncate sequence involving
	a POLY_INT_CST.

gcc/testsuite/
	* gcc.target/aarch64/sve/acle/general/cntb_1.c: New test.
2021-07-08 12:49:44 +01:00
Roger Sayle
4c619132b3 PR tree-optimization/40210: Fold (bswap(X)>>C1)&C2 to (X>>C3)&C2 in match.pd
All of the optimizations/transformations mentioned in bugzilla for
PR tree-optimization/40210 are already implemented in mainline GCC,
with one exception.  In comment #5, there's a suggestion that
(bswap64(x)>>56)&0xff can be implemented without the bswap as
(unsigned char)x, or equivalently x&0xff.

This patch implements the above optimization, and closely related
variants.  For any single bit, (bswap(X)>>C1)&1 can be simplified
to (X>>C2)&1, where bit position C2 is the appropriate permutation
of C1.  Similarly, the bswap can eliminated if the desired set of
bits all lie within the same byte, hence (bswap(x)>>8)&255 can
always be optimized, as can (bswap(x)>>8)&123.

Previously,
int foo(long long x) {
  return (__builtin_bswap64(x) >> 56) & 0xff;
}

compiled with -O2 to
foo:	movq    %rdi, %rax
        bswap   %rax
        shrq    $56, %rax
        ret

with this patch, it now compiles to
foo:	movzbl  %dil, %eax
        ret

2021-07-08  Roger Sayle  <roger@nextmovesoftware.com>
	    Richard Biener  <rguenther@suse.de>

gcc/ChangeLog
	PR tree-optimization/40210
	* match.pd (bswap optimizations): Simplify (bswap(x)>>C1)&C2 as
	(x>>C3)&C2 when possible.  Simplify bswap(x)>>C1 as ((T)x)>>C2
	when possible.  Simplify bswap(x)&C1 as (x>>C2)&C1 when 0<=C1<=255.

gcc/testsuite/ChangeLog
	PR tree-optimization/40210
	* gcc.dg/builtin-bswap-13.c: New test.
	* gcc.dg/builtin-bswap-14.c: New test.
2021-07-08 11:47:55 +01:00
Uros Bizjak
663a014e77 i386: Add pack/unpack patterns for 32bit vectors [PR100637]
V1SI mode shift is needed to shift 32bit operands and consequently we
need to implement V1SI moves and pushes.

2021-07-08  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/100637
	* config/i386/i386-expand.c (ix86_expand_sse_unpack):
	Handle V4QI mode.
	* config/i386/mmx.md (V_32): New mode iterator.
	(mov<V_32:mode>): Use V_32 mode iterator.
	(*mov<V_32:mode>_internal): Ditto.
	(*push<V_32:mode>2_rex64): Ditto.
	(*push<V_32:mode>2): Ditto.
	(movmisalign<V_32:mode>): Ditto.
	(mmx_<any_shiftrt:insn>v1si3): New insn pattern.
	(sse4_1_<any_extend:code>v2qiv2hi2): Ditto.
	(vec_unpacks_lo_v4qi): New expander.
	(vec_unpacks_hi_v4qi): Ditto.
	(vec_unpacku_lo_v4qi): Ditto.
	(vec_unpacku_hi_v4qi): Ditto.
	* config/i386/i386.h (VALID_SSE2_REG_MODE): Add V1SImode.
	(VALID_INT_MODE_P): Ditto.
2021-07-08 12:20:29 +02:00
Michael Meissner
852b11da11 Generate 128-bit int divide/modulus on power10.
This patch adds support for the VDIVSQ, VDIVUQ, VMODSQ, and VMODUQ
instructions to do 128-bit arithmetic.

2021-07-07  Michael Meissner  <meissner@linux.ibm.com>

gcc/
	PR target/100809
	* config/rs6000/rs6000.md (udivti3): New insn.
	(divti3): New insn.
	(umodti3): New insn.
	(modti3): New insn.

gcc/testsuite/
	PR target/100809
	* gcc.target/powerpc/p10-vdivq-vmodq.c: New test.
2021-07-07 21:55:38 -04:00
GCC Administrator
c24a970782 Daily bump. 2021-07-08 00:16:27 +00:00
David Malcolm
48e8a7a677 analyzer: remove add_any_constraints_from_ssa_def_stmt
I'm working on reimplementing -Wanalyzer-use-of-uninitialized-value, but
I ran into issues with
region_model::add_any_constraints_from_ssa_def_stmt.
This function is from the initial commit of the analyzer and walks the
SSA names finding conditions that were missed due to the GCC 10 era
region_model not retaining useful information on how values were
created; as of GCC 11 the symbolic values contain this information,
and so the conditions can be reconstructed from them instead.

region_model::add_any_constraints_from_ssa_def_stmt is a liability
when tracking uninitialized values as it requires looking up SSA
values when those values may have been purged, thus greatly complicating
detection of uses of uninitialized values.

It's simplest to eliminate it and reimplement the condition-finding
via the makeup of the svalues, which this patch does.  Doing so requires
supporting add_condition on svalues rather than just on trees, which
requires some changes to ana::state_machine and its subclasses.

gcc/analyzer/ChangeLog:
	* diagnostic-manager.cc (null_assignment_sm_context::get_state):
	New overload.
	(null_assignment_sm_context::set_next_state): New overload.
	(null_assignment_sm_context::get_diagnostic_tree): New.
	* engine.cc (impl_sm_context::get_state): New overload.
	(impl_sm_context::set_next_state): New overload.
	(impl_sm_context::get_diagnostic_tree): New overload.
	(impl_region_model_context::on_condition): Convert params from
	tree to const svalue *.
	* exploded-graph.h (impl_region_model_context::on_condition):
	Likewise.
	* region-model.cc (region_model::on_call_pre): Move handling of
	internal calls to before checking for get_fndecl_for_call.
	(region_model::add_constraints_from_binop): New.
	(region_model::add_constraint): Split out into a new overload
	working on const svalue * rather than tree.  Call
	add_constraints_from_binop.  Drop call to
	add_any_constraints_from_ssa_def_stmt.
	(region_model::add_any_constraints_from_ssa_def_stmt): Delete.
	(region_model::add_any_constraints_from_gassign): Delete.
	(region_model::add_any_constraints_from_gcall): Delete.
	* region-model.h
	(region_model::add_any_constraints_from_ssa_def_stmt): Delete.
	(region_model::add_any_constraints_from_gassign): Delete.
	(region_model::add_any_constraints_from_gcall): Delete.
	(region_model::add_constraint): Add overload decl.
	(region_model::add_constraints_from_binop): New decl.
	(region_model_context::on_condition): Convert params from tree to
	const svalue *.
	(noop_region_model_context::on_condition): Likewise.
	* sm-file.cc (fileptr_state_machine::condition): Likewise.
	* sm-malloc.cc (malloc_state_machine::on_condition): Likewise.
	* sm-pattern-test.cc: Include tristate.h, selftest.h,
	analyzer/call-string.h, analyzer/program-point.h,
	analyzer/store.h, and analyzer/region-model.h.
	(pattern_test_state_machine::on_condition): Convert params from tree to
	const svalue *.
	* sm-sensitive.cc (sensitive_state_machine::on_condition): Delete.
	* sm-signal.cc (signal_state_machine::on_condition): Delete.
	* sm-taint.cc (taint_state_machine::on_condition): Convert params
	from tree to const svalue *.
	* sm.cc: Include tristate.h, selftest.h, analyzer/call-string.h,
	analyzer/program-point.h, analyzer/store.h, and
	analyzer/region-model.h.
	(any_pointer_p): Add overload taking const svalue *sval.
	* sm.h (any_pointer_p): Add overload taking const svalue *sval.
	(state_machine::on_condition): Convert params from tree to
	const svalue *.  Provide no-op default implementation.
	(sm_context::get_state): Add overload taking const svalue *sval.
	(sm_context::set_next_state): Likewise.
	(sm_context::on_transition): Likewise.
	(sm_context::get_diagnostic_tree): Likewise.
	* svalue.cc (svalue::all_zeroes_p): New.
	(constant_svalue::all_zeroes_p): New.
	(repeated_svalue::all_zeroes_p): Convert to vfunc.
	* svalue.h (svalue::all_zeroes_p): New decl.
	(constant_svalue::all_zeroes_p): New decl.
	(repeated_svalue::all_zeroes_p): Convert decl to vfunc.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/pattern-test-2.c: Update expected results.
	* gcc.dg/plugin/analyzer_gil_plugin.c
	(gil_state_machine::on_condition): Remove.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-07 19:29:30 -04:00
Martin Sebor
a110855667 Correct handling of variable offset minus constant in -Warray-bounds [PR100137]
Resolves:
PR tree-optimization/100137 - -Warray-bounds false positive on varying offset plus negative
PR tree-optimization/99121 - ICE in -Warray-bounds on a multidimensional
PR tree-optimization/97027 - missing warning on buffer overflow storing a larger scalar into a smaller array

gcc/ChangeLog:

	PR tree-optimization/100137
	PR tree-optimization/99121
	PR tree-optimization/97027
	* builtins.c (access_ref::access_ref): Also set offmax.
	(access_ref::offset_in_range): Define new function.
	(access_ref::add_offset): Set offmax.
	(access_ref::inform_access): Handle access_none.
	(handle_mem_ref): Clear ostype.
	(compute_objsize_r): Handle ASSERT_EXPR.
	* builtins.h (struct access_ref): Add offmax member.
	* gimple-array-bounds.cc (array_bounds_checker::check_mem_ref): Use
	compute_objsize() and simplify.

gcc/testsuite/ChangeLog:

	PR tree-optimization/100137
	PR tree-optimization/99121
	PR tree-optimization/97027
	* c-c++-common/Warray-bounds-3.c: Remove xfail
	* c-c++-common/Warray-bounds-4.c: Add an expected warning.
	* c-c++-common/Warray-bounds-9.c: New test.
	* c-c++-common/Warray-bounds-10.c: New test.
	* g++.dg/asan/asan_test.C: Suppress expected warnings.
	* g++.dg/pr95768.C: Same.
	* g++.dg/warn/Warray-bounds-10.C: Adjust text of expected messages.
	* g++.dg/warn/Warray-bounds-11.C: Same.
	* g++.dg/warn/Warray-bounds-12.C: Same.
	* g++.dg/warn/Warray-bounds-13.C: Same.
	* g++.dg/warn/Warray-bounds-17.C: Same.
	* g++.dg/warn/Warray-bounds-20.C: Same.
	* gcc.dg/Warray-bounds-29.c: Same.
	* gcc.dg/Warray-bounds-30.c: Add xfail.
	* gcc.dg/Warray-bounds-31.c: Adjust text of expected messages.
	* gcc.dg/Warray-bounds-32.c: Same.
	* gcc.dg/Warray-bounds-52.c: Same.
	* gcc.dg/Warray-bounds-53.c: Same.
	* gcc.dg/Warray-bounds-58.c: Remove xfail.
	* gcc.dg/Warray-bounds-63.c: Adjust text of expected messages.
	* gcc.dg/Warray-bounds-66.c: Same.
	* gcc.dg/Warray-bounds-69.c: Same.
	* gcc.dg/Wstringop-overflow-34.c: Same.
	* gcc.dg/Wstringop-overflow-47.c: Same.
	* gcc.dg/Wstringop-overflow-61.c: Same.
	* gcc.dg/Warray-bounds-77.c: New test.
	* gcc.dg/Warray-bounds-78.c: New test.
	* gcc.dg/Warray-bounds-79.c: New test.
2021-07-07 14:06:59 -06:00
Peter Bergner
6278065af0 rs6000: Harden mma_init_builtins
The previous MMA patch added some fragile code to initialize its new
built-ins.  This patch hardens the initialization.

2021-07-07  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (mma_init_builtins): Use VSX_BUILTIN_LXVP
	and VSX_BUILTIN_STXVP.
2021-07-07 11:45:49 -05:00
Dmitriy Anisimkov
a5b5c7c284 [Ada] Remove unused define
gcc/ada/

	* s-oscons-tmplt.c (MSG_WAITALL): Remove wrong #ifdef
	__MINWGW32__.
2021-07-07 16:23:19 +00:00
Gary Dismukes
2c03e97c5a [Ada] Assertion errors on concurrent types with -gnatc and extensions enabled
gcc/ada/

	* einfo-utils.adb (Primitive_Operations): Default to returning
	Direct_Primitive_Operations in the case of concurrent types
	(when Corresponding_Record_Type not present).
	* sem_ch9.adb (Analyze_Protected_Type_Declaration): Initialize
	Direct_Primitive_Operations to an empty element list.
	(Analyze_Task_Type_Declaration): Initialize
	Direct_Primitive_Operations to an empty element list.
2021-07-07 16:23:19 +00:00
Piotr Trojanek
cce46226b0 [Ada] Stronger assertion about flag for checking static expressions
gcc/ada/

	* sem_eval.adb (Set_Checking_Potentially_Static_Expression):
	Stronger assertion.
2021-07-07 16:23:19 +00:00
Arnaud Charlet
18b267aeeb [Ada] Front-end inlining and instantiations of UC
gcc/ada/

	* sem_ch12.adb (Analyze_Subprogram_Instantiation): Mark Anon_Id
	intrinsic before calling Analyze_Instance_And_Renamings because
	this flag may be propagated to other nodes.
2021-07-07 16:23:18 +00:00
Dmitriy Anisimkov
125bb16bec [Ada] Keepalive control on Windows
gcc/ada/

	* s-oscons-tmplt.c (TCP_KEEPCNT TCP_KEEPIDLE, TCP_KEEPINTVL):
	Hardcode on Windows if undefined.
2021-07-07 16:23:18 +00:00
Bob Duff
29d3965161 [Ada] Optimize away certain elaboration checks
gcc/ada/

	* checks.adb (Install_Primitive_Elaboration_Check): Do not
	generate elaboration checks for primitives if pragma Pure or
	Preelaborate is present.  Misc comment fixes, including
	referring to the correct kind of check (elaboration, not
	accessibility).
	* checks.ads, restrict.adb, sem_cat.ads, sinfo.ads: Minor
	reformatting and comment fixes.
2021-07-07 16:23:18 +00:00
Piotr Trojanek
e1eb444173 [Ada] Simplify code by reusing Remove on list of primitive operations
gcc/ada/

	* sem_prag.adb (Analyze_Pragma): Simplify processing of pragma
	CPP_Constructor.
2021-07-07 16:23:18 +00:00
Arnaud Charlet
9e76a063f1 [Ada] Minor code cleanup
gcc/ada/

	* libgnat/g-debpoo.adb (Code_Address_For_Allocate_End): Default
	Initialize.
2021-07-07 16:23:17 +00:00
Arnaud Charlet
347d939028 [Ada] Code cleanups in System.Atomic_Counters
gcc/ada/

	* libgnat/s-atocou.ads, libgnat/s-atocou__builtin.adb: Code
	cleanups.
2021-07-07 16:23:17 +00:00
Gary Dismukes
14212dc422 [Ada] Implement new legality checks specified by AI12-0412
gcc/ada/

	* freeze.adb (Check_Inherited_Conditions): Setting of Ekind,
	LSP_Subprogram, and Is_Wrapper needs to happen for null
	procedures as well as other wrapper cases, so the code is moved
	from the else part in front of the if statement.  (Fixes a
	latent bug encountered while working on this set of changes.)
	* sem_attr.adb (Resolve_Attribute): Report an error for the case
	of an Access attribute applied to a primitive of an abstract
	type when the primitive has any nonstatic Pre'Class or
	Post'Class expressions.
	* sem_ch8.adb (Analyze_Subprogram_Renaming): Report an error for
	the case of a actual subprogram associated with a nonabstract
	formal subprogram when the actual is a primitive of an abstract
	type and the primitive has any nonstatic Pre'Class or Post'Class
	expressions.
	* sem_disp.adb (Check_Dispatching_Context): Remove special
	testing for null procedures, and replace it with a relaxed test
	that avoids getting an error about illegal calls to abstract
	subprograms in cases where RM 6.1.1(7/5) applies in
	Pre/Post'Class aspects. Also, remove special test for
	Postcondition, which seems to be unnecessary, update associated
	comments, and fix a typo in one comment.
	(Check_Dispatching_Call): Remove an unneeded return statement,
	and report an error for the case of a nondispatching call to a
	nonabstract subprogram of an abstract type where the subprogram
	has nonstatic Pre/Post'Class aspects.
	* sem_util.ads
	(Is_Prim_Of_Abst_Type_With_Nonstatic_CW_Pre_Post): New function.
	(In_Pre_Post_Condition): Add a flag formal Class_Wide_Only,
	defaulted to False, for indicating whether the function should
	only test for the node being within class-wide pre- and
	postconditions.
	* sem_util.adb
	(Is_Prim_Of_Abst_Type_With_Nonstatic_CW_Pre_Post): New function
	to determine whether a subprogram is a primitive of an abstract
	type where the primitive has class-wide Pre/Post'Class aspects
	specified with nonstatic expressions.
	(In_Pre_Post_Condition): Extend testing to account for the new
	formal Class_Wide_Only.
2021-07-07 16:23:17 +00:00
Piotr Trojanek
e5be1e443c [Ada] Fix location of errors about volatile compatibility
gcc/ada/

	* sem_ch12.adb (Check_Shared_Variable_Control_Aspects): Errors
	emitted via Check_Volatility_Compatibility are now emitted at
	Actual, just like other errors emitted by
	Check_Shared_Variable_Control_Aspects.
2021-07-07 16:23:16 +00:00
Piotr Trojanek
768f69696a [Ada] Use bounded string buffer in Get_Unit_Name
gcc/ada/

	* uname.adb (Get_Unit_Name): Simplify with a bounded string
	buffer; also, this addresses a ??? comment about the max length
	being exceeded.
2021-07-07 16:23:16 +00:00
Piotr Trojanek
d1d2bbcc85 [Ada] Replace obsolete calls that use global name buffer
gcc/ada/

	* uname.adb (Get_Body_Name, Get_Parent_Body_Name,
	Get_Parent_Spec_Name, Get_Spec_Name, Is_Child_Name,
	Is_Body_Name, Is_Spec_Name, Name_To_Unit_Name): Use a local
	instead of the global buffer.
2021-07-07 16:23:16 +00:00
Bob Duff
a547eea266 [Ada] Fix bugs in Value_Size clauses and refactor
gcc/ada/

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Combine
	processing of Size and Value_Size clauses. Ensure that
	Value_Size is treated the same as Size, in the cases where both
	are allowed (i.e. the prefix denotes a first subtype).  Misc
	cleanup.
	* einfo-utils.adb (Init_Size): Add assertions.
	(Size_Clause): Return a Value_Size clause if present, instead of
	just looking for a Size clause.
	* einfo.ads (Has_Size_Clause, Size_Clause): Change documentation
	to include Value_Size.
	* sem_ch13.ads, layout.ads, layout.adb: Comment modifications.
2021-07-07 16:23:15 +00:00
Steve Baird
2d71668e64 [Ada] Improve interactions between DSA and Put_Image routines for tagged types
gcc/ada/

	* exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies): Add
	TSS_Put_Image to list of predefined primitives that need special
	treatment.
	(Build_General_Calling_Stubs, Build_Subprogram_Receiving_Stubs):
	Remove previous hack for dealing with TSS_Put_Image procedures.
2021-07-07 16:23:15 +00:00
Dmitriy Anisimkov
4fa7097a14 [Ada] Timeout correction on Get_Socket_Option
gcc/ada/

	* libgnat/g-socket.adb (Get_Socket_Option): Add 500ms only when
	Minus_500ms_Windows_Timeout is True.
	(Set_Socket_Option): Use "* 1000" instead of "/ 0.001" to
	convert to milliseconds.
2021-07-07 16:23:15 +00:00
Bob Duff
ebef9784ef [Ada] Unchecked_Convert_To: set Parent
gcc/ada/

	* tbuild.adb (Unchecked_Convert_To): Set the Parent of the new
	node to the Parent of the old node.
	* tbuild.ads (Unchecked_Convert_To): Document differences
	between Convert_To and Unchecked_Convert_To. The previous
	documentation claimed they are identical except for the
	uncheckedness of the conversion.
2021-07-07 16:23:15 +00:00
Yannick Moy
a7f66404a6 [Ada] Simplify handling of sure errors in GNATprove mode
gcc/ada/

	* checks.adb (Apply_Scalar_Range_Check): Remove special case for
	GNATprove mode.
	* sem_res.adb (Resolve_Arithmetic_Op): Same.
	* sem_util.adb (Apply_Compile_Time_Constraint_Error): Same.
2021-07-07 16:23:14 +00:00
Piotr Trojanek
f78c17d267 [Ada] Reduce scope of local variables
gcc/ada/

	* sem_ch6.adb (Check_For_Primitive_Subprogram): Move
	declarations of local variables after nested subprogram bodies.
2021-07-07 16:23:14 +00:00
Piotr Trojanek
a7bb69067a [Ada] Simplify code by reusing List_Length
gcc/ada/

	* exp_disp.adb (CPP_Num_Prims): Reuse List_Length.
2021-07-07 16:23:14 +00:00
Piotr Trojanek
131c9affbd [Ada] Replace low-level membership tests with Is_Private_Type
gcc/ada/

	* exp_ch3.adb, exp_ch6.adb, sem_ch6.adb: Replace Ekind
	membership test in Private_Kind with a call to Is_Private_Type.
2021-07-07 16:23:13 +00:00
Bob Duff
19456797d1 [Ada] Linker_Section_Pragma cleanup
gcc/ada/

	* gen_il-gen-gen_entities.adb: Remove Linker_Section_Pragma
	field from Record_Field_Kind.  Minor comment improvement.
2021-07-07 16:23:13 +00:00
Yannick Moy
d557a5f9ce [Ada] Fix precondition of Cot for code analyzers
gcc/ada/

	* libgnat/a-ngelfu.ads (Cot): Fix precondition.
2021-07-07 16:23:13 +00:00
Piotr Trojanek
6dcf89443d [Ada] Replace chopped string copy with renaming
gcc/ada/

	* par.adb (Par): A local Name variable is now a renaming of a
	constant slice.
2021-07-07 16:23:12 +00:00
Piotr Trojanek
0543560936 [Ada] Simplify handling of Generate_Code flag for compilation units
gcc/ada/

	* gnat1drv.adb (Gnat1drv): Remove flagging of main unit and its
	corresponding spec as requiring code generation; now the flags
	are set much earlier.
	* lib-load.adb (Load_Main_Source): Set Generate_Code flag on the
	main unit source.
	(Make_Instance_Unit): Copy Generate_Code flag from the main unit
	to instance units.
	* lib-writ.adb (Write_ALI): Remove redundant condition;
	Generate_Code flag is always set for the main unit.
	* par-load.adb (Load): Set Generate_Code flag on the main unit's
	corresponding spec, if any.
2021-07-07 16:23:12 +00:00
Dmitriy Anisimkov
f3ff72939e [Ada] Add socket options to control keepalive on TCP connection
gcc/ada/

	* libgnat/g-socket.ads (Option_Name): Add Keep_Alive_Count,
	Keep_Alive_Idle, and Keep_Alive_Interval items to enumeration.
	(Option_Type): Add Keep_Alive_Count, Keep_Alive_Idle, and
	Keep_Alive_Interval alternatives to the case of discriminated
	record.
	* libgnat/g-socket.adb (Options): Add Keep_Alive_Count,
	Keep_Alive_Idle, and Keep_Alive_Interval to items enumerator to
	OS constant converter.
	(Set_Socket_Option): Process Keep_Alive_Count, Keep_Alive_Idle,
	and Keep_Alive_Interval socket options.
	(Get_Socket_Option): Idem.
2021-07-07 16:23:12 +00:00
Piotr Trojanek
f8776eeb36 [Ada] Tune discovery of No_Elaboration_Code restriction
gcc/ada/

	* lib-writ.adb (Write_ALI): Exit from loop after seeing first
	unit that violates No_Elaboration_Code restriction.
2021-07-07 16:23:12 +00:00
Piotr Trojanek
6feab95cbc [Ada] Simplify iteration over pending instantiations
gcc/ada/

	* inline.adb (Instantiate_Bodies): Fix white in declaration.
	(Remove_Dead_Instance): Change iteration from WHILE to FOR.
2021-07-07 16:23:11 +00:00
Bob Duff
738a0e8dd4 [Ada] Transient scope cleanup
gcc/ada/

	* checks.adb, exp_attr.adb, exp_ch4.adb, exp_ch6.adb,
	exp_ch9.adb, exp_disp.adb, exp_util.adb, inline.adb,
	sem_res.adb: Change all calls to Make_Unchecked_Type_Conversion
	to call Unchecked_Convert_To instead. This involves removing
	New_Occurrence_Of on the first parameter, because
	Unchecked_Convert_To expects a type entity, rather than the name
	of one. Also, removed calls to Relocate_Node, because
	Unchecked_Convert_To takes care of that.
	* sinfo.ads: Change comment to be worded more firmly.
2021-07-07 16:23:11 +00:00
Steve Baird
0dbe0e11eb [Ada] Unsynchronized access to a Boolean in tasking state
gcc/ada/

	* libgnarl/s-tassta.adb (Free_Task): Acquire the Task_Lock
	before, rather than after, querying the task's Terminated flag.
	Add a corresponding Task_Unlock call.
2021-07-07 16:23:10 +00:00
Martin Sebor
06357071d0 aarch64: Remove a vestigial %K [PR101363]
gcc/ChangeLog:
	PR target/101363
	* config/aarch64/aarch64.c (aarch64_simd_lane_bounds): Remove
	a stray %K from error_at() missed in r12-2088.
2021-07-07 08:56:19 -06:00
Christophe Lyon
e8073c0453 testsuite: gcc.dg/debug/btf/btf-bitfields-3.c remove -fno-short-enums PR debug/101321
After r12-2094, -fno-short-enums is non longer necessary.

2021-07-07  Christophe Lyon  <christophe.lyon@foss.st.com>

	PR debug/101321
	gcc/testsuite/
	* gcc.dg/debug/btf/btf-bitfields-3.c: Remove -fno-short-enums.
2021-07-07 12:44:36 +00:00
Richard Biener
005f31a037 tree-optimization/34195 - testcase for fixed vectorization
This adds a testcase for an old fixed PR.

2021-07-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/34195
	* gcc.dg/vect/pr34195.c: New testcase.
2021-07-07 13:48:26 +02:00
Richard Biener
9f34b780b0 tree-optimization/99728 - improve LIM for loops with aggregate copies
This improves LIM by recording aggregate copies for disambiguation
purposes instead of as UNANALYZABLE_MEM which will prevent any
invariant or store motion across it.  This allows four of the six
references in the loop of the testcase to be promoted.

2021-07-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99728
	* tree-ssa-loop-im.c (gather_mem_refs_stmt): Record
	aggregate copies.
	(mem_refs_may_alias_p): Add assert we handled aggregate
	copies elsewhere.
	(sm_seq_valid_bb): Give up when running into aggregate copies.
	(ref_indep_loop_p): Handle aggregate copies as never
	being invariant themselves but allow other refs to be
	disambiguated against them.
	(can_sm_ref_p): Do not try to apply store-motion to aggregate
	copies.

	* g++.dg/opt/pr99728.C: New testcase.
2021-07-07 13:48:26 +02:00