180622 Commits

Author SHA1 Message Date
Piotr Trojanek
4270e94541 [Ada] Fix analysis of iterated component expression with null range
gcc/ada/

	* exp_aggr.adb (Gen_Loop): Analyze copy of the expression in the
	scope of the implicit loop with name of the index parameter
	visible.
2020-10-21 03:22:49 -04:00
Eric Botcazou
a5476382a7 [Ada] Basic support for 128-bit types
gcc/ada/

	* Makefile.rtl (GNATRTL_128BIT_PAIRS): New variable.
	(GNATRTL_128BIT_OBJS): Likewise.
	(Windows): In 64-bit mode, add the former to LIBGNAT_TARGET_PAIRS and
	the latter to EXTRA_GNATRTL_NONTASKING_OBJS.
	(x86_64/linux): Likewise, but unconditionally.
	(GNATRTL_NONTASKING_OBJS): Add s-aridou, s-exponn, s-expont,
	s-exponu.
	* ada_get_targ.adb (Get_Long_Long_Long_Size): New function.
	* checks.adb (Apply_Arithmetic_Overflow_Strict): Use Integer_Type_For
	to find an appropriate integer type; if it does not exist and the max
	integer size is larger than 64, use the 128-bit arithmetic routines.
	* cstand.adb (Create_Standard): Build Standard_Long_Long_Long_Integer
	and its base type.  Use it for Etype of Any_Integer, Any_Modular and
	Any_Numeric.  Use its size for Build Standard_Long_Long_Long_Unsigned
	and Universal_Integer.
	(Print_Standard): Print Long_Long_Long_Integer.
	* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Mod>: Adjust
	comment.
	* exp_ch3.adb (Simple_Init_Initialize_Scalars_Type): Deal with 128-bit
	types.
	* exp_ch4.adb (Expand_Array_Comparison): Likewise.
	(Expand_N_Op_Expon): Likewise.
	(Narrow_Large_Operation): Likewise.
	* exp_dbug.adb (Bounds_Match_Size): Handle 128-bit size.
	* exp_fixd.adb (Build_Double_Divide_Code): Use RE_Double_Divide64.
	* exp_intr.adb (Expand_Binary_Operator_Call): Handle 128-bit size.
	* exp_pakd.ads (E_Array): Extend range to 127.
	(Bits_Id): Fill in up to 127.
	(Get_Id): Likewise.
	(GetU_Id): Likewise.
	(Set_Id): Likewise.
	(SetU_Id): Likewise.
	* exp_pakd.adb (Revert_Storage_Order): Handle 128-bit size.
	* exp_util.adb (Integer_Type_For): Likewise.
	(Small_Integer_Type_For): Likewise.
	* fname.adb (Is_Predefined_File_Name): Do not return False for names
	larger than 12 characters if they start with "s-".
	* freeze.adb (Adjust_Esize_For_Alignment): Change the maximum value
	to System_Max_Integer_Size.
	(Check_Suspicious_Modulus): Adjust comment.
	(Freeze_Entity): Likewise.
	* get_targ.ads (Get_Long_Long_Long_Size): New function.
	* get_targ.adb (Get_Long_Long_Long_Size): Likewise.
	(Width_From_Size): Deal with 128-bit size.
	* gnat1drv.adb (Adjust_Global_Switches): Deal with 128-bit types.
	* impunit.adb (Get_Kind_Of_File): Bump buffer size.  Accept files with
	13 characters if they start with 's'.  Compare slice of Buffer.
	(Not_Impl_Defined_Unit): Accept files with 13 characters if they start
	with 's'.
	* krunch.ads: Document length for 128-bit support units.
	* krunch.adb (Krunch): Set length to 9 for 128-bit support units.
	* layout.adb (Layout_Type): Use System_Max_Integer_Size as alignment
	limit.
	* rtsfind.ads (RTU_Id): Add System_Arith_128,
	System_Compare_Array_Signed_128, System_Compare_Array_Unsigned_128,
	System_Exn_LLLI, System_Exp_LLLU, System_Pack_[65..127].
	(RE_Id): Add RE_Integer_128, RE_Unsigned_128, RE_Add_With_Ovflo_Check128
	RE_Multiply_With_Ovflo_Check128, RE_Subtract_With_Ovflo_Check128,
	RE_Bswap_128, RE_Compare_Array_S128, RE_Compare_Array_U128,
	RE_Exn_Long_Long_Long_Integer, RE_Exp_Long_Long_Long_Integer,
	RE_Exp_Long_Long_Long_Unsigned, RE_Bits_[65-127], RE_Get_[65-127],
	RE_Set_[65-127], RE_IS_Is16, RE_IS_Iu16, RE_Integer_128 and
	RE_Unsigned_128.  Rename RE_Add_With_Ovflo_Check, RE_Double_Divide,
	RE_Multiply_With_Ovflo_Check, RE_Scaled_Divide and
	RE_Subtract_With_Ovflo_Check.  Remove RE_IS_Iz1, RE_IS_Iz2, RE_IS_Iz4,
	RE_IS_Iz8, RE_Long_Unsigned, RE_Short_Unsigned, RE_Short_Short_Unsigned
	(RE_Unit_Table): Likewise.
	* sem_aux.adb (Corresponding_Unsigned_Type): Deal with a size equal to
	that of Standard_Long_Long_Long_Integer.
	(First_Subtype): Deal with Standard_Long_Long_Long_Integer'Base.
	* sem_ch13.adb (Analyze_Attribute_Definition_Clause) <Attribute_Size>:
	Check the size against powers of 2 and System_Max_Integer_Size for
	objects as well.
	(Set_Enum_Esize): Deal with 128-bit bounds.
	* sem_ch3.adb (Set_Modular_Size): Handle 128-bit size.
	(Modular_Type_Declaration): Deal with 128-bit types.
	(Signed_Integer_Type_Declaration): Support derivation from
	Standard_Long_Long_Long_Integer.
	* sem_ch4.adb (Analyze_Mod): Handle 128-bit modulus.
	* sem_intr.adb: Add with and use clauses for Ttypes.
	(Check_Shift): Handle 128-bit size and modulus.
	* sem_prag.adb (Analyze_Pragma) <Pragma_Initialize_Scalars>: Deal
	with Signed_128 and Unsigned_128.
	(Analyze_Integer_Value): Handle 128-bit size.
	* sem_util.ads (Addressable): Adjust description.
	* sem_util.adb (Addressable): Return true for 128 if the system
	supports 128 bits.
	(Set_Invalid_Binder_Values): Deal with Signed_128 and Unsigned_128.
	* set_targ.ads (Long_Long_Long_Size): New variable.
	* set_targ.adb (S_Long_Long_Long_Size): New constant.
	(DTN): Add entry for S_Long_Long_Long_Size.
	(DTV): Add entry for Long_Long_Long_Size.
	(Set_Targ): Set Long_Long_Long_Size.
	* snames.ads-tmpl (Name_Max_Integer_Size): New attribute name.
	(Name_Signed_128): New scalar name.
	(Name_Unsigned_128): Likewise.
	(Scalar_Id): Adjust.
	(Integer_Scalar_Id): Likewise.
	(Attribute_Id): Add Attribute_Max_Integer_Size.
	* stand.ads (Standard_Entity_Type): Add S_Long_Long_Long_Integer.
	(Standard_Long_Long_Long_Integer): New renaming.
	(Universal_Integer): Adjust description.
	(Standard_Long_Long_Long_Unsigned): New variable.
	* switch-c.adb (Scan_Front_End_Switches): Deal with -gnate128.
	* ttypes.ads (Standard_Long_Long_Long_Integer_Size): New variable.
	(Standard_Long_Long_Long_Integer_Width): Likewise.
	(System_Max_Integer_Size): Turn into variable.
	(System_Max_Binary_Modulus_Power): Likewise.
	* uintp.ads (Uint_127): New constant.
	* uintp.adb (UI_Power_2): Extednd to 128.
	(UI_Power_10): Likewise.
	(UI_Expon): Deal with exponent up to 128 specially.
	* usage.adb (Write_Switch_Char): Print -gnate128 switch.
	* libgnat/a-tifiio.adb (Put_Scaled): Call Scaled_Divide64.
	* libgnat/interfac__2020.ads (Integer_128): New integer type.
	(Unsigned_128): New modular type.
	(Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left,
	Rotate_Right): New intrinsic functions operating on it.
	* libgnat/s-aridou.ads, libgnat/s-aridou.adb: New generic
	package.
	* libgnat/s-arit64.ads, libgnat/s-arit64.adb: Instantiate
	System.Arithmetic_Double.
	* libgnat/s-arit128.ads, libgnat/s-arit128.adb: Likewise.
	* libgnat/s-bytswa.ads: Add with clause for Interfaces, use subtypes
	of unsigned types defined in Interfaces and add Bswap_128.
	* libgnat/s-casi128.ads, libgnat/s-casi128.adb: New package.
	* libgnat/s-caun128.ads, libgnat/s-caun128.adb: Likewise.
	* libgnat/s-exnint.ads: Instantiate System.Exponn.
	* libgnat/s-exnint.adb: Add pragma No_Body.
	* libgnat/s-exnlli.ads: Instantiate System.Exponn.
	* libgnat/s-exnlli.adb: Add pragma No_Body.
	* libgnat/s-exnllli.ads: Instantiate System.Exponn.
	* libgnat/s-expint.ads: Likewise.
	* libgnat/s-expint.adb: Add pragma No_Body.
	* libgnat/s-explli.ads: Instantiate System.Exponn.
	* libgnat/s-explli.adb: Add pragma No_Body.
	* libgnat/s-expllli.ads: Instantiate System.Exponn.
	* libgnat/s-explllu.ads: Instantiate System.Exponu.
	* libgnat/s-expllu.ads: Likewise.
	* libgnat/s-expllu.adb: Add pragma No_Body.
	* libgnat/s-exponn.ads, libgnat/s-exponn.adb: New generic
	function.
	* libgnat/s-expont.ads, libgnat/s-expont.adb: Likewise.
	* libgnat/s-exponu.ads, libgnat/s-exponu.adb: Likewise.
	* libgnat/s-expuns.ads, libgnat/s-expuns.adb: Likewise.
	* libgnat/s-pack65.ads, libgnat/s-pack65.adb: New package.
	* libgnat/s-pack66.ads, libgnat/s-pack66.adb: New package.
	* libgnat/s-pack67.ads, libgnat/s-pack67.adb: New package.
	* libgnat/s-pack68.ads, libgnat/s-pack68.adb: New package.
	* libgnat/s-pack69.ads, libgnat/s-pack69.adb: New package.
	* libgnat/s-pack70.ads, libgnat/s-pack70.adb: New package.
	* libgnat/s-pack71.ads, libgnat/s-pack71.adb: New package.
	* libgnat/s-pack72.ads, libgnat/s-pack72.adb: New package.
	* libgnat/s-pack73.ads, libgnat/s-pack73.adb: New package.
	* libgnat/s-pack74.ads, libgnat/s-pack74.adb: New package.
	* libgnat/s-pack75.ads, libgnat/s-pack75.adb: New package.
	* libgnat/s-pack76.ads, libgnat/s-pack76.adb: New package.
	* libgnat/s-pack77.ads, libgnat/s-pack77.adb: New package.
	* libgnat/s-pack78.ads, libgnat/s-pack78.adb: New package.
	* libgnat/s-pack79.ads, libgnat/s-pack79.adb: New package.
	* libgnat/s-pack80.ads, libgnat/s-pack80.adb: New package.
	* libgnat/s-pack81.ads, libgnat/s-pack81.adb: New package.
	* libgnat/s-pack82.ads, libgnat/s-pack82.adb: New package.
	* libgnat/s-pack83.ads, libgnat/s-pack83.adb: New package.
	* libgnat/s-pack84.ads, libgnat/s-pack84.adb: New package.
	* libgnat/s-pack85.ads, libgnat/s-pack85.adb: New package.
	* libgnat/s-pack86.ads, libgnat/s-pack86.adb: New package.
	* libgnat/s-pack87.ads, libgnat/s-pack87.adb: New package.
	* libgnat/s-pack88.ads, libgnat/s-pack88.adb: New package.
	* libgnat/s-pack89.ads, libgnat/s-pack89.adb: New package.
	* libgnat/s-pack90.ads, libgnat/s-pack90.adb: New package.
	* libgnat/s-pack91.ads, libgnat/s-pack91.adb: New package.
	* libgnat/s-pack92.ads, libgnat/s-pack92.adb: New package.
	* libgnat/s-pack93.ads, libgnat/s-pack93.adb: New package.
	* libgnat/s-pack94.ads, libgnat/s-pack94.adb: New package.
	* libgnat/s-pack95.ads, libgnat/s-pack95.adb: New package.
	* libgnat/s-pack96.ads, libgnat/s-pack96.adb: New package.
	* libgnat/s-pack97.ads, libgnat/s-pack97.adb: New package.
	* libgnat/s-pack98.ads, libgnat/s-pack98.adb: New package.
	* libgnat/s-pack99.ads, libgnat/s-pack99.adb: New package.
	* libgnat/s-pack100.ads, libgnat/s-pack100.adb: New package.
	* libgnat/s-pack101.ads, libgnat/s-pack101.adb: New package.
	* libgnat/s-pack102.ads, libgnat/s-pack102.adb: New package.
	* libgnat/s-pack103.ads, libgnat/s-pack103.adb: New package.
	* libgnat/s-pack104.ads, libgnat/s-pack104.adb: New package.
	* libgnat/s-pack105.ads, libgnat/s-pack105.adb: New package.
	* libgnat/s-pack106.ads, libgnat/s-pack106.adb: New package.
	* libgnat/s-pack107.ads, libgnat/s-pack107.adb: New package.
	* libgnat/s-pack108.ads, libgnat/s-pack108.adb: New package.
	* libgnat/s-pack109.ads, libgnat/s-pack109.adb: New package.
	* libgnat/s-pack110.ads, libgnat/s-pack110.adb: New package.
	* libgnat/s-pack111.ads, libgnat/s-pack111.adb: New package.
	* libgnat/s-pack112.ads, libgnat/s-pack112.adb: New package.
	* libgnat/s-pack113.ads, libgnat/s-pack113.adb: New package.
	* libgnat/s-pack114.ads, libgnat/s-pack114.adb: New package.
	* libgnat/s-pack115.ads, libgnat/s-pack115.adb: New package.
	* libgnat/s-pack116.ads, libgnat/s-pack116.adb: New package.
	* libgnat/s-pack117.ads, libgnat/s-pack117.adb: New package.
	* libgnat/s-pack118.ads, libgnat/s-pack118.adb: New package.
	* libgnat/s-pack119.ads, libgnat/s-pack119.adb: New package.
	* libgnat/s-pack120.ads, libgnat/s-pack120.adb: New package.
	* libgnat/s-pack121.ads, libgnat/s-pack121.adb: New package.
	* libgnat/s-pack122.ads, libgnat/s-pack122.adb: New package.
	* libgnat/s-pack123.ads, libgnat/s-pack123.adb: New package.
	* libgnat/s-pack124.ads, libgnat/s-pack124.adb: New package.
	* libgnat/s-pack125.ads, libgnat/s-pack125.adb: New package.
	* libgnat/s-pack126.ads, libgnat/s-pack126.adb: New package.
	* libgnat/s-pack127.ads, libgnat/s-pack127.adb: New package.
	* libgnat/s-rannum.ads (Random): New function returning 128-bit.
	* libgnat/s-rannum.adb (Random): Implement it.
	* libgnat/s-scaval.ads: Add with clause for Interfaces, use subtypes
	of unsigned types defined in Interfaces.
	* libgnat/s-scaval.adb: Add use clause for Interfaces.
	* libgnat/s-scaval__128.ads, libgnat/s-scaval__128.adb: New
	package.
	* libgnat/s-unstyp.ads (Long_Long_Long_Unsigned): New modular type.
	(Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left,
	Rotate_Right): New intrinsic functions operating on it.

