Commit Graph

181745 Commits

Author SHA1 Message Date
Tobias Burnus
6fb9b4c976 gfortran.dg/gomp/requires-4.f90: Fix !$omp clause
gcc/testsuite/
	* gfortran.dg/gomp/requires-4.f90: Fix typo in '!$omp' clause.
2020-11-27 11:46:19 +01:00
Tobias Burnus
d78e106e95 gfortran.dg/gomp/requires-4.f90: Fix !$omp syntax
gcc/testsuite/
	* gfortran.dg/gomp/requires-4.f90: Fix '!$omp' syntax.
2020-11-27 11:43:04 +01:00
Jakub Jelinek
83325a9db8 tree-ssanames: Allow non-SSA_NAME arguments to get_range_info
My recent match.pd change required quite a lot of code due to the separate
need to handle INTEGER_CSTs and SSA_NAMEs, and after all, I didn't even
handle one case there, when in x * y / y the x is INTEGER_CST and y is
SSA_NAME.
The following patch allows to simplify it, by allowing non-SSA_NAME argument
to get_range_info, for INTEGER_CSTs it will return VR_RANGE with *min == *max
equal to the constnat, and for non-INTEGER_CST/SSA_NAMEs it will just return
VR_VARYING.

This allows not to simplify just the match.pd, but some other spots too.

2020-11-27  Jakub Jelinek  <jakub@redhat.com>

	* tree-ssanames.c (get_range_info): Handle INTEGER_CST by returning
	VR_RANGE with both *min and *max set to the wide_int value of the
	INTEGER_CST.  Return VR_VARYING for non-SSA_NAMEs.
	* match.pd ((t * 2) / 2) -> t): Handle also @0 being INTEGER_CST.
	Simplify by calling get_range_info on everything.
	* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Simplify by calling
	get_range_info on everything.
	* tree-scalar-evolution.c (iv_can_overflow_p): Likewise.
2020-11-27 11:38:31 +01:00
Jakub Jelinek
bf0a63a1f4 gimple-fold: Fix another __builtin_clear_padding ICE
When playing with __builtin_bit_cast, I have noticed __builtin_clear_padding
ICE on the G class below.  The artificial field with D type has offset 0
and size 8 bytes, but the following artificial field with E type has offset
0 and size 0, so it triggers the asserts that we don't move current position
backwards.  Fixed by ignoring is_empty_type (TREE_TYPE (field)) fields, all
of their bits are padding which is what is added when skipping over to next
field anyway.

2020-11-27  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/88101
	* gimple-fold.c (clear_padding_type): Ignore fields with is_empty_type
	types.

	* g++.dg/torture/builtin-clear-padding-3.C: New test.
2020-11-27 11:25:10 +01:00
Tobias Burnus
f324479caf OpenACC: Fix integer-type issue with collapse/tile [PR97880]
gcc/ChangeLog:

	PR c/97880
	* omp-expand.c (expand_oacc_collapse_init, expand_oacc_collapse_vars):
	Use now passed diff_type.
	(expand_oacc_for): Take largest type for diff_type, taking tiling
	and collapsing into account.

gcc/testsuite/ChangeLog:

	PR c/97880
	* gcc.dg/goacc/tile-1.c: New test.
2020-11-27 11:18:35 +01:00
Kyrylo Tkachov
5f29f3d5dd aarch64: Introduce --param=aarch64-autovec-preference to select autovec preference in backend
This is a patch that introduces the aarch64-autovec-preference that can
take values from 0 - 4, 0 being the default.
It can be used to override the autovectorisation preferences in the
backend:
0 - use default scheme
1 - only use Advanced SIMD
2 - only use SVE
3 - use Advanced SIMD and SVE, prefer Advanced SIMD in the event of a
tie (as determined by costs)
4 - use Advanced SIMD and SVE, prefer SVE in the event of a tie (as
determined by costs)

It can valuable for experimentation when comparing SVE and Advanced SIMD
autovectorisation strategies.

