Commit graph

190170 commits

Author SHA1 Message Date
Pekka Seppänen
c841dc0a4d Adjust CPP_FOR_BUILD
Hi.

CPP/CPPFLAGS were changed by commit 84401ce5fb.  That commit uses CPP as a default for CPP_FOR_BUILD.  Unless CPP is defined, GNU make defaults CPP as `$(CC) -E'.  Given the context, this is now incorrect, since CC_FOR_BUILD should be used.

Fixes PR103011.

-- Pekka

gcc/Changelog:

	* configure: Regenerate.
	* configure.ac: For CPP_FOR_BUILD use $(CC_FOR_BUILD) -E instead of
	$(CPP).
2021-12-02 15:59:37 -05:00
Ilya Lipnitskiy
25abbb9249 [PATCH v2] configure: define TARGET_LIBC_GNUSTACK on musl
musl only uses PT_GNU_STACK to set default thread stack size and has no
executable stack support[0], so there is no reason not to emit the
.note.GNU-stack section on musl builds.

[0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u

gcc

	* configure: Regenerate.
	* configure.ac: Define TARGET_LIBC_GNUSTACK on musl.
2021-12-02 15:47:11 -05:00
Iain Sandoe
22a9824093 Darwin: Rewrite host PCH support [PR 55610].
We need to revise the PCH memory allocation scheme to enable
support for PIE on aarch64.  The rewrite uses a similar scheme
to the one used on Linux.

We attempt to identify VM segments for each arch/OS version that
are always available to the compiler (note this is not general,
it only needs to work for the cc1* exes).

If we cannot find the preferred segment we fall back to allowing
the kernel to supply one - this is more likely to fail when the
PCH read-in occurs (but that is trapped).

In doing this we obviate the need to unmap any part of the
compiler __DATA segment - thus fixing PR 55610.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	PR target/55610
	* config/host-darwin.c (TRY_EMPTY_VM_SPACE,
	SAFE_ALLOC_SIZE): New.
	(darwin_gt_pch_get_address): Rewrite to use nominated
	memory segments rather than part of the compiler __DATA
	segment.
	(darwin_gt_pch_use_address): Likewise.
2021-12-02 19:44:44 +00:00
Gerald Pfeifer
2835977f84 doc: Remove references to FreeBSD 1 and 2
FreeBSD 1 and FreeBSD 2, both still a.out, have been end of life for
over two decades and GCC has not been supporting them for ages, too,
so simply remove references.

gcc:
	* doc/install.texi (*-*-freebsd*): Remove references to
	FreeBSD 1 and FreeBSD 2.
2021-12-02 21:10:44 +02:00
David Malcolm
38a0ee2649 analyzer: add regression test for leak false +ve [PR103526]
gcc/testsuite/ChangeLog:
	PR analyzer/103526
	* gcc.dg/analyzer/pr103526.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-12-02 14:05:31 -05:00
Vladimir N. Makarov
cd47cd4b5e [PR103437] Make backup code for overflow conditional
Switch off long long variant overflow code by preprocessor if the
build compiler has __builtin_smul_overflow.

gcc/ChangeLog:
	PR rtl-optimization/103437
	* ira-color.c (setup_allocno_priorities): Switch off backup code
	for overflow if compiler has __builtin_smul_overflow.  Use <
	for comparison with -INT_MAX.
2021-12-02 12:39:05 -05:00
Jonathan Wakely
acf4fe96f1 libstdc++: Allow exception classes to move fully-dynamic strings
The move constructor for the fully-dynamic std::basic_string was not
noexcept until recently, so the std::logic_error and std::runtime_error
move constructors were defined to make non-throwing copies of their
string members, instead of potentially-throwing moves.

Now that move construction is always noexecpt, the exception classes can
always move the string. The fully-dynamic string move assignment was
always noexcept, so I don't know why I special-cased the move assignment
operators of the exception classes. That can be changed too.

libstdc++-v3/ChangeLog:

	* src/c++11/cow-stdexcept.cc [_GLIBCXX_FULY_DYNAMIC_STRING]
	(logic_error, runtime_error): Remove custom definitions.
2021-12-02 16:53:13 +00:00
Jonathan Wakely
e2e98f524f libstdc++: Remove broken std::allocator base classes [PR103340]
The bitmap_allocator, __mt_alloc and __pool_alloc extensions are no
longer suitable for use as the base class of std::allocator, because
they have not been updated to meet the C++20 requirements.  There is a
patch attached to PR 103340 which addresses that, but more work would be
needed to solve the linking errors that occur when the library is
configured to use them.

Using --enable-libstdcxx-allocator=bitmap wouldn't even bootstrap for
the past few years, and I can't find any gcc-testresults reports using
any of these allocators. This patch removes the configure option to use
these as the std::allocator base class. The allocators are still in the
tree and can be used directly, you just can't configure the library to
use one of them as the base class of std::allocator.

libstdc++-v3/ChangeLog:

	PR libstdc++/103340
	PR libstdc++/103400
	PR libstdc++/103381
	* acinclude.m4 (GLIBCXX_ENABLE_ALLOCATOR): Remove mt, bitmap
	and pool options.
	* configure: Regenerate.
	* config/allocator/bitmap_allocator_base.h: Removed.
	* config/allocator/mt_allocator_base.h: Removed.
	* config/allocator/pool_allocator_base.h: Removed.
	* doc/xml/manual/allocator.xml: Update.
	* doc/xml/manual/configure.xml: Update.
	* doc/xml/manual/evolution.xml: Document removal.
	* doc/xml/manual/mt_allocator.xml: Editorial tweaks.
	* doc/html/manual/*: Regenerate.
2021-12-02 16:46:28 +00:00
Jonathan Wakely
b5a568683f libstdc++: Restore unconditional atomic load in COW std::string
The relaxed load is already optimal, checking the __single_threaded
global before doing a non-atomic load isn't an optimization.

libstdc++-v3/ChangeLog:

	* include/bits/cow_string.h (basic_string::_M_is_leaked()):
	Revert change to check __is_single_threaded() before using
	atomic load.
2021-12-02 16:46:28 +00:00
Bill Schmidt
d08236359e rs6000: Enable new built-in support, with test suite and altivec.h changes
This patch enables the new built-in infastructure for the Power back end.
To avoid any patches causing regressions that would affect bisection, this is a
combined patch that also includes all the test suite changes and the necessary
modifications to altivec.h.  The patches included here are the following:

https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584638.html
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/578613.html
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584829.html
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/578614.html

The third of these four was broken up into multiple patches for review, but
effectively all pieces of it were accepted after an independent patch that
modified the error handling for overloaded builtins.

2021-12-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/altivec.h: Delete a number of #defines that are	now
	superfluous.  Alphabetize.  Include rs6000-vecdefines.h.  Include some
	synonyms.
	* config/rs6000/rs6000-builtin-new.def (CMPB): Flag as no32bit.
	(BPERMD): Flag as 32bit (needing special handling for 32-bit).
	(UNPACK_TD): Return unsigned long long instead of unsigned long.
	(GET_TEXASR): Return unsigned long instead of unsigned long long.
	(GET_TEXASRU): Likewise.
	(GET_TFHAR): Likewise.
	(GET_TFIAR): Likewise.
	(SET_TEXASR): Pass unsigned long instead of unsigned long long.
	(SET_TEXASRU): Likewise.
	(SET_TFHAR): Likewise.
	(SET_TFIAR): Likewise.
	(TABORTDC): Likewise.
	(TABORTDCI): Likewise.
	* config/rs6000/rs6000-call.c (rs6000_expand_new_builtin): Fix error
	handling for no32bit.  Add 32bit handling for RS6000_BIF_BPERMD.
	* config/rs6000/rs6000-gen-builtins.c (write_init_file): Initialize
	new_builtins_are_live to 1.

gcc/testsuite/
	* gcc.target/powerpc/bfp/scalar-extract-exp-2.c: Adjust expected error
	message.
	* gcc.target/powerpc/bfp/scalar-extract-sig-2.c: Likewise.
	* gcc.target/powerpc/bfp/scalar-insert-exp-2.c: Likewise.
	* gcc.target/powerpc/bfp/scalar-insert-exp-5.c: Likewise.
	* gcc.target/powerpc/bfp/scalar-insert-exp-8.c: Likewise.
	* gcc.target/powerpc/bfp/scalar-test-neg-2.c: Likewise.
	* gcc.target/powerpc/bfp/scalar-test-neg-3.c: Likewise.
	* gcc.target/powerpc/bfp/scalar-test-neg-5.c: Likewise.
	* gcc.target/powerpc/byte-in-set-2.c: Likewise.
	* gcc.target/powerpc/cmpb-2.c: Likewise.
	* gcc.target/powerpc/cmpb-3.c: Likewise.
	* gcc.target/powerpc/cmpb32-2.c: Likewise.
	* gcc.target/powerpc/crypto-builtin-2.c: Likewise.
	* gcc.target/powerpc/fold-vec-splat-floatdouble.c: Remove invalid
	test and adjust xxpermdi count.
	* gcc.target/powerpc/fold-vec-splat-longlong.c: Remove invalid
	tests and adjust instruction counts.
	* gcc.target/powerpc/fold-vec-splat-misc-invalid.c: Adjust expected
	error messages.
	* gcc.target/powerpc/int_128bit-runnable.c: Adjust instruction counts.
	* gcc.target/powerpc/pr80315-1.c: Adjust expected error message.
	* gcc.target/powerpc/pr80315-2.c: Likewise.
	* gcc.target/powerpc/pr80315-3.c: Likewise.
	* gcc.target/powerpc/pr80315-4.c: Likewise.
	* gcc.target/powerpc/pr88100.c: Likewise.
	* gcc.target/powerpc/pragma_misc9.c: Likewise.
	* gcc.target/powerpc/pragma_power8.c: Undef _RS6000_VECDEFINES_H.
	* gcc.target/powerpc/pragma_power9.c: Likewise.
	* gcc.target/powerpc/test_fpscr_drn_builtin_error.c: Adjust expected
	error messages.
	* gcc.target/powerpc/test_fpscr_rn_builtin_error.c: Likewise.
	* gcc.target/powerpc/vec-gnb-2.c: Likewise.
	* gcc.target/powerpc/vsu/vec-all-nez-7.c: Likewise.
	* gcc.target/powerpc/vsu/vec-any-eqz-7.c: Likewise.
	* gcc.target/powerpc/vsu/vec-cmpnez-7.c: Likewise.
	* gcc.target/powerpc/vsu/vec-cntlz-lsbb-2.c: Likewise.
	* gcc.target/powerpc/vsu/vec-cnttz-lsbb-2.c: Likewise.
	* gcc.target/powerpc/vsu/vec-xl-len-13.c: Likewise.
	* gcc.target/powerpc/vsu/vec-xst-len-12.c: Likewise.
2021-12-02 10:40:14 -06:00
Eric Botcazou
c9dd01314d [Ada] Add warning in comment about files copied from libgnat
gcc/ada/

	* gcc-interface/Make-lang.in (ADA_GENERATED_FILES): Add warning.
2021-12-02 16:26:32 +00:00
Marc Poulhiès
96d9ca7053 [Ada] Remove obsolete a-assert
gcc/ada/

	* gcc-interface/a-assert.ads, gcc-interface/a-assert.adb: Remove.
2021-12-02 16:26:32 +00:00
Eric Botcazou
31a6895f4c [Ada] Do not back-annotate maximum size for limited types
gcc/ada/

	* gcc-interface/decl.c (gnat_to_gnu_entity): Do not back-annotate a
	maximum size for the Esize of limited record and concurrent types.
2021-12-02 16:26:31 +00:00
Eric Botcazou
5a11ffadf5 [Ada] Fix packing for array component with discriminated part
gcc/ada/

	* gcc-interface/gigi.h (aggregate_type_contains_array_p): Delete.
	(type_has_variable_size): Declare.
	* gcc-interface/decl.c (adjust_packed): Return 0 only if the field
	type is an array with variable size.
	* gcc-interface/utils.c (aggregate_type_contains_array_p): Make
	static and remove SELF_REFERENTIAL parameter.
	(type_has_variable_size): Make public.
	(create_field_decl): Adjust call to aggregate_type_contains_array_p.
2021-12-02 16:26:31 +00:00
Justin Squirek
9e10b7002a [Ada] Invalid memory access on finalization of class-wide type
gcc/ada/

	* gcc-interface/decl.c (gnat_to_gnu_entity): Skip normal
	processing for Itypes that are E_Class_Wide_Subtype with
	Equivalent_Type set.
2021-12-02 16:26:30 +00:00
Eric Botcazou
298339effd [Ada] Fix oversight in minor cleanup
gcc/ada/

	* gcc-interface/trans.c (Call_to_gnu): Rename GNAT_NAME variable
	into GNAT_SUBPROG to avoid later shadowing.
2021-12-02 16:26:30 +00:00
Yannick Moy
b5e57389c5 [Ada] Proof of System.Arith_32 for double arithmetic on 32bits
gcc/ada/

	* libgnat/s-arit32.adb: Add ghost instances and lemmas.
	(Scaled_Divide32): Add ghost code to prove. Minor code
	modification to return early in error when divisor is zero.
	* libgnat/s-arit32.ads: Add ghost instances and utilities.
	(Scaled_Divide32): Add contract.
2021-12-02 16:26:30 +00:00
Eric Botcazou
544b30f81e [Ada] Reset internal flags for -gnatD and -gnatG
gcc/ada/

	* sprint.adb (Source_Dump): Set both Print_Generated_Code and
	Debug_Generated_Code to False at the end.
2021-12-02 16:26:30 +00:00
Marc Poulhiès
5a35fe64c7 [Ada] Fix obsolete array aggregate warning being triggered by expanded code
gcc/ada/

	* sem_aggr.adb (Resolve_Array_Aggregate): Filter out nodes not
	coming from source before emitting the warning.
2021-12-02 16:26:29 +00:00
Yannick Moy
b3f89a4510 [Ada] Amend proof of System.Arith_Double to remove justifications
gcc/ada/

	* libgnat/s-aridou.adb (Log_Single_Size, Big_0): New ghost
	constants.
	(Lemma_Mult_Non_Negative, Lemma_Mult_Non_Positive,
	Lemma_Not_In_Range_Big2xx64): New lemmas on big integers.
	(Double_Divide): Remove justifications. Amend for that local
	lemma Prove_Overflow_Case.
	(Scaled_Divide): Remove justifications. Insert for that local
	lemmas Prove_Negative_Dividend, Prove_Positive_Dividend and
	Prove_Q_Too_Big, and amend local lemma Prove_Overflow.  To prove
	the loop invariant on (Shift mod 2 = 0), introduce local ghost
	variable Iter to count loop iterations, and relate its value to
	the value of Shift through Log_Single_Size, with the help of
	local lemma Prove_Power. Deal with proof regression by adding
	new local lemma Prove_First_Iteration and local ghost variable
	D123.
	* libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64): Remove
	unnecessary Pure_Function on function as package is Pure.
2021-12-02 16:26:29 +00:00
Yannick Moy
ce79e7e24a [Ada] Add pragma Annotate for CodePeer analysis
gcc/ada/

	* libgnat/s-widthi.adb: Add pragma Annotate.
2021-12-02 16:26:29 +00:00
Yannick Moy
3a54dfa801 [Ada] Proof of support units for 'Width on signed integers
gcc/ada/

	* libgnat/s-widint.ads: Mark in SPARK.
	* libgnat/s-widlli.ads: Likewise.
	* libgnat/s-widllli.ads: Likewise.
	* libgnat/s-widlllu.ads: Likewise.
	* libgnat/s-widllu.ads: Disable ghost/contract.
	* libgnat/s-widthi.adb: Replicate and adapt the proof from
	s-widthu.adb.
	* libgnat/s-widthi.ads: Add minimal postcondition.
	* libgnat/s-widthu.adb: Fix comments in the modular case.
	* libgnat/s-widthu.ads: Add minimal postcondition.
	* libgnat/s-widuns.ads: Disable ghost/contract.
2021-12-02 16:26:28 +00:00
Piotr Trojanek
167be0845e [Ada] Cleanup detection of suspension objects
gcc/ada/

	* rtsfind.ads (RE_Id, RE_Unit_Table): Add RE_Suspension_Object.
	* sem_util.adb (Is_Descendant_Of_Suspension_Object): Use Is_RTE.
	(Is_Suspension_Object): Remove body.
	* sem_util.ads (Is_Suspension_Object): Remove spec.
	* snames.ads-tmpl (Name_Suspension_Object): Remove, now
	unreferenced.
2021-12-02 16:26:28 +00:00
Piotr Trojanek
e4b5ab0194 [Ada] Cleanup insertion of single freezing actions
gcc/ada/

	* exp_util.adb (Append_Freeze_Action): Tune whitespace to make
	the code look similar to Append_Freeze_Actions, which takes a
	List_Id.
	* sem_ch6.adb (Analyze_Return_Type): Cleanup with
	Append_Freeze_Action.
	* exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body): Likewise.
	* sem_ch3.adb (Build_Access_Subprogram_Wrapper): Likewise.
	* contracts.adb (Add_Indirect_Call_Wrapper): Remove extra call
	to Ensure_Freeze_Node.
	(Add_Call_Helper): Likewise.
	* freeze.adb (Check_Inherited_Conditions): Likewise.
	(Attribute_Renaming): Likewise.
	* sem_ch8.adb: Likewise.
2021-12-02 16:26:28 +00:00
Piotr Trojanek
ec9c3bd5d2 [Ada] Cleanups related to expansion of dispatching primitives
gcc/ada/

	* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst
	(No_Dispatching_Calls): Fix whitespace in example code.
	* gnat_rm.texi: Regenerate.
	* exp_ch13.adb (Expand_N_Freeze_Entity): Replace low-level
	membership test with a high-level wrapper.
	* exp_ch3.adb (Expand_Freeze_Record_Type): Remove unnecessary
	initialization of list of wrapper declarations and unnecessary
	guard for list of their bodies (if no bodies are created then
	Append_Freeze_Actions is a no-op).
2021-12-02 16:26:27 +00:00
Marc Poulhiès
b045f2f220 [Ada] Use bracket aggregates in Ada2022
gcc/ada/

	* exp_imgv.adb (Append_Table_To): Add new parameter to
	Make_Aggregate call.
	* gen_il-fields.ads (Opt_Field_Enum):
	Add Is_Parenthesis_Aggregate and Is_Enum_Array_Aggregate.
	* gen_il-gen-gen_nodes.adb (Union): Add Is_Enum_Array_Aggregate
	and Is_Parenthesis_Aggregate field to N_Aggregate.
	* libgnarl/s-interr.adb (User_Handler, User_Entry, Blocked)
	(Ignored, Last_Unblocker, Server_ID): Likewise.
	* libgnarl/s-intman.ads (Keep_Unmasked, Reserve): Likewise.
	* libgnarl/s-intman__posix.adb (Exception_Interrupts)
	(Initialize): Likewise.
	* libgnarl/s-mudido__affinity.adb (Create): Likewise.
	* libgnarl/s-osinte__linux.ads (Unmasked, Reserved): Likewise.
	* libgnarl/s-taprop__linux.adb (Create_Task, Set_Task_Affinity)
	* libgnarl/s-tasdeb.adb (Trace_On): Likewise.
	* libgnarl/s-tasdeb.ads (Known_Tasks): Likewise.
	* libgnarl/s-tasinf__linux.ads (Any_CPU, No_CPU): Likewise.
	* libgnarl/s-taskin.adb (Initialize_ATCB): Likewise.
	* libgnarl/s-taskin.ads (Ada_Task_Control_Block): Likewise.
	* libgnarl/s-tasren.adb (Default_Treatment)
	(New_State): Likewise.
	* libgnarl/s-tassta.adb (Trace_Unhandled_Exception_In_Task):
	Likewise.
	* libgnarl/s-tataat.adb (Index_Array): Likewise.
	* libgnarl/s-tpobop.adb (New_State): Likewise.
	* libgnat/a-calend.adb (Cumulative_Days_Before_Month)
	(Leap_Second_Times): Likewise.
	* libgnat/a-calend.ads (Days_In_Month): Likewise.
	* libgnat/a-cfinve.adb (Insert): Likewise.
	* libgnat/a-chahan.adb (Char_Map): Likewise.
	* libgnat/a-chtgbo.adb (Clear): Likewise.
	* libgnat/a-cobove.adb ("&", Insert, To_Vector): Likewise.
	* libgnat/a-cofove.adb (Insert, To_Vector): Likewise.
	* libgnat/a-cohata.ads (Hash_Table_Type): Likewise.
	* libgnat/a-coinve.adb (Merge, Insert, Insert_Space): Likewise.
	* libgnat/a-convec.adb (Insert, To_Vector): Likewise.
	* libgnat/a-coprnu.ads (Primes): Likewise.
	* libgnat/a-direct.adb (Empty_String): Use regular "" instead
	of aggregate.
	(Start_Search_Internal, Name_Case_Equivalence, Search)
	(Start_Search, Start_Search_Internal): Use bracket for
	aggregate.
	* libgnat/a-direct.ads (Start_Search,Search): Likewise.
	* libgnat/a-direio.adb (Zeroes): Likewise.
	* libgnat/a-nbnbre.adb (Leading_Padding, Trailing_Padding)
	(Numerator_Image): Likewise.
	* libgnat/a-ngrear.adb (Jacobi): Likewise.
	* libgnat/a-stbubo.adb (Get_UTF_8): Likewise.
	* libgnat/a-stbufo.adb (Put): Likewise.
	* libgnat/a-stbuun.adb (Get_UTF_8): Likewise.
	* libgnat/a-stbuut.adb (Put_7bit, Put_Character)
	(Put_Wide_Character, Put_Wide_Wide_Character): Likewise.
	* libgnat/a-stmaco.ads (Control_Set,Graphic_Set,Letter_Set)
	(Lower_Set, Upper_Set, Basic_Set, Decimal_Digit_Set)
	(Hexadecimal_Digit_Set, Alphanumeric_Set, Special_Set)
	(ISO_646_Set): Likewise.
	* libgnat/a-strbou.ads (Insert, Tail, "*", Replicate)
	(Null_Bounded_String): Likewise.
	* libgnat/a-strfix.ads (Head, Tail): Likewise.
	* libgnat/a-strmap.adb (To_Domain, Lemma_Is_Sorted): Likewise.
	* libgnat/a-strmap.ads (Null_Set): Likewise.
	* libgnat/a-strsup.adb (Super_Head, Super_Replicate)
	(Super_Tail): Likewise.
	* libgnat/a-strsup.ads (Super_Head, Super_Tail, Times)
	(Super_Replicate): Likewise.
	* libgnat/a-sttebu.adb (Put_UTF8, Wide_Put_UTF_16): Likewise.
	* libgnat/a-stuten.ads (BOM_16): Likewise.
	* libgnat/a-stwibo.ads (Null_Bounded_Wide_String): Likewise.
	* libgnat/a-stwima.ads (Null_Range): Likewise.
	* libgnat/a-stwisu.adb (Super_Head, Super_Replicate)
	(Super_Tail): Likewise.
	* libgnat/a-stzbou.ads
	(Null_Bounded_Wide_Wide_String): Likewise.
	* libgnat/a-stzmap.ads (Null_Range): Likewise.
	* libgnat/a-stzsup.adb (Super_Head, Super_Replicate)
	(Super_Tail, Super_Trim): Likewise.
	* libgnat/a-swmwco.ads (Control_Ranges, Graphic_Ranges)
	(Letter_Ranges, Lower_Ranges, Upeer_Ranges, Basic_Ranges)
	(Decimal_Digit_Ranges, Hexadecimal_Digit_Ranges)
	(Alphanumeric_Ranges, Special_Graphic_Ranges, ISO_646_Ranges)
	(Character_Ranges, Lower_Case_Mapping, Upper_Case_Mapping)
	(Basic_Mapping): Likewise.
	* libgnat/a-szmzco.ads (Control_Ranges, Graphic_Ranges)
	(Letter_Ranges, Lower_Ranges, Upeer_Ranges, Basic_Ranges)
	(Decimal_Digit_Ranges, Hexadecimal_Digit_Ranges)
	(Alphanumeric_Ranges, Special_Graphic_Ranges, ISO_646_Ranges)
	(Character_Ranges, Lower_Case_Mapping, Upper_Case_Mapping)
	(Basic_Mapping): Likewise.
	* libgnat/a-teioed.adb (Format_Number): Likewise.
	* libgnat/a-wtedit.adb (Format_Number): Likewise.
	* libgnat/a-ztedit.adb (Format_Number): Likewise.
	* libgnat/g-arrspl.adb (Separators): Likewise.
	* libgnat/g-catiio.adb (Month_Name_To_Number): Likewise.
	* libgnat/g-cgideb.adb (NL, Title): Likewise.
	* libgnat/g-comlin.adb (Internal_Initialize_Option_Scan)
	(Display_Section_Help): Likewise.
	* libgnat/g-comlin.ads (Opt_Parser_Data): Likewise.
	* libgnat/g-debpoo.adb (Set_Dead_Beef, Dump): Likewise.
	* libgnat/g-expect.adb (Expect, Has_Process, Send): Likewise.
	* libgnat/g-forstr.adb ("+", Get_Formatted): Likewise.
	* libgnat/g-memdum.adb (Dump): Likewise.
	* libgnat/g-rannum.adb (Image): Likewise.
	* libgnat/g-sechas.adb (Final, HMAC_Initial_Context): Likewise.
	* libgnat/g-sehamd.ads (Initial_State): Likewise.
	* libgnat/g-sehash.ads (Initial_State): Likewise.
	* libgnat/g-sercom.ads (Data_Rate_Value): Likewise.
	* libgnat/g-sercom__linux.adb (C_Data_Rate, C_Bits, C_Stop_Bits)
	(C_Parity): Likewise.
	* libgnat/g-shsh32.ads (K, Transform): Likewise.
	* libgnat/g-shsh64.ads (K, Transform): Likewise.
	* libgnat/g-socket.adb (Levels, Modes, Shutmodes, Requests)
	(Options, Flags, Get_Name_Info, Image): Likewise.
	* libgnat/g-socket.ads (Inet_Addr_Bytes_Length, Inet_Addr_Type)
	(IPv4_To_IPv6_Prefix, Any_Inet_Addr, Any_Inet6_Addr)
	(No_Inet_Addr, Broadcast_Inet_Addr, Loopback_Inet_Addr)
	(Loopback_Inet6_Addr, Unspecified_Group_Inet_Addr)
	(All_Hosts_Group_Inet_Addr, All_Routers_Group_Inet_Addr)
	(Unspecified_Group_Inet6_Addr, All_Hosts_Group_Inet6_Addr)
	(All_Routers_Group_Inet6_Addr):	Likewise.
	* libgnat/g-socpol.adb (To_C, Status, Get_Events): Likewise.
	* libgnat/g-socpol.ads (Input_Event, Output_Event, Both_Event)
	(Error_Event): Likewise.
	* libgnat/g-sothco.ads (Families, Lengths, Sockaddr): Likewise.
	* libgnat/g-spipat.adb (OK_For_Simple_Arbno): Likewise.
	* libgnat/i-cobol.ads (Ada_To_COBOL, COBOL_To_Ada): Likewise.
	* libgnat/i-pacdec.adb (Packed_Byte): Likewise.
	* libgnat/i-pacdec.ads (Packed_Size): Likewise.
	* libgnat/s-bitops.adb (Masks): Likewise.
	* libgnat/s-crc32.adb (Table): Likewise.
	* libgnat/s-gearop.adb (Unit_Matrix, Unit_Vector): Likewise.
	* libgnat/s-genbig.adb (Out_data, Zero_Data, Big_Exp, Big_Mul)
	(To_Bignum, To_String, Image, Leading_Padding): Likewise.
	* libgnat/s-htable.adb (Reset): Likewise.
	* libgnat/s-imgcha.adb (C0, C1): Likewise.
	* libgnat/s-powflt.ads (Powten): Likewise.
	* libgnat/s-powlfl.ads (Powten): Likewise.
	* libgnat/s-powllf.ads (Powten): Likewise.
	* libgnat/s-rannum.adb (Matrix_A, Random_Float_Template, Image):
	Likewise.
	* libgnat/s-rannum.ads (Generator): Likewise.
	* libgnat/s-regexp.adb (Compile,Create_Primary_Table)
	(Create_Primary_Table_Glob, Create_Secondary_Table, Compile):
	Likewise.
	* libgnat/s-regpat.adb (Bit_Conversion, Set, Dump_Until)
	(Dump_Current, Dump_Error, Try, Reset_Class): Likewise.
	* libgnat/s-regpat.ads (Pattern_Matcher, Never_Match): Likewise.
	* libgnat/s-scaval__128.adb (Initialize): Likewise.
	* libgnat/s-statxd.adb (Fields, W_F, W_LF)
	(W_LLF, W_SF): Likewise.
	* libgnat/s-stausa.adb (Initialize, Initialize_Analyzer)
	(Output_Results): Likewise.
	* libgnat/s-strops.adb (Str_Concat_SC): Likewise.
	* libgnat/s-valrea.adb (Maxexp32, Maxexp64, Maxexp80): Likewise.
	* libgnat/s-wchcon.ads (WC_Encoding_Letters)
	(WC_Longest_Sequences): Likewise.
	* par-ch4.adb (P_Aggregate_Or_Paren_Expr): Set
	Is_Parenthesis_Aggregate when creating a N_Aggregate using
	parenthesis.
	* scng.adb (Scan): Lower version needed for bracket syntax from
	Extensions to Ada2022.
	* sem_aggr.adb (Resolve_Aggregate): Raise error for container
	aggregate using parenthesis instead of bracket.
	(Resolve_Array_Aggregate): Raise warning for aggregate using
	parenthesis in Ada2022 with obsolescent warning enabled and not
	in GNAT mode.
	* sem_util.ads (Check_Ambiguous_Aggregate): Typo fix in comment.
2021-12-02 16:26:27 +00:00
Piotr Trojanek
aa937f2cdb [Ada] Inline all calls in Ada.Task_Identification
gcc/ada/

	* libgnarl/a-taside.ads (Activation_Is_Complete): Add pragma
	Inline.
2021-12-02 16:26:26 +00:00
Eric Botcazou
8decef4000 [Ada] Enhance freezing code for instantiations
gcc/ada/

	* sem_ch12.adb (Freeze_Package_Instance): Consistently consider
	the freeze node of the parent and use large inequality for
	Slocs.
	(Freeze_Subprogram_Instance): Likewise.
	(Insert_Freeze_Node_For_Instance): For an instance in a package
	spec with no source body that immediately follows, consider the
	body of the package for the placement of the freeze node and go
	to the outer level if there is no such body.
2021-12-02 16:26:26 +00:00
Piotr Trojanek
eca89ac6e7 [Ada] Enable expansion of dispatching equality for GNATprove
gcc/ada/

	* exp_ch13.ads (Expand_N_Freeze_Entity): Add note about a SPARK
	twin.
	* exp_ch3.ads (Freeze_Type): Likewise.
	* exp_spark.adb (Expand_SPARK_N_Freeze_Entity): Mimic what is
	done in Freeze_Entity.
	(SPARK_Freeze_Type): Mimic what is done in Freeze_Type; add call
	to Make_Predefined_Primitive_Eq_Spec.
2021-12-02 16:26:24 +00:00
Piotr Trojanek
5ae5ba7ab1 [Ada] Separate building of equality from other dispatching routines
gcc/ada/

	* exp_ch3.adb (Make_Predefined_Primitive_Specs): Move code for
	spec of dispatching equality.
	(Predefined_Primitive_Bodies): Move code for body if dispatching
	equality.
	(Make_Predefined_Primitive_Eq_Spec): Separated code for spec of
	dispatching equality.
	(Predefined_Primitive_Eq_Body): Separated code for body of
	dispatching equality.
	* exp_ch3.ads: Update.
2021-12-02 16:26:24 +00:00
Piotr Trojanek
a83c4eea27 [Ada] Split spec and body of expression function with Subprogram_Variant
gcc/ada/

	* libgnat/s-valuti.ads (Scan_Natural_Ghost): Split body from
	spec and put it into private part, so that GNATprove can pick it
	both when analysing the unit and its clients.
2021-12-02 16:26:23 +00:00
Piotr Trojanek
d43fbe0151 [Ada] Remove extra space after assignment symbol
gcc/ada/

	* exp_aggr.adb, exp_ch6.adb, par-ch4.adb, sem_ch13.adb: Remove
	extra space after ":=" symbol.
	* gen_il-gen.adb: Likewise; add missing headerbox.
2021-12-02 16:26:23 +00:00
Richard Kenner
eccc7c8cbf [Ada] Don't allow entry in implicit with chain to be ghost
gcc/ada/

	* rtsfind.adb (Maybe_Add_With): Ensure that the added "with" is
	never marked as ignored ghost code.
2021-12-02 16:26:23 +00:00
Piotr Trojanek
ea7f9e0530 [Ada] Simplify iteration over record components
gcc/ada/

	* freeze.adb (Freeze_Entity): Replace First_Entity/Next_Entity
	with First_Component/Next_Component; remove condition with Ekind
	equal to E_Component.
	* sem_ch13.adb (Check_Record_Representation_Clause): Likewise
	for component-or-discriminant.
	* sem_util.adb (Is_Fully_Initialized_Type): Likewise; rename Ent
	to a more specific Comp.
	* sem_warn.adb (Check_References): Likewise.
2021-12-02 16:26:22 +00:00
Piotr Trojanek
1fde9333dc [Ada] Refactor nested loops in warning on unassigned out parameter
gcc/ada/

	* sem_warn.adb (Warn_On_Unassigned_Out_Parameter): Move inner
	loop at the beginning of subprogram, so it is executed only
	once; fix order in the "add an ad hoc" phrase.
2021-12-02 16:26:22 +00:00
Piotr Trojanek
e2e877266d [Ada] Remove duplicated condition in warnings about read-before-write
gcc/ada/

	* sem_warn.adb (Check_References): Remove redundant condition.
2021-12-02 16:26:22 +00:00
Doug Rupp
28acd56a7a [Ada] vx7r2cert/light-tasking-rtp: undefined refs on ppc/ppc64
gcc/ada/

	* vxworks7-cert-rtp-link__ppcXX.spec: New file.
	* Makefile.rtl: Use it.
2021-12-02 16:26:21 +00:00
Yannick Moy
76bbe3972b [Ada] Proof of Interfaces.C with SPARK
gcc/ada/

	* libgnat/i-c.adb: Add ghost code.
	(C_Length_Ghost): New ghost functions to query the C length of a
	string.
	(To_Ada): Insert constant Count_Cst where needed to comply with
	SPARK.  Homogeneize code between variants for char, wchar_t,
	char16_t and char32_t. Use char16_nul and char32_nul
	systematically instead of their value. Fix the type of index To
	to be Integer instead of Positive, to avoid a possible range
	check failure on an empty Target. Insert an exit statement to
	avoid a possible overflow failure when the last index in Target
	is Natural'Last (possibly on a small string as well).
	* libgnat/i-c.ads: Add contracts.
	(C_Length_Ghost): New ghost functions to query the C length of a
	string.
	* libgnat/s-os_lib.adb: Remove pragma Compiler_Unit_Warning
	causing a spurious error during compilation of GNAT, as this
	pragma is not needed anymore now that we bootstrap (stage1) with
	the base compiler runtime.
2021-12-02 16:26:20 +00:00
Piotr Trojanek
7e650bf84b [Ada] Add contract to Ada.Task_Identification.Activation_Is_Complete
gcc/ada/

	* libgnarl/a-taside.ads (Activation_Is_Complete): Add
	precondition.
2021-12-02 16:26:20 +00:00
Piotr Trojanek
45be761038 [Ada] More intuitive names in sanity-checking of derived types
gcc/ada/

	* sem_ch3.adb (Check_Derived_Type): Rename local variables; fix
	style in comment.
2021-12-02 16:26:20 +00:00
Yannick Moy
40b180995a [Ada] Proof of System.Val_Util utilities for 'Value support
gcc/ada/

	* libgnat/s-valboo.adb (First_Non_Space_Ghost): Move to
	utilities.
	(Value_Boolean): Prefix call to First_Non_Space_Ghost.
	* libgnat/s-valboo.ads (First_Non_Space_Ghost): Move to
	utilities.
	(Is_Boolean_Image_Ghost, Value_Boolean): Prefix call to
	First_Non_Space_Ghost.
	* libgnat/s-valuer.adb (Scan_Raw_Real): Adapt to change of
	function Scan_Exponent to procedure.
	* libgnat/s-valueu.adb (Scan_Raw_Unsigned): Adapt to change of
	function Scan_Exponent to procedure.
	* libgnat/s-valuti.adb (First_Non_Space_Ghost): Function moved
	here.
	(Last_Number_Ghost): New ghost query function.
	(Scan_Exponent): Change function with side-effects into
	procedure, to mark in SPARK. Prove procedure wrt contract.
	Change type of local P to avoid possible range check failure (it
	is not known whether this can be activated by callers).
	(Scan_Plus_Sign, Scan_Sign): Change type of local P to avoid
	possible range check failure. Add loop invariants and assertions
	for proof.
	(Scan_Trailing_Blanks): Add loop invariant.
	(Scan_Underscore): Remove SPARK_Mode Off.
	* libgnat/s-valuti.ads (First_Non_Space_Ghost): Function moved
	here.
	(Last_Number_Ghost, Only_Number_Ghost, Is_Natural_Format_Ghost,
	Scan_Natural_Ghost): New ghost query functions.
	(Scan_Plus_Sign, Scan_Sign, Scan_Exponent, Scan_Trailing_Blanks,
	Scan_Underscore): Add functional contracts.
2021-12-02 16:26:19 +00:00
Yannick Moy
6df3ec0e7e [Ada] Proof of Boolean'Image and Boolean'Value
gcc/ada/

	* libgnat/s-imgboo.adb: Mark in SPARK.
	* libgnat/s-imgboo.ads: Mark in SPARK. Change from Pure to
	Preelaborate unit in order to be able to depend on
	System.Val_Bool.
	(Image_Boolean): Functionally specify the result of the
	procedure by calling System.Val_Bool.Value_Boolean on the
	result.
	* libgnat/s-valboo.adb: Mark in SPARK.
	(First_Non_Space_Ghost): New ghost function.
	(Value_Boolean): Change type of L and F to avoid possible range
	check failure on empty Str.
	* libgnat/s-valboo.ads: Mark in SPARK. Duplicate with-clause
	from body in the spec to be able to call
	System.Val_Util.Only_Space_Ghost in the contract.
	(First_Non_Space_Ghost): New ghost function computing the first
	non-space character in a string.
	(Is_Boolean_Image_Ghost): New ghost function computing whether a
	string is the image of a boolean value.
	(Value_Boolean): Add in precondition the conditions to avoid
	raising Constraint_Error. This precondition is never executed,
	and only used in proof, thanks to the use of pragma
	Assertion_Policy. Given that precondition, the postcondition can
	simply check the first non-space character to decide whether
	True or False is read.
	* libgnat/s-valuti.adb: Mark in SPARK, but use SPARK_Mode Off on
	all subprograms not yet proved.
	(Bad_Value): Annotate expected exception.
	(Normalize_String): Rewrite to avoid possible overflow when
	incrementing F in the first loop. Add loop invariants.
	* libgnat/s-valuti.ads: Mark in SPARK.
	(Bad_Value): Add Depends contract to avoid warning on unused S.
	(Only_Space_Ghost): New ghost function to query if string has
	only space in the specified range.
	(Normalize_String): Add functional contract.
	(Scan_Exponent): Mark spec as not in SPARK as this function has
	side-effects.
2021-12-02 16:26:19 +00:00
Pascal Obry
261d367a10 [Ada] Fix possible memory corruption for hostnames longer than 1024 bytes
gcc/ada/

	* libgnat/g-socket.ads (Max_Name_Length): Initialize with
	NI_MAXHOST.
2021-12-02 16:26:18 +00:00
Pascal Obry
0ef5185a15 [Ada] Minor style fix (no dot on single line comment)
gcc/ada/

	* libgnat/g-socket.ads: Minor style fix.
2021-12-02 16:26:17 +00:00
Vladimir N. Makarov
7d02c8bf75 [PR103437] Use long long multiplication as backup for overflow processing
__builtin_smul_overflow can be unavailable for some C++ compilers.
Add long long multiplication as backup for overflow processing.

gcc/ChangeLog:
	PR rtl-optimization/103437
	* ira-color.c (setup_allocno_priorities): Use long long
	multiplication as backup for overflow processing.
2021-12-02 11:00:56 -05:00
Iain Buclaw
a27940feff libphobos: Push all callee-save registers on the stack before GC scan on ARM
This is the library fix for PR103520 that also prevents the garbage
collector from releasing live memory.  However this requires that the
host compiler has been patched with this fix, so the GC will remain
disabled in the D front-end for now until enough time has passed for
this to have trickled down into enough releases.

libphobos/ChangeLog:

	* libdruntime/core/thread/osthread.d (callWithStackShell): Push all
	callee-save registers on the stack for AArch64 and ARM.
2021-12-02 15:41:27 +01:00
Tamar Christina
9b8830b6f3 AArch64: Optimize right shift rounding narrowing
This optimizes right shift rounding narrow instructions to
rounding add narrow high where one vector is 0 when the shift amount is half
that of the original input type.

i.e.

uint32x4_t foo (uint64x2_t a, uint64x2_t b)
{
  return vrshrn_high_n_u64 (vrshrn_n_u64 (a, 32), b, 32);
}

now generates:

foo:
        movi    v3.4s, 0
        raddhn  v0.2s, v2.2d, v3.2d
        raddhn2 v0.4s, v2.2d, v3.2d

instead of:

foo:
        rshrn   v0.2s, v0.2d, 32
        rshrn2  v0.4s, v1.2d, 32
        ret

On Arm cores this is an improvement in both latency and throughput.
Because a vector zero is needed I created a new method
aarch64_gen_shareable_zero that creates zeros using V4SI and then takes a subreg
of the zero to the desired type.  This allows CSE to share all the zero
constants.

gcc/ChangeLog:

	* config/aarch64/aarch64-protos.h (aarch64_gen_shareable_zero): New.
	* config/aarch64/aarch64-simd.md (aarch64_rshrn<mode>,
	aarch64_rshrn2<mode>): Generate rounding half-ing add when appropriate.
	* config/aarch64/aarch64.c (aarch64_gen_shareable_zero): New.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/advsimd-intrinsics/shrn-1.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/shrn-2.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/shrn-3.c: New test.
	* gcc.target/aarch64/advsimd-intrinsics/shrn-4.c: New test.
2021-12-02 14:39:43 +00:00
Vladimir N. Makarov
d47393d0b4 [PR103437] Process multiplication overflow in priority calculation for allocno assignments
We process overflows in cost calculations but for huge functions
priority calculation can overflow as priority can be bigger the cost
used for it.  The patch fixes the problem.

gcc/ChangeLog:

	PR rtl-optimization/103437
	* ira-color.c (setup_allocno_priorities): Process multiplication
	overflow.
2021-12-02 08:51:53 -05:00
Tamar Christina
7d6c20c06c testsuite: make bic-bitmask-18.c test more precise [PR103479]
This updates the testcase bic-bitmask-18.c to seach for " = 0;" as an expression
so it doesn't match any other partial expressions.

gcc/testsuite/ChangeLog:

	PR testsuite/103479
	* gcc.dg/bic-bitmask-18.c: Update regexpr to expect = 0;.
2021-12-02 13:30:08 +00:00
Marek Polacek
9af081003f c++: Fix bogus error with __integer_pack [PR94490]
Here we issue a bogus:

error: '(0 ? fake_tuple_size_v<int> : fake_tuple_size_v<int>)' is not a constant expression

because cxx_constant_value in expand_integer_pack gets

*(0 ? VIEW_CONVERT_EXPR<const int>(fake_tuple_size_v) : VIEW_CONVERT_EXPR<const int>(fake_tuple_size_v))

which is a REFERENCE_REF_P and we evaluate its operand to 3, so we end
up with *3 and that fails.  Sounds like we need to get rid of the
REFERENCE_REF_P then.  That is what tsubst_copy_and_build/INDIRECT_REF
will do:

        if (REFERENCE_REF_P (t))
          {
            /* A type conversion to reference type will be enclosed in
               such an indirect ref, but the substitution of the cast
               will have also added such an indirect ref.  */
            r = convert_from_reference (r);
          }

so I think it's reasonable to call instantiate_non_dependent_expr_sfinae.

	PR c++/94490

gcc/cp/ChangeLog:

	* pt.c (expand_integer_pack): Call
	instantiate_non_dependent_expr_sfinae.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/integer-pack5.C: New test.
2021-12-02 08:21:24 -05:00