gcc/testsuite/

	* gnat.dg/multfixed.adb: Update expected exception message.
2020-10-21 03:22:49 -04:00
Eric Botcazou
6551e4cb27 [Ada] Document Long_Long_Long_Integer in implementation characteristics
gcc/ada/

	* doc/gnat_rm/implementation_defined_characteristics.rst: Add
	Long_Long_Long_Integer to the list of predefined integer types.
	* gnat_rm.texi: Regenerate.
2020-10-21 03:22:49 -04:00
Yannick Moy
bdf5a98385 [Ada] Fix target configuration file used for CodePeer/SPARK for new ints
gcc/ada/

	* ada_get_targ.adb (Width_From_Size): Add case for 128 bits.
	Reorder declarations in the same order as get_targ.adb to
	facilitate diffs.
2020-10-21 03:22:48 -04:00
Piotr Trojanek
74580e1b05 [Ada] Refactor repeated calls to Etype in aggregate expansion
gcc/ada/

	* exp_aggr.adb (Expand_N_Aggregate): Refactor repeated calls to
	Etype (N).
	(Build_Array_Aggr_Code): Fix whitespace.
2020-10-21 03:22:48 -04:00
Dmitriy Anisimkov
3c2d338129 [Ada] Fix bootstrap with old GCC
gcc/ada/

	* adaint.c (__gnat_file_time): Use regular arithmetic instead of
	__builtin_*_overflow routines if GCC version 4 or less and
	compiler is g++.