It achieves this adjusting the order of the interleaved SVE and Advanced
SIMD modes in aarch64_autovectorize_vector_modes.
It also adjusts aarch64_preferred_simd_mode to use the new comparison
function to pick Advanced SIMD or SVE to start with.

Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/
	* config/aarch64/aarch64.opt
	(-param=aarch64-autovec-preference): Define.
	* config/aarch64/aarch64.c (aarch64_override_options_internal):
	Set aarch64_sve_compare_costs to 0 when preferring only Advanced
	SIMD.
	(aarch64_cmp_autovec_modes): Define.
	(aarch64_preferred_simd_mode): Adjust to use the above.
	(aarch64_autovectorize_vector_modes): Likewise.
	* doc/invoke.texi: Document aarch64-autovec-preference param.
2020-11-27 09:19:33 +00:00
Eric Botcazou
def0e5b83d [Ada] Small tweaks to couple of Value routines
gcc/ada/

	* libgnat/s-valuef.adb (Integer_To_Fixed): Take into account the
	extra digit when scaling up the input.
	* libgnat/s-valuer.adb (Scan_Decimal_Digits): Restrict previous
	change to fixed-point types.
	(Scan_Integral_Digits): Likewise.
2020-11-27 04:16:05 -05:00
Piotr Trojanek
4e6b87e933 [Ada] Simplify Parent_Is_Boolean with subtype memberships
gcc/ada/

	* sem_res.adb (Parent_Is_Boolean): Simplify.
	(Resolve_Op_Not): Reduce scope of a local variable.
2020-11-27 04:16:04 -05:00
Piotr Trojanek
586f6dd1f6 [Ada] Reuse Append_New_Elmt where possible
gcc/ada/

	* cstand.adb: Simplify with Append_New_Elmt.
	* sem_util.adb: Likewise.
2020-11-27 04:16:03 -05:00
Arnaud Charlet
4a3b4c2a45 [Ada] Wrong compile time evaluation of Shift_Right
gcc/ada/

	* sem_eval.adb (Fold_Shift): Fix evaluation of Shift_Right on
	negative values.
2020-11-27 04:16:02 -05:00
Arnaud Charlet
d6a52e47ac [Ada] Reference before declaration on C392015
gcc/ada/

	* exp_ch6.adb (Expand_Call): Properly split
	Transform_Function_Array and Modify_Tree_For_C.
2020-11-27 04:16:01 -05:00
Piotr Trojanek
a0f2ee7a7f [Ada] Restore access type instead of mode out parameter
gcc/ada/

	* sem_eval.ads (Compile_Time_Compare): Restore parameter Diff to
	be of an access type.
	* sem_eval.adb (Compile_Time_Compare): Adapt body and callers.
	* sem_attr.adb (Eval_Attribute): Adapt callers.
2020-11-27 04:16:00 -05:00
Eric Botcazou
a873cb9978 [Ada] Small improvement to System.Value_R.Scan_Raw_Real
gcc/ada/

	* libgnat/s-valuer.adb (Scan_Decimal_Digits): Round Extra.
	(Scan_Integral_Digits): Likewise.
2020-11-27 04:15:59 -05:00
Yannick Moy
fdd0a84489 [Ada] Do not apply range checks inside generics in GNATprove mode
gcc/ada/

	* checks.adb (Selected_Range_Checks): Adapt the condition for
	applying range checks so that it is not done inside generics.
2020-11-27 04:15:58 -05:00
Eric Botcazou
9884fc7e79 [Ada] Do not use 128-bit division for 64-bit fixed-point types
gcc/ada/

	* exp_fixd.adb (Build_Double_Divide): Only use a 128-bit
	division if one of the operands is larger than 64 bits.
	(Build_Double_Divide_Code): Likewise.
	(Build_Scaled_Divide): Likewise.
	(Build_Scaled_Divide_Code): Likewise.
2020-11-27 04:15:58 -05:00
Arnaud Charlet
7d4ee5f8e2 [Ada] To_GM_Time returning invalid value for Invalid_Time
gcc/ada/

	* libgnat/s-os_lib.adb (To_GM_Time): Return valid and consistent
	values for Invalid_Time.
2020-11-27 04:15:57 -05:00
Steve Baird
23e3e22105 [Ada] Implement AI12-0187 (Stable properties of abstract data types)
gcc/ada/

	* snames.ads-tmpl: Define new Name_Stable_Properties Name_Id
	value.
	* aspects.ads, aspects.adb: Add new Aspect_Stable_Properties
	enumeration literal to Aspect_Id type. Add Class_Present
	parameter to Find_Aspect and related
	functions (Find_Value_Of_Aspect and Has_Aspect).
	* sem_util.adb (Has_Nontrivial_Precondition): Fix
	previously-latent bug uncovered by adding Class_Present
	parameter to Aspect.Find_Aspect. The code was wrong before, but
	with the change the bug was more likely to make a user-visible
	difference.
	* sem_ch6.adb (Analyze_Operator_Symbol): If a string literal
	like "abs" or "-" occurs in a Stable_Properties aspect
	specification, then it is to be interpreted as an operator
	symbol and not as a string literal.
	* sem_ch13.ads: Export new Parse_Aspect_Stable_Properties
	function, analogous to the existing Parse_Aspect_Aggregate
	exported procedure.
	* sem_ch13.adb: (Parse_Aspect_Stable_Properties): New function;
	analogous to existing Parse_Aspect_Aggregate.
	(Validate_Aspect_Stable_Properties): New procedure; analogous to
	existing Validate_Aspect_Aggregate. Called from the same case
	statement (casing on an Aspect_Id value) where
	Validate_Aspect_Aggregate is called.
	(Resolve_Aspect_Stable_Properties): New procedure; analogous to
	existing Resolve_Aspect_Aggregate. Called from the same two case
	statements (each casing on an Aspect_Id value) where
	Resolve_Aspect_Aggregate is called.
	(Analyze_Aspect_Specifications): Set Has_Delayed_Aspects and
	Is_Delayed_Aspect attributes for Aspect_Stable_Properties aspect
	specifications.
	(Check_Aspect_At_End_Of_Declarations): The syntactic
	"expression" for a Stable_Properties aspect specification is not
	semantically an expression; it doesn't have a type. Thus, force
	T to be empty in this case.
	* contracts.adb (Expand_Subprogram_Contract): Add call to new
	local procedure,
	Expand_Subprogram_Contract.Add_Stable_Property_Contracts, which
	generates Postcondition pragmas corresponding to stable property
	checks.
2020-11-27 04:15:56 -05:00
Piotr Trojanek
8ff03120fc [Ada] Default_Initial_Condition assertion policy is now RM defined
gcc/ada/

	* doc/gnat_rm/implementation_defined_pragmas.rst:
	(Assertion_Policy): Move "Default_Initial_Condition" from
	ID_ASSERTION_KIND to RM_ASSERTION_KIND section.
	* gnat_rm.texi: Regenerate.
2020-11-27 04:15:55 -05:00
Piotr Trojanek
79b149b19d [Ada] Sync doc and code for pragma Assertion_Policy
gcc/ada/

	* doc/gnat_rm/implementation_defined_pragmas.rst
	(Assertion_Policy): Add "Default_Initial_Condition",
	"Initial_Condition" and "Subprogram_Variant".
	* gnat_rm.texi: Regenerate.
2020-11-27 04:15:54 -05:00
Piotr Trojanek
3e9238fa64 [Ada] Assertion_Policy is not a valid assertion policy
gcc/ada/

	* sem_prag.adb (Is_Valid_Assertion_Kind): Return False on
	"Assertion_Policy"
2020-11-27 04:15:53 -05:00
Eric Botcazou
e2df202345 [Ada] Do not compile predefined units with -gnatp in gnatmake
gcc/ada/

	* make.adb (GNAT_Flag): Change to "-gnatg".
	(Compile): Adjust comments accordingly.
2020-11-27 04:15:52 -05:00
Piotr Trojanek
cc7c52c1d9 [Ada] Restore general case for folding comparison of static strings
gcc/ada/

	* exp_ch4.adb (Rewrite_Comparison): Add assertion to confirm
	that evaluation folds comparisons with static operands; when
	folding comparison with non-static operands, the resulting
	literal is non-static.
	* sem_eval.adb (Eval_Relational_Op): Refactor nested IF
	statement for the special case in the THEN branch; move code for
	the "general case" out of the ELSE branch.
	* sem_res.adb (Resolve_Comparison_Op): Only apply a dubious
	special-case for GNATprove in the GNATprove_Mode.