2020-10-21 03:22:48 -04:00
Piotr Trojanek
ed9a428d02 [Ada] Fix crash on illegal OTHERS in iterated_component_association
gcc/ada/

	* sem_aggr.adb (Resolve_Array_Aggregate): Use Choice_List, which
	internally calls either Choice or Discrete_Choices, depending on
	the context.
2020-10-21 03:22:48 -04:00
Piotr Trojanek
e22557ee95 [Ada] Use index parameter for iterated_component_association
gcc/ada/

	* sem_aggr.adb (Resolve_Iterated_Component_Association): Use
	existing defining identifier for index parameter.
2020-10-21 03:22:47 -04:00
Javier Miranda
f1722339ef [Ada] Wrong detection of potentially blocking call in protected object
gcc/ada/

	* exp_ch9.adb (Build_Task_Activation_Call): Do not generate a
	call to activate tasks if we are within the scope of a protected
	type and pragma Detect_Blocking is active.
2020-10-21 03:22:47 -04:00
Liaiss Merzougue
d0d9f29d52 [Ada] Codepeer remarks take into account
gcc/ada/

	* libgnat/s-carsi8.adb (Compare_Array_S8): Add pragma Assert to
	avoid warning concerning Left_Len and RighLen value regarding
	Bytes_Compared_As_Words.
	* libgnat/s-carun8.adb (Compare_Array_U8): Likewise.
	* libgnat/s-geveop.adb (Binary_Operation, Unary_Operation): Add
	pragma Assert concerning divide by 0 warning.
	* libgnat/s-imgcha.adb (Image_Character): Code update to prevent
	constant operation warning.
	(Image_Character): Add pragma Assert concerning the unchecked
	String size.
	* libgnat/s-imgdec.adb
	(Round): Upate loop code to prevent warning concerning
	Digs'First access.
	(Round): Add pragma assert.
	(Set): Add pragma Assert for the unchecked string size.
	(Set_Digits): Add pragma Assert for the input range.
	(Set_Decimal_Digits): Add pragma Assert.
	(Set_Blank_And_Sign): Add pragma Assert for the input range.
	* libgnat/s-arit64.adb (DoubleDivide): Add pragma Assert
	concerning Du /= 0.
	(Multiply_With_Ovflo_Check): Add pragma Annotate to avoid
	warning concerning unsigned -> signed conversion.
	* libgnat/s-imguns.adb (Set_Image_Unsigned): Add pragma Assert
	to prevent overflow check warning.  Add pragma Assert for
	controlling S'First = 1.
	* libgnat/s-imgrea.adb (Image_Floating_Point, Set, Set_Digs,
	Set_Special_Fill, Convert_Integer): Add pragma Annotate to
	prevent overflow check warning.
	(Set_Image_Real): Add pragma Annotate to avoid dead code warning
	on float check. Add pragma Assert to prevent overflow check
	warning.
	* libgnat/s-imgwiu.adb (Set_Digits, Set_Image_Width_Unsigned):
	Add pragma assert to prevent overflow check warning.
	* libgnat/s-imgllu.adb (Set_Image_Long_Long_Unsigned): Add
	pragma assert to prevent overflow check warning.
	* libgnat/s-imgint.adb (Set_Digits): Add Assert for input
	constraint and to prevent overflow check warning, create
	Non_Positive subtype, and change the T parameter as Non_Positive
	instead Integer.
	(Set_Image_Integer): Add pragma assert to prevent overflow check
	warning.
	* libgnat/s-imglli.adb (Set_Digits): Add Assert for input
	constraint and to prevent overflow check warning, create
	Non_Positive subtype, and change the T parameter as Non_Positive
	instead Integer.
	(Set_Image_Long_Long_Integer): Add pragma assert to prevent
	overflow check warning.
	* libgnat/s-fatgen.adb (Decompose, Pred, Succ): Add pragma
	Annotate to prevent dead code due to invalid float check.
	* libgnat/s-imenne.adb (Image_Enumeration_8,
	Image_Enumeration_16, Image_Enumeration_32): Add pragma Assert
	to prevent overflow check warning.  Add Names_Index subtype for
	restricting Index_table content.
2020-10-21 03:22:47 -04:00
Gary Dismukes
05eb5c6142 [Ada] Compiler crash on prefixed call to controlled function with invariant check
gcc/ada/

	* exp_ch6.adb (Insert_Post_Call_Actions): Test for
	N_Explicit_Dereference as part of the existing test for function
	calls.
2020-10-21 03:22:46 -04:00
Eric Botcazou
5ff5f7210f [Ada] Fix bogus error for bit-packed array with volatile component
gcc/ada/

	* freeze.adb (Check_Strict_Alignment): Do not set the flag for
	a bit-packed array type, even if it is a by-reference type.
2020-10-21 03:22:46 -04:00
Dmitriy Anisimkov
948c6d7e9e [Ada] Improve precision of Ada.Directories.Modification_Time
gcc/ada/

	* adaint.c (__gnat_file_time): New routine.
	(__gnat_copy_attribs): Copy timestamps in nanoseconds.
	* libgnat/a-direct.adb (C_Modification_Time): Bind to
	__gnat_file_time.
	(Modification_Time): Call to C_Modification_Time.
2020-10-21 03:22:46 -04:00
Piotr Trojanek
3b612313b6 [Ada] Fix crash with iterated_component_association and -gnatc
gcc/ada/

	* sem_aggr.adb (Resolve_Iterated_Component_Association):
	Expression's copy and now has the same parent as the original
	expression.
	(Resolve_Array_Aggregate): Add ??? comment about a still
	existing minor issue that led to discovery of the above crash.
2020-10-21 03:22:46 -04:00
Javier Miranda
7c6fb753e2 [Ada] Spurious error in current instance used as formal package
gcc/ada/

	* sem_ch12.adb (Install_Parents_Of_Generic_Context): Simplify
	functionality; collect and install parents of generic child
	package.
	(Remove_Parents_Of_Generic_Context): Code cleanup.
	(Instantiate_Package_Body): Hide parents of generic context from
	visibility before installing the parent instance; restore their
	visibility when the instance is analyzed
2020-10-21 03:22:45 -04:00
Doug Rupp
4a17254b26 [Ada] Remove -mthreads from Linker_Options pragma for x86-lynx178e
gcc/ada/

	* libgnarl/s-osinte__lynxos178e.ads: Remove -mthreads switch.
2020-10-21 03:22:45 -04:00
Patrick Bernardi
603b57c732 [Ada] Use VxWorks 7 APIs for accessing environment variables in kernel mode
gcc/ada/

	* env.c (__gnat_setenv): call setenv for VxWorks 7 kernel mode.
	(__gnat_environ): envGet takes an int instead of a NULL pointer.
	(__gnat_unsetenv): call unsetenv for VxWorks 7 kernel mode.
	(__gnat_clearenv): use __gnat_unsetenv to clear environment
	variables.