2020-11-27 04:15:51 -05:00
Piotr Trojanek
a2481afdfc [Ada] Change parameter from access type to mode out
gcc/ada/

	* sem_eval.ads (Compile_Time_Compare): Change parameter Diff
	from access to mode out.
	* sem_eval.adb (Compile_Time_Compare): Adapt body and callers.
	* sem_attr.adb (Eval_Attribute): Adapt callers.
2020-11-27 04:15:50 -05:00
Eric Botcazou
bc1304f6a1 [Ada] Move down call to Narrow_Large_Operation in Expand_N_Op_Multiply
gcc/ada/

	* exp_ch4.adb (Expand_N_Op_Multiply): Move down block calling
	Narrow_Large_Operation if the type is Universal_Integer.
2020-11-27 04:15:49 -05:00
Eric Botcazou
7943c4dbb8 [Ada] Reimplement Ada.Numerics.Big_Numbers.Big_Reals.Float_Conversions
gcc/ada/

	* libgnat/a-nbnbre.adb: Remove clauses for System.Img_Real and
	add them for System.Unsigned_Types.
	(Float_Conversions.To_Big_Real): Reimplement.
	(Float_Conversions.From_Big_Real): Likewise.
2020-11-27 04:15:48 -05:00
Eric Botcazou
84c54629c2 [Ada] Optimize generation of checks for fixed-point types
gcc/ada/

	* checks.ads (Determine_Range_To_Discrete): New procedure.
	* checks.adb (Apply_Scalar_Range_Check): Call it to determine
	a range for the expression when the target type is discrete.
	And also apply the tests for discrete types to fixed-point
	types when they are treated as integers.
	(Apply_Type_Conversion_Checks): Apply checks to conversions
	involving fixed-point types when they are treated as integers.
	(Determine_Range) <N_Type_Conversion>: Factor out code into...
	(Determine_Range_To_Discrete): ...this new procedure and add
	support for fixed-point types when they are treated as integers.
	* einfo.ads (Type_High_Bound): Remove obsolete sentence.
	(Type_Low_Bound): Likewise.
	* exp_ch4.adb (Discrete_Range_Check): Remove obsolete code.
	(Real_Range_Check): Likewise.
	(Expand_N_Type_Conversion): In case of a no-op conversion, clear
	the Do_Range_Check flag on the operand before substituting it.
	Remove calls to Real_Range_Check and Discrete_Range_Check that
	are not guarded by the Do_Range_Check flag, and an assertion.
	* sem_res.adb (Resolve_Type_Conversion): Always apply range
	checks in GNATprove mode; in normal mode, use the updated type
	of the operand in the test against Universal_Fixed.  Remove
	obsolete code setting the Do_Range_Check flag at the end.
2020-11-27 04:15:47 -05:00
Piotr Trojanek
2d1504186e [Ada] Simplify check for illegal non-returning procedures
gcc/ada/

	* sem_prag.adb (Analyze_Pragma): Change "Ref Manual" to RM;
	replace uses of an unnecessary "Ok" variable with RETURN
	statements; replace nested IF with ELSIF.
2020-11-27 04:15:46 -05:00
Arnaud Charlet
05e59503c6 [Ada] Abort defer mismatch with SJLJ exceptions
gcc/ada/

	* libgnarl/s-tasren.adb (Local_Complete_Rendezvous): Always call
	Defer_Abort.
	* libgnat/a-except.adb: Abort does not need to be deferred.
	* libgnarl/s-tpobop.adb (Exceptional_Complete_Entry_Body): Abort
	never needs to be undeferred here.
	* exp_ch11.adb (Expand_Exception_Handlers): Remove difference
	between ZCX and SJLJ.
	* exp_ch9.adb (Expand_N_Asynchronous_Select): Remove different
	handling for sjlj.
	* exp_sel.ads, exp_sel.adb (Build_Abort_Block,
	Build_Abort_Block_Handler): Ditto.
2020-11-27 04:15:45 -05:00
Ghjuvan Lacambre
bf85ff03b3 [Ada] Emit error messages for null/generic nonreturning procedures
gcc/ada/

	* sem_prag.adb (Analyze_Pragma): declare new Check_No_Return
	function and call it.
2020-11-27 04:15:44 -05:00
Arnaud Charlet
78287696dc [Ada] Fix tree for expanded instantiations corresponding to formal packages
gcc/ada/

	* sem_ch12.adb (Instantiate_Object): Consistently use
	New_Copy_Tree instead of New_Copy.
2020-11-27 04:15:43 -05:00
Eric Botcazou
94a5437d3b [Ada] Adjust head comment of various subprograms in Exp_Fixd
gcc/ada/

	* exp_fixd.adb (Build_Conversion): Adjust head comment.
	(Build_Divide): Likewise.
	(Build_Double_Divide): Likewise.
	(Build_Multiply): Likewise.
	(Build_Rem): Likewise.
	(Build_Scaled_Divide): Likewise.
2020-11-27 04:15:42 -05:00
Arnaud Charlet
946a5b8d64 [Ada] To_Big_Integer and 128bits integers
gcc/ada/

	* libgnat/s-genbig.ads, libgnat/s-genbig.adb (To_Bignum): New
	variant taking an Unsigned_128.
	* libgnat/a-nbnbin.adb (To_Big_Integer): Add support for 128
	bits signed and unsigned types.
2020-11-27 04:15:41 -05:00
Eric Botcazou
69144d4868 [Ada] Small tweaks to new implementation of Set_Image_Fixed
gcc/ada/

	* libgnat/s-imagef.adb (Set_Image_Fixed): Pass the full value
	of the quotient to Set_Image_Integer during the first round and
	adjust the handling of the minus sign.
2020-11-27 04:15:41 -05:00
Arnaud Charlet
9df8679166 [Ada] Error in Big_Real comparison
gcc/ada/

	* libgnat/a-nbnbre.adb ("=", "<"): Fix.
2020-11-27 04:15:40 -05:00
Eric Botcazou
890cfc503a [Ada] Fix oversignt in genericized package System.Value_R
gcc/ada/

	* libgnat/s-valuer.adb (Scan_Raw_Real): Move pragma Annotate around
	and adjust its parameters.
2020-11-27 04:15:39 -05:00
Eric Botcazou
73e07f1cd9 [Ada] Optimize magnitude of integer operations for fixed point
gcc/ada/

	* exp_fixd.adb (Build_Double_Divide): Use the RM size of types and
	a more precise estimate for the size of the denominator.
	(Build_Double_Divide_Code): Likewise.
	(Build_Multiply): Use a more precise estimate for the size of the
	result.
	(Build_Scaled_Divide):  Use the RM size of types and a more precise
	estimate for the size of the numerator.
	(Build_Scaled_Divide_Code): Likewise.
2020-11-27 04:15:38 -05:00
Xionghu Luo
5e9f814d75 rs6000: Change rs6000_expand_vector_set param
rs6000_expand_vector_set could accept insert either to constant position
or variable position, so change the operand to reg_or_cint_operand.

gcc/ChangeLog:

2020-11-27  Xionghu Luo  <luoxhu@linux.ibm.com>

	* config/rs6000/rs6000-call.c (altivec_expand_vec_set_builtin):
	Change call param 2 from type int to rtx.
	* config/rs6000/rs6000-protos.h (rs6000_expand_vector_set):
	Likewise.
	* config/rs6000/rs6000.c (rs6000_expand_vector_init):
	Change call param 2 from type int to rtx.
	(rs6000_expand_vector_set): Likewise.
	* config/rs6000/vector.md (vec_set<mode>): Support both constant
	and variable index vec_set.