2020-10-21 03:22:45 -04:00
Eric Botcazou
e98f6ed1e2 [Ada] Use helper function in Freeze_Subprogram_Body
gcc/ada/

	* sem_ch12.adb (Freeze_Subprogram_Body): Call
	Package_Freeze_Node to retrieve the freeze node for the
	enclosing body of the generic.
2020-10-21 03:22:45 -04:00
Justin Squirek
bd4dc93d42 [Ada] Incorrect associations for extra accessibility parameters
gcc/ada/

	* exp_ch6.adb (Expand_Call_Helper): Modify calls to
	Add_Extra_Actual to use Extra_Accessibility instead of
	Get_Accessibility for the EF parameter.
2020-10-21 03:22:44 -04:00
Piotr Trojanek
c43098ca63 [Ada] Make minimum accessibility level a constant object
gcc/ada/

	* exp_ch6.adb (Expand_Actuals): Whitespace cleanup.
	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Make minimum
	accessibility a constant object.
2020-10-21 03:22:44 -04:00
Patrick Bernardi
512fe5e067 [Ada] Simplify the VxWorks implementation of __gnat_environ
gcc/ada/

	* env.c (__gnat_environ): For VxWorks kernel simply return the
	result of the envGet call. Do this for VxWorks 6 and 7 as they
	both support the same API.
2020-10-21 03:22:44 -04:00
Ghjuvan Lacambre
54c49fcdd7 [Ada] Disable warnings on entities when building finalizers
gcc/ada/

	* exp_ch7.adb (Build_Finalizer): Disable warnings on referenced
	entity.
2020-10-21 03:22:44 -04:00
Piotr Trojanek
53ac0963d4 [Ada] Fix typos and style in comments related to Default_Initial_Condition
gcc/ada/

	* einfo.ads, sem_ch3.adb, sem_util.adb: Fix comments.
2020-10-21 03:22:43 -04:00
Javier Miranda
ac38961bad [Ada] Spurious error in taft ammendment derivation of CPP type
gcc/ada/

	* sem_ch3.adb (Build_Derived_Type): Propagate convention of
	class-wide parent.
2020-10-21 03:22:43 -04:00
Claire Dross
73764bae1d [Ada] Raise Capacity_Error on formal vector insertion
gcc/ada/

	* libgnat/a-cofove.adb (Copy): Add explanation in case of
	Capacity_Error.
	(Insert_Space): Raise Capacity_Error if the new length is
	greater than the capacity.
	(Reserve_Capacity): Raise Capacity_Error instead of
	Constraint_Error.
2020-10-21 03:22:43 -04:00
Andrea Corallo
19e9cf7a17 aarch64: [testsuite] Fix typo in diagnostic message
gcc/testsuite/ChangeLog

2020-10-21  Andrea Corallo  <andrea.corallo@arm.com>

	* gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c (CMT):
	Adopt the same style used in the rest of the file.
2020-10-21 09:19:07 +02:00
Aldy Hernandez
1768f534c1 Fix discrepancy in Walloca test on 32-bit systems.
There is a discrepancy in the way we report -Walloca-larger-than=
errors on 32-bit versus 64-bit architectures, due to the nature of
ranges derived from a cast operation.

For the Walloca-1 tests on 64-bits we get:

  int num.0_1;
  long unsigned int _2;

  <bb 2> [local count: 1073741824]:
  num.0_1 = num;
  _2 = (long unsigned int) num.0_1;
  s_8 = __builtin_alloca (_2);

Because of the cast of a 32-bit quantity into a 64-bit quantity in _2,
ranger calculates its range as:

	long unsigned int [0, 2147483647][18446744071562067968, +INF]

Thus excluding the numbers that can't exist in _2.

This causes the Walloca pass to report that the argument to alloca may be
too large.

However, for -m32 on x86, the gimple is:

  int num.0_1;
  unsigned int num.1_2;

  <bb 2> [local count: 1073741824]:
  num.0_1 = num;
  num.1_2 = (unsigned int) num.0_1;
  s_8 = __builtin_alloca (num.1_2);

Since num.0_1 and num.1_2 are of the same size, we cannot determine
any useful range, so we return VARYING.  In the Walloca pass, VARYING
basically means "unbounded" (no known bounds for the alloca call argument).
So on 32-bits, the error message issued is slightly different:

	warning: unbounded use of ‘alloca’

versus on 64-bits, where due to the cast, it is:

	warning: argument to ‘alloca’ may be too large

In reality both versions of the IL show an unbounded call, but in one
version (64-bits) we can exclude some values so we assume the range
was provided, but it was out of bounds.

I've mentioned various times that all these diagnostics passes
(alloca, restrict, printf, etc), could benefit from less specific error
messages since what we have can potentially confuse the user.  However,
no consensus has been reached on how to report these things.

In the meantime, this patch adjusts the testcase to accept both variants.

gcc/testsuite/ChangeLog:

	* gcc.dg/Walloca-1.c: Adjust for 32-bits.
2020-10-21 08:47:03 +02:00
GCC Administrator
e2e0428854 Daily bump. 2020-10-21 00:16:36 +00:00
Jeff Law
deb1365e5c Handle 16 bit targets in diagnostic pruning
gcc/testsuite
	* gcc.dg/Wbuiltin-declaration-mismatch-9.c: Improve pruning of
	invalid scanf call messages.
2020-10-20 17:29:32 -06:00
Andrew MacLeod
292c92715b Temporarily disable trap in in extract_range_builtin check.
Until we figure out how to adjust ubsan for symbolics, disable the trap.

    gcc/ChangeLog:

	PR tree-optimization/97505
	* vr-values.c (vr_values::extract_range_basic): Trap if
	vr_values version disagrees with range_of_builtin_call.
2020-10-20 18:46:53 -04:00
Nikhil Benesch
7cf256c3c8 libgo: adjust NetBSD-specific types for stable syscall API
The backwards-compatibility guarantees of the syscall package
require some munging of the C API inferred by mksysinfo.sh.
Specifically, the RTM_RESOLVE constant must be added if it is
missing, and the stat_t struct must use the suffix "timespec"
rather than "tim" for its time-related fields.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/263519
2020-10-20 13:01:26 -07:00
David Edelsohn
52cb0c7b0e rs6000: Allow -mabi=no-altivec override on command line for AIX.
The override options machinery to set rs6000_altivec_abi for AIX
doesn't check if the option is set on the command line.  This patch
checks for a command line option to not override it.