2020-11-26 23:38:33 -06:00
Haochen Gui
3493b0c328 This patch adds absolute jump table support for rs6000.
gcc/ChangeLog:

	* config/rs6000/rs6000-protos.h (rs6000_output_addr_vec_elt): Declare.
	* config/rs6000/rs6000.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
	Define.
	(rs6000_gen_pic_addr_diff_vec, rs6000_output_addr_vec_elt): Implement.
	* config/rs6000/rs6000.h (CASE_VECTOR_PC_RELATIVE,
	CASE_VECTOR_MODE, ASM_OUTPUT_ADDR_VEC_ELT): Define.
	* config/rs6000/rs6000.md (tablejump<mode>_absolute,
	tablejump<mode>_absolute_nospec): New expanders.
	* config/rs6000/rs6000.opt (mrelative-jumptables): New.
2020-11-27 09:11:20 +08:00
GCC Administrator
d48df6f24b Daily bump. 2020-11-27 00:16:31 +00:00
Jonathan Wakely
61c71a6245 libstdc++: Define (and use) _GLIBCXX_HAVE_ATOMIC_WAIT
In order to simplify the preprocessor checks for whether __atomic_wait
is available, this commit does:

-#if defined _GLIBCXX_HAS_GTHREADS || _GLIBCXX_HAVE_LINUX_FUTEX
+#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT

The original was wrong anyway, as it should have used 'defined' to check
_GLIBCXX_HAVE_LINUX_FUTEX (for consistency with how that's used
elsewhere).

The new macro is defined in <bits/atomic_wait.h> when the file is
defines __atomic_wait and related facilities. All other code that
depends on those features can just check the one macro.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h (_GLIBCXX_HAVE_ATOMIC_WAIT):
	Define.
	* include/bits/atomic_base.h: Check _GLIBCXX_HAVE_ATOMIC_WAIT.
	* include/bits/atomic_timed_wait.h: Likewise.
	* include/bits/semaphore_base.h: Likewise.
	* include/std/atomic: Likewise.
	* include/std/latch: Likewise.
	* include/std/semaphore: Likewise.
2020-11-26 23:53:09 +00:00
Jonathan Wakely
7198827486 libstdc++: Only define std::latch if atomic waiting is available
libstdc++-v3/ChangeLog:

	* include/std/latch: Depend on _GLIBCXX_HAS_GTHREADS and
	_GLIBCXX_HAVE_LINUX_FUTEX.
	* include/std/version (__cpp_lib_latch): Define conditionally.
2020-11-26 22:36:44 +00:00
Jonathan Wakely
1a00786414 libstc++: Fix typo in new check_effective_target_gthreads proc
Also fix copy&pasted comments referring to the wrong things.

libstdc++-v3/ChangeLog:

	* testsuite/lib/libstdc++.exp (check_effective_target_gthreads):
	Call check_v3_target_gthreads not check_v3_target_gthreads_timed.
2020-11-26 21:43:18 +00:00
Maciej W. Rozycki
beb9afcaf1 libgfortran: Verify the presence of all functions for POSIX 2008 locale
While we have `configure' checks for the individual POSIX 2008 extended
locale functions we refer to and use to guard the respective call sites,
we only verify the presence of `newlocale' for our global feature enable
check.  Consequently compilation fails for targets like NetBSD that only
have partial support for POSIX 2008 locale features and in particular
lack the `uselocale' function:

.../libgfortran/io/transfer.c: In function 'data_transfer_init_worker':
.../libgfortran/io/transfer.c:3416:30: error:
'old_locale_lock' undeclared (first use in this function)
 3416 |       __gthread_mutex_lock (&old_locale_lock);
      |                              ^~~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:3416:30: note: each undeclared identifier is reported only once for each function it appears in
.../libgfortran/io/transfer.c:3417:12: error:
'old_locale_ctr' undeclared (first use in this function)
 3417 |       if (!old_locale_ctr++)
      |            ^~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:3419:11: error:
'old_locale' undeclared (first use in this function); did you mean 'c_locale'?
 3419 |           old_locale = setlocale (LC_NUMERIC, NULL);
      |           ^~~~~~~~~~
      |           c_locale
.../libgfortran/io/transfer.c: In function 'finalize_transfer':
.../libgfortran/io/transfer.c:4253:26: error:
'old_locale_lock' undeclared (first use in this function)
 4253 |   __gthread_mutex_lock (&old_locale_lock);
      |                          ^~~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:4254:10: error:
'old_locale_ctr' undeclared (first use in this function)
 4254 |   if (!--old_locale_ctr)
      |          ^~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:4256:30: error:
'old_locale' undeclared (first use in this function); did you mean 'c_locale'?
 4256 |       setlocale (LC_NUMERIC, old_locale);
      |                              ^~~~~~~~~~
      |                              c_locale
make[3]: *** [Makefile:6221: transfer.lo] Error 1

Only enable the use of POSIX 2008 extended locale features then when all
the three functions required are present, removing said build errors.

	libgfortran/
	* io/io.h [HAVE_NEWLOCALE]: Also check for HAVE_FREELOCALE and
	HAVE_USELOCALE.
	[HAVE_FREELOCALE && HAVE_NEWLOCALE && HAVE_USELOCALE]
	(HAVE_POSIX_2008_LOCALE): New macro.
	(st_parameter_dt) [HAVE_NEWLOCALE]: Check for
	HAVE_POSIX_2008_LOCALE instead.
	* io/transfer.c (data_transfer_init_worker, finalize_transfer)
	[HAVE_USELOCALE]: Check for HAVE_POSIX_2008_LOCALE instead.
	* io/unit.c [HAVE_NEWLOCALE]: Likewise.
	(init_units) [HAVE_NEWLOCALE]: Likewise.
	(close_units) [HAVE_FREELOCALE]: Likewise.
	* runtime/error.c (gf_strerror) [HAVE_USELOCALE]: Likewise.
2020-11-26 17:26:43 +00:00
Maciej W. Rozycki
c87cce5a33 libgfortran: Correct FP feature macro checks
The *_HAS_* floating-point feature macros are defined as 0/1 rather than
#undef/#define settings by gcc/c-family/c-cppbuiltin.c.  Consequently we
choose to use infinity and NaN features even with non-IEEE-754 targets
such as `vax-netbsdelf' that lack them, causing build warnings and
failures like:

In file included from .../libgfortran/generated/maxval_r4.c:26:
.../libgfortran/generated/maxval_r4.c: In function 'maxval_r4':
.../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity
  292 | # define GFC_REAL_4_INFINITY __builtin_inff ()
      |                              ^~~~~~~~~~~~~~
.../libgfortran/generated/maxval_r4.c:149:19:
note: in expansion of macro 'GFC_REAL_4_INFINITY'
  149 |         result = -GFC_REAL_4_INFINITY;
      |                   ^~~~~~~~~~~~~~~~~~~
.../libgfortran/generated/maxval_r4.c: In function 'mmaxval_r4':
.../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity
  292 | # define GFC_REAL_4_INFINITY __builtin_inff ()
      |                              ^~~~~~~~~~~~~~
.../libgfortran/generated/maxval_r4.c:363:19:
note: in expansion of macro 'GFC_REAL_4_INFINITY'
  363 |         result = -GFC_REAL_4_INFINITY;
      |                   ^~~~~~~~~~~~~~~~~~~
{standard input}: Assembler messages:
{standard input}:204: Fatal error: Can't relocate expression
make[3]: *** [Makefile:3358: maxval_r4.lo] Error 1

Correct the checks then for __FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__,
__LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__, __DBL_HAS_QUIET_NAN__, and
__LDBL_HAS_QUIET_NAN__ to match semantics and remove build issues coming
from the misinterpretation of these macros.

	libgfortran/
	* libgfortran.h: Use #if rather than #ifdef with
	__FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__,
	__LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__,
	__DBL_HAS_QUIET_NAN__, and __LDBL_HAS_QUIET_NAN__.
2020-11-26 17:26:43 +00:00
Jonathan Wakely
218cedd5a3 libstdc++: Set dg-timeout-factor for some slow tests
These tests are very, very slow to compile. If the testsuite is run with
a low tool_timeout value they are likely to fail. By adding a
multiplication factor to those tests, it's still possible to use a low
timeout without spurious failures.

libstdc++-v3/ChangeLog:

	* testsuite/28_regex/algorithms/regex_match/basic/string_range_01_03.cc:
	Add dg-timeout-factor directive.
	* testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/63199.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/cjk_match.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_search/61720.cc: Likewise.
	* testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc:
	Likewise.
	* testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc:
	Likewise.
	* testsuite/28_regex/basic_regex/ctors/deduction.cc: Likewise.