gcc/ChangeLog:

	* config/rs6000/rs6000.c (rs6000_option_override_internal):
	Don't implcitly enable Altivec ABI if set on the command line.
2020-10-20 15:38:44 -04:00
François Dumont
1b6f047683 libstdc++: Refactor _Hashtable to prepare for custom pointers
Limit usage of node pointers in _Hashtable implementation details so that when
we move to allocator custom pointer type we do not need to add an _Alloc
template parameter everywhere which would impact abi.

This is done by reviewing node type definition. It is now based on new basic
types which are not pointer dependant. The _Hashtable helper
types are now using those new node base types and do not receive node pointers.

libstdc++-v3/ChangeLog

	* include/bits/hashtable_policy.h
	(_Hash_node_value_base<>): Remove _Hash_node_base inheritance.
	(_Hash_node_code_cache<bool _Cache_hash_code>): New.
	(_Hash_node_value<typename _Value, bool _Cache_hash_code>): New.
	(_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>.
	(_Map_base<>::__node_type): Remove.
	(_Map_base<>::iterator): Remove.
	(_Insert_base<>::__hash_cached): New.
	(_Insert_base<>::__constant_iterators): New.
	(_Insert_base<>::__hashtable_alloc): New.
	(_Insert_base<>::__node_type): Remove.
	(_Insert_base<>::__node_ptr): New.
	(_Hash_code_base<>): Remove specializations.
	(_Hash_code_base<>::__node_type): Remove.
	(_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)):
	Replace by...
	(_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)):
	...this.
	(_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)):
	Replace by...
	(_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)):
	...this.
	(_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)):
	Replace by...
	(_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&,
	const _Hash_node_code_base<>&)): ...this.
	(_Hashtable_base<>::__constant_iterators): Remove.
	(_Hashtable_base<>::__unique_keys): Remove.
	(_Hashtable_base<>::__node_type): Remove.
	(_Hashtable_base<>::iterator): Remove.
	(_Hashtable_base<>::const_iterator): Remove.
	(_Hashtable_base<>::local_iterator): Remove.
	(_Hashtable_base<>::const_local_iterator): Remove.
	(_Hashtable_base<>::__ireturn_type): Remove.
	(_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by...
	(_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)):
	...this.
	(_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by...
	(_Hashtable_base<>::_S_node_equals(__hash_code,
	const _Hash_node_code_hash<>&)): ...this.
	(_Hashtable_base<>::_Equal_hash_code<>): Remove.
	(_Hashtable_base<>::_M_equals): Adapt.
	(_Hashtable_baxe<>::_M_node_equals): Adapt.
	(_Equality<>::_M_equal): Adapt.
	(_Hashtable_alloc<>::__node_ptr): New.
	(_Hashtable_alloc<>::__bucket_type): Rename into...
	(_Hashtable_alloc<>::__node_base_ptr): ...this.
	(_Hashtable_alloc<>::__bucket_alloc_type): Rename into...
	(_Hashtable_alloc<>::__buckets_alloc_type): ...this.
	(_Hashtable_alloc<>::__bucket_alloc_traits): Rename into...
	(_Hashtable_alloc<>::__buckets_alloc_traits): ...this.
	(_Hashtable_alloc<>::__buckets_ptr): New.
	(_Hashtable_alloc<>::_M_allocate_node): Adapt.
	(_Hashtable_alloc<>::_M_deallocate_node): Adapt.
	(_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt.
	(_Hashtable_alloc<>::_M_deallocate_nodes): Adapt.
	(_Hashtable_alloc<>::_M_allocate_buckets): Adapt.
	(_Hashtable_alloc<>::_M_deallocate_buckets): Adapt.
	* include/bits/hashtable.h (_Hashtable<>): Adapt.
2020-10-20 21:30:22 +02:00
Nathan Sidwell
15b8e2af42 c++: block-scope extern decl with default args
In adding the DECL_LOCAL_DECL handling, I'd forgotten that the
parm-decls also need cloning -- and resetting of their DECL_CONTEXT.
Also, any default args need droping when adding an alias, as those are
not propagated.  The std's not totally clear on this latter point when
there's no exising namespace decl, but that seems like the right thing
and is what clang does.

	gcc/cp/
	* name-lookup.c (push_local_extern_decl_alias): Reconstextualize
	alias' parm decls.  Drop any default args.
	gcc/testsuite/
	* g++.dg/lookup/local-extern.C: New.
2020-10-20 12:20:10 -07:00
Ian Lance Taylor
d962ef77da libbacktrace: use __attribute__((__fallthrough__))
Use an attribute rather than a comment when falling through a switch case.

	* internal.h (ATTRIBUTE_FALLTHROUGH): Define.
	* elf.c (elf_zlib_inflate): Use ATTRIBUTE_FALLTHROUGH.
2020-10-20 11:49:58 -07:00
Aldy Hernandez
e864d395b4 Convert -Wrestrict pass to ranger.
There is one adjustment to a C++ test which now gives a false positive.
After talking with Martin Sebor, we've concluded this is expected.  There
is no way to communicate that libstdc++ allocated objects are always
less than PTRDIFF_MAX.

gcc/ChangeLog:

	* calls.c (get_size_range): Adjust to work with ranger.
	* calls.h (get_size_range): Add ranger argument to prototype.
	* gimple-ssa-warn-restrict.c (class wrestrict_dom_walker): Remove.
	(check_call): Pull out of wrestrict_dom_walker into a
	static function.
	(wrestrict_dom_walker::before_dom_children): Rename to...
	(wrestrict_walk): ...this.
	(pass_wrestrict::execute): Instantiate ranger.
	(class builtin_memref): Add stmt and query fields.
	(builtin_access::builtin_access): Add range_query field.
	(builtin_memref::builtin_memref): Same.
	(builtin_memref::extend_offset_range): Same.
	(builtin_access::builtin_access): Make work with ranger.
	(wrestrict_dom_walker::check_call): Pull out into...
	(check_call): ...here.
	(check_bounds_or_overlap): Add range_query argument.
	* gimple-ssa-warn-restrict.h (check_bounds_or_overlap):
	Add range_query and gimple stmt arguments.

gcc/testsuite/ChangeLog:

	* gcc.dg/Wrestrict-22.c: New test.
	* g++.dg/torture/pr92421.C: Adjust for ranger.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string/capacity/1.cc: Pass
	-Wno-stringop-overflow to test.
2020-10-20 20:46:08 +02:00
Aldy Hernandez
495ec0b2aa Convert -Walloca pass to ranger.
gcc/ChangeLog:

	* gimple-ssa-warn-alloca.c (enum alloca_type): Remove
	ALLOCA_BOUND_UNKNOWN and ALLOCA_CAST_FROM_SIGNED.
	(warn_limit_specified_p): New.
	(alloca_call_type_by_arg): Remove.
	(cast_from_signed_p): Remove.
	(is_max): Remove.
	(alloca_call_type): Remove heuristics and replace with call into
	ranger.
	(pass_walloca::execute): Instantiate ranger.

gcc/testsuite/ChangeLog:

	* gcc.dg/Walloca-1.c: Adjust for ranger.
	* gcc.dg/Walloca-12.c: Same.
	* gcc.dg/Walloca-13.c: Same.
	* gcc.dg/Walloca-2.c: Same.
	* gcc.dg/Walloca-3.c: Same.
	* gcc.dg/Walloca-6.c: Same.
	* gcc.dg/Wvla-larger-than-2.c: Same.
2020-10-20 20:45:14 +02:00
Nikhil Benesch
522307281c syscall: remove Sendfile on NetBSD
NetBSD does not support the sendfile syscall.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/263521
2020-10-20 10:57:10 -07:00
Tobias Burnus
6267bb7a11 lto-wrapper: Fix -save-temps filename commit
Fix for 'Improve -save-temps filename' patch,
commit b3032d1b84b8ab683f2d7345b6a2d9f783fe946d

gcc/ChangeLog
	* lto-wrapper.c (run_gcc): Use proper variable for
	%u.ltrans_args dump suffix.

gcc/testsuite/ChangeLog
	* gcc.misc-tests/outputs.exp: Add ltrans_args dump files
	for 'lto save-temps'.
2020-10-20 19:41:44 +02:00
zhengnannan
4fb0ee84ad AArch64: Add FLAG for get/set reg intrinsics [PR94442]
2020-10-20  Zhiheng Xie  <xiezhiheng@huawei.com>
	    Nannan Zheng  <zhengnannan@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
	for get/set reg intrinsics.
2020-10-20 17:53:04 +01:00
Aldy Hernandez
16e4f1ad44 Refactor range handling of builtins in vr_values and ranger.
This sets things up so we can share range handling of builtins between
vr_values and ranger.  It is meant to refactor the code so that we can
verify that both implementations yield the same results.

First, we abstract out gimple_ranger::range_of_builtin_call into an externally
visible counterpart that can be called from vr_values.  It will take a
range_query since both ranger and vr_values inherit from this base class.

Then we abstract out all the builtin handling in vr_values into a separate
method that is easier to compare against.

Finally, we call the ranger version from vr_values and compare it with the
vr_values version.  Since this proves both versions return the same,
we can remove vr_values::extract_range_builtin in a follow-up patch.

The vr_values::range_of_expr change brings the vr_values version up to par
with the ranger version.  It should've handled non-SSA's.  This was
a small oversight that went unnoticed because the vr_value version isn't
stressed nearly as much as the ranger version.  The change is needed because
the ranger code handling builtins calls, may call it for integer arguments
in range_of_builtin_ubsan_call.

There should be no change in functionality.

gcc/ChangeLog:

	* gimple-range.cc (gimple_ranger::range_of_builtin_ubsan_call):
	Make externally visble...
	(range_of_builtin_ubsan_call): ...here.  Add range_query argument.
	(gimple_ranger::range_of_builtin_call): Make externally visible...
	(range_of_builtin_call): ...here.  Add range_query argument.
	* gimple-range.h (range_of_builtin_call): Move out from class and
	make externally visible.
	* vr-values.c (vr_values::extract_range_basic): Abstract out
	builtin handling to...
	(vr_values::range_of_expr): Handle non SSAs.
	(vr_values::extract_range_builtin): ...here.
	* vr-values.h (class vr_values): Add extract_range_builtin.
	(range_of_expr): Rename NAME to EXPR.
2020-10-20 18:21:23 +02:00
Aldy Hernandez
5d53ec2701 Saturate overflows return from SCEV in ranger.
bounds_of_var_in_loop is returning an overflowed int, which is causing
us to create a range for which we can't compare the bounds causing
an ICE in verify_range.

Overflowed bounds cause compare_values() to return -2, which we
don't handle in verify_range.

We don't represent overflowed ranges in irange, so this patch just
saturates any overflowed end-points to MIN or MAX.

gcc/ChangeLog:

	PR tree-optimization/97501
	* gimple-range.cc (gimple_ranger::range_of_ssa_name_with_loop_info):
	Saturate overflows returned from SCEV.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr97501.c: New test.
2020-10-20 17:23:12 +02:00
Nathan Sidwell
dbcc6b1577 preprocessor: Further fix for EOF in macro args [PR97471]
My previous attempt at fixing this was incorrect.  The problem occurs
earlier in that _cpp_lex_direct processes the unwinding EOF needs in
collect_args mode.  This patch changes it not to do that, in the same
way as directive parsing works.  Also collect_args shouldn't push_back
such fake EOFs, and neither should funlike_invocation_p.

	libcpp/
	* lex.c (_cpp_lex_direct): Do not complete EOF processing when
	parsing_args.
	* macro.c (collect_args): Do not unwind fake EOF.
	(funlike_invocation_p): Do not unwind fake EOF.
	(cpp_context): Replace abort with gcc_assert.
	gcc/testsuite/
	* gcc.dg/cpp/endif.c: Move to ...
	* c-c++-common/cpp/endif.c: ... here.
	* gcc.dg/cpp/endif.h: Move to ...
	* c-c++-common/cpp/endif.h: ... here.
	* c-c++-common/cpp/eof-2.c: Adjust diagnostic.
	* c-c++-common/cpp/eof-3.c: Adjust diagnostic.
2020-10-20 08:01:34 -07:00
Jakub Jelinek
35f258f4bb libgomp: Fix up bootstrap in libgomp/target.c due to false positive warning
> On 10/20/20 2:11 PM, Tobias Burnus wrote:
>
> > Unfortunately, the committed patch
> > (r11-4121-g1bfc07d150790fae93184a79a7cce897655cb37b)
> > causes build errors.
> >
> > The error seems to be provoked by function cloning – as the code
> > itself looks fine:
> > ...
> >  struct gomp_device_descr *devices_s
> >     = malloc (num_devices * sizeof (struct gomp_device_descr));
> > ...
> >   for (i = 0; i < num_devices; i++)
> >     if (!(devices[i].capabilities & GOMP_OFFLOAD_CAP_OPENMP_400))
> >       devices_s[num_devices_after_openmp++] = devices[i];
>
> gomp_target_init.part.0 ()
> {
> ...
> <bb 2>
>   devices_s_1 = malloc (0);
> ...
>   num_devices.16_67 = num_devices;
> ...
>   if (num_devices.16_67 > 0)
>     goto <bb 3>; [89.00%]
>   else
>     goto <bb 18>; [11.00%]
>
> Which seems to have an ordering problem.

This patch fixes the warning that breaks the bootstrap.

2020-10-20  Jakub Jelinek  <jakub@redhat.com>

	* target.c (gomp_target_init): Inside of the function, use automatic
	variables corresponding to num_devices, num_devices_openmp and devices
	global variables and update the globals only at the end of the
	function.
2020-10-20 16:38:24 +02:00
Marek Polacek
953277ba3f c++: Add fixed test [PR82239]
This test was fixed by r256550 but that commit was fixing another issue,
and just happened to fix this too.

gcc/testsuite/ChangeLog:

	PR c++/82239
	* g++.dg/cpp0x/static_assert16.C: New test.
2020-10-20 10:16:12 -04:00
Aldy Hernandez
5bcd7de640 Simplify and split irange::copy_legacy_range into two functions.
copy_legacy_range was a small but complex function.  It was tricky
to understand, and easy to introduce bugs into it.  It also did
unnecessary work on some code paths.

This patch splits the function into two functions that are more
efficient and easier to read (copy_to_legacy and
copy_legacy_to_multi_range).

gcc/ChangeLog:

	* value-range.cc (irange::operator=): Split up call to
	copy_legacy_range into...
	(irange::copy_to_legacy): ...this.
	(irange::copy_legacy_to_multi_range): ...and this.
	(irange::copy_legacy_range): Remove.
	* value-range.h: Remove copoy_legacy_range.
	Add copy_legacy_to_multi_range and copy_to_legacy.
2020-10-20 15:53:22 +02:00
Tobias Burnus
f7378bbf47 gcc/doc/invoke.texi: Fix @table syntax
gcc/
	* doc/invoke.texi (NVPTX options): Use @item not @itemx.
2020-10-20 15:32:58 +02:00
Richard Biener
128f43cf67 Avoid changing PHIs in GIMPLE split_edge
Previously I've changed gimple_split_edge to avoid PHI node
re-allocation, but this introduced swapping of PHI arguments
due to the way edge redirection works.  This is now a problem
for me and which can be solved with the following approach
reducing the overhead of split_edge even more.  We can simply
pretend there are no PHI nodes if we can make sure the
new fallthru will have the same dest_idx as the old edge
into the destination.

2020-10-20  Richard Biener  <rguenther@suse.de>

	* tree-cfg.c (reinstall_phi_args): Remove.
	(gimple_split_edge): Remove PHIs around the edge redirection
	to avoid touching them at all.
2020-10-20 14:21:01 +02:00
Richard Biener
06729598b0 Fix latch PHI arg lookup in vectorizable_reduction for double-reduction
We were using the wrong loop to figure the latch arg of a
double-reduction PHI.  Which isn't a problem in case ->dest_idx
match up with the outer loop edges - but that's of course not guaranteed.

2020-10-20  Richard Biener  <rguenther@suse.de>

	* tree-vect-loop.c (vectorizable_reduction): Use the correct
	loops latch edge for the PHI arg lookup.
2020-10-20 14:21:01 +02:00
Kwok Cheung Yeung
1bfc07d150 openmp: Implement support for OMP_TARGET_OFFLOAD environment variable
This implements support for the OMP_TARGET_OFFLOAD environment variable
introduced in the OpenMP 5.0 standard, which controls how offloading
is handled.  It may be set to MANDATORY (abort if offloading cannot be
performed), DISABLED (no offloading to devices) or DEFAULT (offload to
device if possible, fall back to host if not).

2020-10-20  Kwok Cheung Yeung  <kcy@codesourcery.com>

	libgomp/
	* env.c (gomp_target_offload_var): New.
	(parse_target_offload): New.
	(handle_omp_display_env): Print value of OMP_TARGET_OFFLOAD.
	(initialize_env): Parse OMP_TARGET_OFFLOAD.
	* libgomp.h (gomp_target_offload_t): New.
	(gomp_target_offload_var): New.
	* libgomp.texi (OMP_TARGET_OFFLOAD): New section.
	* target.c (resolve_device): Generate error if device not found and
	offloading is mandatory.
	(gomp_target_fallback): Generate error if offloading is mandatory.
	(GOMP_target): Add argument in call to gomp_target_fallback.
	(GOMP_target_ext): Likewise.
	(gomp_target_data_fallback): Generate error if offloading is mandatory.
	(GOMP_target_data): Add argument in call to gomp_target_data_fallback.
	(GOMP_target_data_ext): Likewise.
	(gomp_target_task_fn): Add argument in call to gomp_target_fallback.
	(gomp_target_init): Return early if offloading is disabled.
2020-10-20 04:16:26 -07:00