2020-11-26 16:15:53 +00:00
Jonathan Wakely
39e837cd75 libstdc++: Allow dejagnu tool_timeout to be overridden
This allows the default timeout for libstdc++ tests to be set by the
user, either in ~/.dejagnurc or a site.exp file that $DEJAGNU names.

libstdc++-v3/ChangeLog:

	* testsuite/lib/libstdc++.exp (libstdc++_init): Only set
	tool_timeout if it hasn't been set by the user already.
2020-11-26 16:15:53 +00:00
Jonathan Wakely
10522ed108 libstdc++: Fix some more deadlocks in tests [PR 97936]
The missed notifications fixed in r11-5383 also happen in some other
tests which have similar code.

libstdc++-v3/ChangeLog:

	PR libstdc++/97936
	* testsuite/29_atomics/atomic/wait_notify/bool.cc: Fix missed
	notifications by making the new thread wait until the parent
	thread is waiting on the condition variable.
	* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
	* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.
2020-11-26 16:15:52 +00:00
Jonathan Wakely
10ee46adf4 libstdc++: Add "futex" and "gthreads" effective-target keywords
This adds a new "futex" effective-target keyword that can be used to
selectively enable/disable tests based on _GLIBCXX_HAVE_LINUX_FUTEX,
instead of checking for that macro in the code.

It also adds "gthreads" as another one, to make the result of the
dg-require-gthreads directive usable in target selectors.

With these new keywords two tests that are currently only run for linux
can also be run for targets using gthr-single.h (e.g. AIX single-thread
multilib, and targets without a gthreads implementation).

libstdc++-v3/ChangeLog:

	* testsuite/18_support/96817.cc: Use new effective-target
	keywords to select supported targets more effectively.
	* testsuite/30_threads/call_once/66146.cc: Likewise.
	* testsuite/lib/libstdc++.exp (check_effective_target_futex):
	Define new proc.
	(check_effective_target_gthreads): Define new proc to replace
	dg-require-gthreads.
2020-11-26 16:15:52 +00:00
Eric Botcazou
294e72e9ac Fix PR target/96607
After 15 years trying to find out what can go into the delay slot of
the call to __tls_get_addr with the Solaris linker, it's now time to
concede defeat and consider it as not to be filled.

gcc/ChangeLog:
	PR target/96607
	* config/sparc/sparc-protos.h (eligible_for_call_delay): Delete.
	* config/sparc/sparc.c (eligible_for_call_delay): Likewise.
	* config/sparc/sparc.md (in_call_delay): Likewise.
	(tls_delay_slot): New attribute.
	(define_delay [call]): Use in_branch_delay.
	(tgd_call<P:mode>): Set type to call_no_delay_slot when
	tls_delay_slot is false.
	(tldm_call<P:mode>): Likewise.
2020-11-26 16:42:31 +01:00
Jakub Jelinek
a3ebc13492 match.pd: Use ranges to optimize some x * y / y to x [PR97997]
For signed integers with undefined overflow we already optimize x * y / y
into x, but for signed integers with -fwrapv or unsigned integers we don't.
The following patch allows optimizing that into just x if value ranges
prove that x * y will never overflow.
It uses the global SSA_NAME_RANGE_INFO only, because like mentioned
in another PR we don't currently have a way to tell the ranger from match.pd
the use stmt (and we'd need in that case to tell ranger to only follow
SSA_NAME_DEF_STMTs + SSA_NAME_RANGE_INFO and never go in the other
direction, as following immediate uses seems forbidden in match.pd).
Another possibility would be to optimize this during vrp, but on the
other side the optimization itself is match.pd-ish.

2020-11-26  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/97997
	* match.pd ((t * 2) / 2) -> t): Optimize even for defined
	overflow if ranges prove there is no overflow.

	* gcc.dg/tree-ssa/pr97997-1.c: New test.
	* gcc.dg/tree-ssa/pr97997-2.c: New test.
2020-11-26 16:24:07 +01:00