Commit Graph

189499 Commits

Author SHA1 Message Date
Yannick Moy
94396a27bc [Ada] Create explicit ghost mirror unit for big integers
gcc/ada/

	* Makefile.rtl: Add unit.
	* libgnat/a-nbnbin__ghost.adb: Move...
	* libgnat/a-nbnbig.adb: ... here. Mark ghost as ignored.
	* libgnat/a-nbnbin__ghost.ads: Move...
	* libgnat/a-nbnbig.ads: ... here.  Add comment for purpose of
	this unit. Mark ghost as ignored.
	* libgnat/s-widthu.adb: Use new unit.
	* sem_aux.adb (First_Subtype): Adapt to the case of a ghost type
	whose freeze node is rewritten to a null statement.
2021-11-10 08:57:39 +00:00
Etienne Servais
a0546e1a16 [Ada] Fix Constraint error on rexgexp close bracket find algorithm
gcc/ada/

	* libgnat/s-regexp.adb (Check_Well_Formed_Pattern): Fix
	Constraint_Error on missing close bracket.
2021-11-10 08:57:39 +00:00
Piotr Trojanek
7eafa54f12 [Ada] Extend optimized equality of 2-element arrays
gcc/ada/

	* exp_ch4.adb (Expand_Array_Equality): Remove check of the array
	bound being an N_Range node; use Type_High_Bound/Type_Low_Bound,
	which handle all kinds of array bounds.
2021-11-10 08:57:38 +00:00
Etienne Servais
f51d1dde83 [Ada] Warn when interfaces swapped between full and partial view
gcc/ada/

	* sem_ch3.adb (Derived_Type_Declaration): Introduce a subprogram
	for tree transformation. If a tree transformation is performed,
	then warn that it would be better to reorder the interfaces.
2021-11-10 08:57:38 +00:00
Eric Botcazou
8c787be254 [Ada] Add guard against previous error for peculiar ACATS test
gcc/ada/

	* sem_ch4.adb (Find_Non_Universal_Interpretations): Add guard.
2021-11-10 08:57:38 +00:00
Yannick Moy
29900c061a [Ada] Better error message on missing parentheses
gcc/ada/

	* par-ch4.adb (P_Primary): Adapt test for getting error message
	on missing parentheses.
2021-11-10 08:57:37 +00:00
liuhongt
249b4eeef1 Extend is_cond_scalar_reduction to handle bit_and/bit_xor/bit_ior.
This will enable transformation like

-  # sum1_50 = PHI <prephitmp_64(13), 0(4)>
-  # sum2_52 = PHI <sum2_21(13), 0(4)>
+  # sum1_50 = PHI <_87(13), 0(4)>
+  # sum2_52 = PHI <_89(13), 0(4)>
   # ivtmp_62 = PHI <ivtmp_61(13), 64(4)>
   i.2_7 = (long unsigned int) i_49;
   _8 = i.2_7 * 8;
...
   vec1_i_38 = vec1_29 >> _10;
   vec2_i_39 = vec2_31 >> _10;
   _11 = vec1_i_38 & 1;
-  _63 = tmp_37 ^ sum1_50;
-  prephitmp_64 = _11 == 0 ? sum1_50 : _63;
+  _ifc__86 = _11 != 0 ? tmp_37 : 0;
+  _87 = sum1_50 ^ _ifc__86;
   _12 = vec2_i_39 & 1;
:

so that vectorizer won't failed due to

  /* If this isn't a nested cycle or if the nested cycle reduction value
     is used ouside of the inner loop we cannot handle uses of the reduction
     value.  */
  if (nlatch_def_loop_uses > 1 || nphi_def_loop_uses > 1)
    {
      if (dump_enabled_p ())
	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
			 "reduction used in loop.\n");
      return NULL;
    }

gcc/ChangeLog:

	PR tree-optimization/103126
	* tree-vect-loop.c (neutral_op_for_reduction): Remove static.
	* tree-vectorizer.h (neutral_op_for_reduction): Declare.
	* tree-if-conv.c : Include tree-vectorizer.h.
	(is_cond_scalar_reduction): Handle
	BIT_XOR_EXPR/BIT_IOR_EXPR/BIT_AND_EXPR.
	(convert_scalar_cond_reduction): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/ifcvt-reduction-logic-op.c: New test.
2021-11-10 16:28:42 +08:00
konglin1
f2572a398d i386: Support complex fma/conj_fma for _Float16.
Support cmla_optab, cmul_optab, cmla_conj_optab, cmul_conj_optab for vector _Float16.

gcc/ChangeLog:

	* config/i386/sse.md (cmul<conj_op><mode>3): add new define_expand.
	(cmla<conj_op><mode>4): Likewise

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-vector-complex-float.c: New test.
2021-11-10 15:10:23 +08:00
Aldy Hernandez
9299f69027 Remove unused gimple-ssa-evr-analyze.h header file.
gcc/ChangeLog:

	* tree-ssa-threadedge.c: Do not include
	gimple-ssa-evrp-analyze.h.
	* value-pointer-equiv.cc: Same.
2021-11-10 08:04:08 +01:00
Aldy Hernandez
a2ab1a5ade Include PHI threading restrictions in backthreader diagnostics.
I forgot to include the path dump when failing a path in resolve_phi.
To do so I abstracted dump_path into its own function, which made me
realize we had another copy with slightly different output.

I've merged everything and cleaned it up.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c
	(back_threader::maybe_register_path_dump): Abstract path dumping...
	(dump_path): ...here.
	(back_threader::resolve_phi): Call dump_path.
	(debug): Same.
2021-11-10 07:46:59 +01:00
konglin1
60e3179b7a i386: Optimization for mm512_set1_pch.
This patch is to support fold _mm512_fmadd_pch (a, _mm512_set1_pch(*(b)), c)
to 1 instruction vfmaddcph (%rsp){1to16}, %zmm1, %zmm2;

gcc/ChangeLog:

	* config/i386/sse.md (fma_<complexpairopname>_<mode>_pair):
	Add new define_insn.
	(fma_<mode>_fmaddc_bcst): Add new define_insn_and_split.
	(fma_<mode>_fcmaddc_bcst): Likewise

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16vl-complex-broadcast-1.c: New test.
2021-11-10 14:36:59 +08:00
liuhongt
b879d40a17 Simplify (trunc)MAX/MIN((extend)a, (extend)b) to MAX/MIN(a,b)
a and b are same type as trunc type and has less precision than
extend type.

gcc/ChangeLog:

	PR target/102464
	* match.pd: Simplify (trunc)fmax/fmin((extend)a, (extend)b) to
	MAX/MIN(a,b)

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr102464-maxmin.c: New test.
2021-11-10 14:31:22 +08:00
Andrew Pinski
52fa771758 aarch64: [PR101529] Fix vector shuffle insertion expansion
The function aarch64_evpc_ins would reuse the target even though
it might be the same register as the two inputs.
Instead of checking to see if we can reuse the target, just use the
original input directly.

Committed as approved after bootstrapped and tested on
aarch64-linux-gnu with no regressions.

	PR target/101529

gcc/ChangeLog:

	* config/aarch64/aarch64.c (aarch64_evpc_ins): Don't use target
	as an input, use original one.

gcc/testsuite/ChangeLog:

	* c-c++-common/torture/builtin-convertvector-2.c: New test.
	* c-c++-common/torture/builtin-shufflevector-2.c: New test.
2021-11-10 04:06:54 +00:00
Sandra Loosemore
d581cf9c2f Nios2: Add TARGET_CAN_INLINE_P hook.
2021-11-09  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* config/nios2/nios2.c (nios2_can_inline_p): New.
	(TARGET_CAN_INLINE_P): Define.

	gcc/testsuite/
	* gcc.target/nios2/custom-fp-inline-1.c: New.
	* gcc.target/nios2/custom-fp-inline-2.c: New.
	* gcc.target/nios2/custom-fp-inline-3.c: New.
	* gcc.target/nios2/custom-fp-inline-4.c: New.
2021-11-09 18:00:54 -08:00
GCC Administrator
c9b1334eec Daily bump. 2021-11-10 00:16:28 +00:00
David Malcolm
8722a17067 c: more precise locations for some -Wpragmas diagnostics
gcc/c-family/ChangeLog:
	* c-pragma.c (GCC_BAD_AT): New macro.
	(GCC_BAD2_AT): New macro.
	(handle_pragma_pack): Use the location of the pertinent token when
	issuing diagnostics about invalid constants/actions, and trailing
	junk.
	(handle_pragma_target): Likewise for non-string "GCC option".
	(handle_pragma_message): Likewise for trailing junk.

gcc/testsuite/ChangeLog:
	* gcc.dg/bad-pragma-locations.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-11-09 18:25:44 -05:00
Bill Schmidt
96276f9935 rs6000: Match recent builtins changes in new builtins support
2021-11-09  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (rs6000_gimple_fold_new_builtin):
	Disable gimple fold for RS6000_BIF_{XVMINDP,XVMINSP,VMINFP} and
	RS6000_BIF_{XVMAXDP,XVMAXSP,VMAXFP} when fast-math is not set.
	(lxvrse_expand_builtin): Modify the expansion for sign extension.
	All extensions are done within VSX registers.

gcc/testsuite/
	* gcc.target/powerpc/p10_vec_xl_sext.c: Fix long long case.
2021-11-09 15:48:33 -06:00
Bernhard Reutner-Fischer
8875a92d31 Fortran: Fix memory leak in finalization wrappers [PR68800]
If a finalization is not required we created a namespace containing
formal arguments for an internal interface definition but never used
any of these. So the whole sub_ns namespace was not wired up to the
program and consequently was never freed. The fix is to simply not
generate any finalization wrappers if we know that it will be unused.
Note that this reverts back to the original r190869
(8a96d64282ac534cb597f446f02ac5d0b13249cc) handling for this case
by reverting this specific part of r194075
(f1ee56b4be7cc3892e6ccc75d73033c129098e87) for PR fortran/37336.

valgrind summary for e.g.
gfortran.dg/abstract_type_3.f03 and gfortran.dg/abstract_type_4.f03
where ".orig" is pristine trunk and ".mine" contains this fix:

at3.orig.vg:LEAK SUMMARY:
at3.orig.vg-   definitely lost: 8,460 bytes in 11 blocks
at3.orig.vg-   indirectly lost: 13,288 bytes in 55 blocks
at3.orig.vg-     possibly lost: 0 bytes in 0 blocks
at3.orig.vg-   still reachable: 572,278 bytes in 2,142 blocks
at3.orig.vg-        suppressed: 0 bytes in 0 blocks
at3.orig.vg-
at3.orig.vg-Use --track-origins=yes to see where uninitialised values come from
at3.orig.vg-ERROR SUMMARY: 38 errors from 33 contexts (suppressed: 0 from 0)
--
at3.mine.vg:LEAK SUMMARY:
at3.mine.vg-   definitely lost: 344 bytes in 1 blocks
at3.mine.vg-   indirectly lost: 7,192 bytes in 18 blocks
at3.mine.vg-     possibly lost: 0 bytes in 0 blocks
at3.mine.vg-   still reachable: 572,278 bytes in 2,142 blocks
at3.mine.vg-        suppressed: 0 bytes in 0 blocks
at3.mine.vg-
at3.mine.vg-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
at3.mine.vg-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
at4.orig.vg:LEAK SUMMARY:
at4.orig.vg-   definitely lost: 13,751 bytes in 12 blocks
at4.orig.vg-   indirectly lost: 11,976 bytes in 60 blocks
at4.orig.vg-     possibly lost: 0 bytes in 0 blocks
at4.orig.vg-   still reachable: 572,278 bytes in 2,142 blocks
at4.orig.vg-        suppressed: 0 bytes in 0 blocks
at4.orig.vg-
at4.orig.vg-Use --track-origins=yes to see where uninitialised values come from
at4.orig.vg-ERROR SUMMARY: 18 errors from 16 contexts (suppressed: 0 from 0)
--
at4.mine.vg:LEAK SUMMARY:
at4.mine.vg-   definitely lost: 3,008 bytes in 3 blocks
at4.mine.vg-   indirectly lost: 4,056 bytes in 11 blocks
at4.mine.vg-     possibly lost: 0 bytes in 0 blocks
at4.mine.vg-   still reachable: 572,278 bytes in 2,142 blocks
at4.mine.vg-        suppressed: 0 bytes in 0 blocks
at4.mine.vg-
at4.mine.vg-ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
at4.mine.vg-ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)

gcc/fortran/ChangeLog:

2018-10-12  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	PR fortran/68800
	* class.c (generate_finalization_wrapper): Do not leak
	finalization wrappers if they will not be used.
	* expr.c (gfc_free_actual_arglist): Formatting fix.
	* gfortran.h (gfc_free_symbol): Pass argument by reference.
	(gfc_release_symbol): Likewise.
	(gfc_free_namespace): Likewise.
	* symbol.c (gfc_release_symbol): Adjust acordingly.
	(free_components): Set procedure pointer components
	of derived types to NULL after freeing.
	(free_tb_tree): Likewise.
	(gfc_free_symbol): Set sym to NULL after freeing.
	(gfc_free_namespace): Set namespace to NULL after freeing.
2021-11-09 21:56:49 +01:00
François Dumont
f4b4ce152a libstdc++: [_GLIBCXX_DEBUG] Implement unordered container merge
The _GLIBCXX_DEBUG unordered containers need a dedicated merge implementation
so that any existing iterator on the transfered nodes is properly invalidated.

Add typedef/using declarations for everything used as-is from normal implementation.

libstdc++-v3/ChangeLog:

	* include/bits/hashtable_policy.h (__distance_fw): Replace class keyword with
	typename.
	* include/bits/hashtable.h (_Hashtable<>::_M_merge_unique): Remove noexcept
	qualification. Use const_iterator for node extraction/reinsert.
	(_Hashtable<>::_M_merge_multi): Likewise. Compute new hash code before extract.
	* include/debug/safe_container.h (_Safe_container<>): Make all methods
	protected.
	* include/debug/safe_unordered_container.h
	(_Safe_unordered_container<>::_UContInvalidatePred<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_UMContInvalidatePred<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_UContMergeGuard<_Source, _InvalidatePred>): New.
	(_Safe_unordered_container<>::_S_uc_guard<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_S_umc_guard<_ExtractKey, _Source>): New.
	(_Safe_unordered_container<>::_M_invalide_all): Make public.
	(_Safe_unordered_container<>::_M_invalide_if): Likewise.
	(_Safe_unordered_container<>::_M_invalide_local_if): Likewise.
	* include/debug/unordered_map
	(unordered_map<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_map<>::reference, const_reference, difference_type): New typedef.
	(unordered_map<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_map<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_map<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_map<>::operator[], at, rehash, reserve): Add usings.
	(unordered_map<>::merge): New.
	(unordered_multimap<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_multimap<>::reference, const_reference, difference_type): New typedef.
	(unordered_multimap<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_multimap<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_multimap<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_multimap<>::rehash, reserve): Add usings.
	(unordered_multimap<>::merge): New.
	* include/debug/unordered_set
	(unordered_set<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_set<>::reference, const_reference, difference_type): New typedef.
	(unordered_set<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_set<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_set<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_set<>::rehash, reserve): Add usings.
	(unordered_set<>::merge): New.
	(unordered_multiset<>::mapped_type, pointer, const_pointer): New typedef.
	(unordered_multiset<>::reference, const_reference, difference_type): New typedef.
	(unordered_multiset<>::get_allocator, empty, size, max_size): Add usings.
	(unordered_multiset<>::bucket_count, max_bucket_count, bucket): Add usings.
	(unordered_multiset<>::hash_function, key_equal, count, contains): Add usings.
	(unordered_multiset<>::rehash, reserve): Add usings.
	(unordered_multiset<>::merge): New.
	* testsuite/23_containers/unordered_map/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_map/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_map/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_map/debug/merge4_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/merge4_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/merge4_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge1_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge2_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge3_neg.cc: New test.
	* testsuite/23_containers/unordered_set/debug/merge4_neg.cc: New test.
	* testsuite/util/testsuite_abi.h: [_GLIBCXX_DEBUG] Use normal unordered
	container implementation.
2021-11-09 21:50:17 +01:00
Andrew Pinski
f7844b6a77 [Committed] Fix tree-optimization/103152: Still one more -signed1bit issue
When I fixed PR 102622, I accidently left behind a TYPE_PRECISION
check which I had there for checking before hand.  This check
is not needed as the code will handle it correctly anyways.

Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

	PR tree-optimization/10352

gcc/ChangeLog:

	* match.pd: Remove check of TYPE_PRECISION for
	the a?0:pow2 case.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/pr10352-1.c: New test.
2021-11-09 19:01:57 +00:00
Andrew MacLeod
56af35de3d Keep x_range_query NULL for global ranges.
Instead of x_range_query always pointing to an object, have it default to
NULL and return a pointer to the global query in that case.

	* function.c (allocate_struct_function): Don't set x_range_query.
	* function.h (get_range_query): Move to value-query.h.
	* gimple-range.cc (enable_ranger): Check that query is currently NULL.
	(disable_ranger): Clear function current query field.
	* value-query.cc (get_global_range_query): Relocate to:
	* value-query.h (get_global_range_query): Here and inline.
	(get_range_query): Relocate here from function.h.
2021-11-09 13:27:42 -05:00
Aldy Hernandez
53080c5b4c Dump details of an attempt to register a jump threading path.
The goal with these sets of patches is to improve the detailed dumps for
the threader, as I hope we eventually reach the point when I'm not
the only one looking at these dumps ;-).

This patch adds candidate paths to the detailed threading dumps to make it
easier to see the decisions the threader makes.  With it we can now
grep for the discovery logic in action:

$ grep ^path: a.ii.*thread*
a.ii.034t.ethread:path: 4->5->xx REJECTED
a.ii.034t.ethread:path: 3->5->8 SUCCESS
a.ii.034t.ethread:path: 4->5->6 SUCCESS
a.ii.034t.ethread:path: 0->2->xx REJECTED
a.ii.034t.ethread:path: 0->2->xx REJECTED
...
...
a.ii.111t.threadfull1:path: 14->22->23->xx REJECTED (unreachable)
a.ii.111t.threadfull1:path: 15->22->23->xx REJECTED (unreachable)
a.ii.111t.threadfull1:path: 16->22->23->xx REJECTED (unreachable)

In addition to this, if --param=threader-debug=all is used, one can see
the entire chain of events leading up to the ultimate threading
decision:

==============================================
path_range_query: compute_ranges for path: 2->5
 Registering killing_def (path_oracle) _3
 Registering killing_def (path_oracle) _1
range_defined_in_block (BB2) for _1 is _Bool VARYING
 Registering killing_def (path_oracle) _2
range_defined_in_block (BB2) for _2 is _Bool VARYING
range_defined_in_block (BB2) for _3 is _Bool VARYING
outgoing_edge_range_p for b_10(D) on edge 2->5 is int VARYING
...
... [BBs and gimple along path]
...
path: 2->5->xx REJECTED

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c
	(back_threader::maybe_register_path_dump): New.
	(back_threader::maybe_register_path): Call maybe_register_path_dump.
2021-11-09 18:23:44 +01:00
Aldy Hernandez
2b59cf475a Return NULL for maybe_register_path when unprofitable.
This is a minor cleanup for maybe_register_path to return NULL when
the path is unprofitable.  It is needed for a follow-up patch to
generate better dumps from the threader.

There is no change in behavior, since the only call to this function
bails on !profitable_path_p.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c (back_threader::maybe_register_path):
	Return NULL when unprofitable.
2021-11-09 18:23:43 +01:00
Martin Jambor
2d60c0a3ee
Introduce build_debug_expr_decl
This patch introduces a helper function build_debug_expr_decl to build
DEBUG_EXPR_DECL tree nodes in the most common way and replaces with a
call of this function all code pieces which build such a DECL itself
and sets its mode to the TYPE_MODE of its type.

There still remain 11 instances of open-coded creation of a
DEBUG_EXPR_DECL which set the mode of the DECL to something else.  It
would probably be a good idea to figure out that has any effect and if
not, convert them to calls of build_debug_expr_decl too.  But this
patch deliberately does not introduce any functional changes.

gcc/ChangeLog:

2021-11-08  Martin Jambor  <mjambor@suse.cz>

	* tree.h (build_debug_expr_decl): Declare.
	* tree.c (build_debug_expr_decl): New function.
	* cfgexpand.c (avoid_deep_ter_for_debug): Use build_debug_expr_decl
	instead of building a DEBUG_EXPR_DECL.
	* ipa-param-manipulation.c
	(ipa_param_body_adjustments::prepare_debug_expressions): Likewise.
	* omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise.
	* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise.
	* tree-ssa-phiopt.c (spaceship_replacement): Likewise.
	* tree-ssa-reassoc.c (make_new_ssa_for_def): Likewise.
2021-11-09 17:54:28 +01:00
Martin Liska
3bc3f6cefc Remove dead Fortran function.
gcc/fortran/ChangeLog:

	* symbol.c (gfc_get_ultimate_derived_super_type): Remove.
2021-11-09 17:53:20 +01:00
Bill Schmidt
5aa7a09369 rs6000: Debug support for builtins changes
2021-11-09  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (rs6000_type_string): New function.
	(def_builtin): Change debug formatting for easier parsing and
	include more information.
	(rs6000_init_builtins): Add dump of autogenerated builtins.
	(altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
	completeness.
2021-11-09 10:44:05 -06:00
Marek Polacek
a648acc3b4 c++: Skip unnamed bit-fields more
As Jason noticed in
<https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583592.html>,
we shouldn't require an initializer for an unnamed bit-field, because,
as [class.bit] says, they cannot be initialized.

gcc/cp/ChangeLog:

	* class.c (default_init_uninitialized_part): Use
	next_initializable_field.
	* method.c (walk_field_subobs): Skip unnamed bit-fields.

gcc/testsuite/ChangeLog:

	* g++.dg/init/bitfield6.C: New test.
2021-11-09 11:36:19 -05:00
Marek Polacek
78dd0de956 ipa: Fix typo in ipa-modref.c
gcc/ChangeLog:

	* ipa-modref.c (analyze_parms): Fix a typo.
2021-11-09 11:29:13 -05:00
Kito Cheng
abe562bb01 [PR/target 102957] Allow Z*-ext extension with only 2 char.
We was assume the Z* extension should be more than 2 char, so we put an
assertion there, but it should just an error or warning rather than an
assertion, however RISC-V has add `Zk` extension, which just 2 char, so
actually, we should just allow that.

gcc/ChangeLog

	PR target/102957
	* common/config/riscv/riscv-common.c (multi_letter_subset_rank): Remove
	assertion for Z*-ext.

gcc/testsuite/ChangeLog

	* gcc.target/riscv/pr102957.c: New.
2021-11-10 00:25:58 +08:00
Thomas Schwinge
00c9ce13a6 Restore 'GOMP_OPENACC_DIM' environment variable parsing
... that got broken by recent commit c057ed9c52
"openmp: Fix up strtoul and strtoull uses in libgomp", resulting in spurious
FAILs for tests specifying 'dg-set-target-env-var "GOMP_OPENACC_DIM" "[...]"'.

	libgomp/
	* env.c (parse_gomp_openacc_dim): Restore parsing.
2021-11-09 16:51:57 +01:00
Jan Hubicka
7798ae1a15 Merge IPA solution with local one in ipa-modref
gcc/ChangeLog:

	* ipa-modref.c (analyze_parms): Add past_flags, past_retslot_flags
	and past_static_chain; merge past summary with current one.
	(analyze_function): Update.
2021-11-09 16:48:09 +01:00
Aldy Hernandez
af33850a4d Document --param=threader-debug.
gcc/ChangeLog:

	* doc/invoke.texi (Invoking GCC): Document --param=threader-debug.
2021-11-09 16:18:57 +01:00
Jonathan Wakely
95e8fcd3d5 libstdc++: Make test print which random_device tokens work
libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Print results of random_device_available checks.
2021-11-09 15:12:29 +00:00
Jonathan Wakely
d9ebf0ce08 libstdc++: Do not use 64-bit DARN on 32-bit powerpc [PR103146]
We need to use the 64-bit DARN to detect failure without bias, but it's
not available in 32-bit mode.

libstdc++-v3/ChangeLog:

	PR libstdc++/103146
	* src/c++11/random.cc: Check __powerpc64__ not __powerpc__.
2021-11-09 14:40:33 +00:00
Jonathan Wakely
3439657b02 libstdc++: Support getentropy and arc4random in std::random_device
This adds additional "getentropy" and "arc4random" tokens to
std::random_device. The former is supported on Glibc and OpenBSD (and
apparently wasm), and the latter is supported on various BSDs.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_GETENTROPY, GLIBCXX_CHECK_ARC4RANDOM):
	Define.
	* configure.ac (GLIBCXX_CHECK_GETENTROPY, GLIBCXX_CHECK_ARC4RANDOM):
	Use them.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* src/c++11/random.cc (random_device): Add getentropy and
	arc4random as sources.
	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Check new tokens.
	* testsuite/26_numerics/random/random_device/entropy.cc:
	Likewise.
2021-11-09 14:40:33 +00:00
Jonathan Wakely
8d2d0a6c43 libstdc++: Make spurious std::random_device FAIL less likely
It's possible that independent reads from /dev/random and /dev/urandom
could produce the same value by chance. Retry if that happens. The
chances of it happening twice are miniscule.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Retry if random devices produce the same value.
2021-11-09 14:40:33 +00:00
Jakub Jelinek
0318df0ae6 c++: Fix ICE on complex constant with -frounding-math [PR103114]
The FE uses build_complex which assumes that fold_convert will fold
value to a constant.  With -frounding-math that isn't guaranteed though.
So, the patch instead fold_build2s COMPLEX_EXPR, which will result
in build_complex if both arguments are constants, and otherwise
will build COMPLEX_EXPR.
build_zero_cst is an optimization for fold_convert (type, integer_zero_node).

2021-11-09  Jakub Jelinek  <jakub@redhat.com>

	PR c++/103114
	* parser.c (cp_parser_userdef_numeric_literal): Use fold_build2
	with COMPLEX_EXPR arg instead of build_complex, use build_zero_cst
	instead of fold_convert from integer_zero_node.

	* g++.dg/ext/complex10.C: New test.
2021-11-09 15:29:36 +01:00
Patrick Palka
a22d910305 c++: bogus error w/ tentative type parse of concept-id [PR98394]
Here when tentatively parsing the if condition as a declaration, we try
to treat C<1> as the start of a constrained placeholder type, which we
quickly reject because C doesn't accept a type as its first argument.
But since we're parsing tentatively, we shouldn't emit an error in this
case.

In passing, also fix PR85846 by only overriding 'tentative' to false when
given a concept-name, and not also when given a concept-id that has an empty
argument list.

	PR c++/98394
	PR c++/85846

gcc/cp/ChangeLog:

	* parser.c (cp_parser_placeholder_type_specifier): Declare
	static.  Don't override tentative to false when tmpl is a
	concept-id with empty argument list.  Don't emit a "does not
	constrain a type" error when tentative.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-pr98394.C: New test.
	* g++.dg/cpp2a/concepts-pr85846.C: New test.
2021-11-09 09:09:43 -05:00
Patrick Palka
a19f09cb03 c++: unexpanded pack in var tmpl partial spec [PR100652]
Here we're failing to spot a bare parameter pack appearing in the argument
list of a variable template partial specialization because we only look for
them within the decl's TREE_TYPE, which is sufficient for class templates
but not for variable templates.

	PR c++/100652

gcc/cp/ChangeLog:

	* pt.c (push_template_decl): Check for bare parameter packs in
	the argument list of a variable template partial specialization.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/var-templ69.C: New test.
2021-11-09 09:09:12 -05:00
Martin Liska
0dc0947d4b Define m_rtx_reuse_manager only if not GENERATOR_FILE.
gcc/ChangeLog:

	* print-rtl.c (rtx_writer::rtx_writer): Make the compilation
	conditional based on
	* print-rtl.h (class rtx_writer): Likewise.
2021-11-09 14:45:51 +01:00
Thomas Schwinge
088199e5d0 Generalize 'gcc/input.h:struct location_hash'
This is currently only used here ('gcc/input.h:class string_concat_db'), but is
actually generally useful, so advertize it as such.

Per the rationale given, we may use 'BUILTINS_LOCATION' as spare value for
'Deleted', in addition to the existing use of 'UNKNOWN_LOCATION' as spare value
for 'Empty'.

	gcc/
	* input.h (location_hash): Use 'BUILTINS_LOCATION' as spare value
	for 'Deleted'.  Turn into a '#define'.
2021-11-09 14:40:12 +01:00
Aldy Hernandez
2fc9b4d7b0 Cleanup path solver dumps.
This patch makes the path solver dumps a bit more consistent.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-path.cc (path_range_query::dump): Clean up.
	(path_range_query::compute_ranges): Same.
	* value-relation.cc (path_oracle::dump): Same.
2021-11-09 14:29:22 +01:00
Aldy Hernandez
47c2cf3ac6 Remove TDF_THREADING flag in favor of param.
I am returning a TDF_* flag to the queue of available entries as I am
unconvinced that we need to burn an entire flag for internal debugging
constructs, especially since we seem to be running out of them.

I've added a --param=threader-debug entry similar to the one we use for
ranger debugging.  Currently this only affects the backward threader,
but since the DOM threader is an outlier and on the chopping block, I
avoided using the "backward" name.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* dumpfile.c (dump_options): Remove TDF_THREADING entry.
	* dumpfile.h (enum dump_flag): Remove TDF_THREADING and adjust
	remaining entries.
	* flag-types.h (enum threader_debug): New.
	* gimple-range-path.cc (DEBUG_SOLVER): Use param_threader_debug.
	* params.opt: Add entry for --param=threader-debug=.
2021-11-09 14:29:22 +01:00
Thomas Schwinge
c71cb26a9e Get rid of infinite recursion for 'typedef' used with GTY-marked 'gcc/diagnostic-spec.h:nowarn_map' [PR101204, PR103157]
Reproduced with clang version 10.0.0-4ubuntu1:

    gtype-desc.c:11333:1: warning: all paths through this function will call itself [-Winfinite-recursion]

... as well as some GCC's '-O2 -fdump-tree-optimized':

    void gt_pch_nx(int_hash<unsigned int, 0u, 4294967295u>*, gt_pointer_operator, void*) ([...])
    {
      <bb 2>:

      <bb 3>:
      goto <bb 3>;

    }

That three-arguments 'gt_pch_nx' function as well as two one-argument
'gt_ggc_mx', 'gt_pch_nx' functions now turn empty:

    [...]
     void
    -gt_ggc_mx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
    +gt_ggc_mx (struct xint_hash_t& x_r ATTRIBUTE_UNUSED)
     {
    -  int_hash<location_t,0,UINT_MAX> * ATTRIBUTE_UNUSED x = &x_r;
    -  gt_ggc_mx (&((*x)));
    +  struct xint_hash_t * ATTRIBUTE_UNUSED x = &x_r;
     }
    [...]
     void
    -gt_pch_nx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
    +gt_pch_nx (struct xint_hash_t& x_r ATTRIBUTE_UNUSED)
     {
    -  int_hash<location_t,0,UINT_MAX> * ATTRIBUTE_UNUSED x = &x_r;
    -  gt_pch_nx (&((*x)));
    +  struct xint_hash_t * ATTRIBUTE_UNUSED x = &x_r;
     }
    [...]
     void
    -gt_pch_nx (int_hash<location_t,0,UINT_MAX>* x ATTRIBUTE_UNUSED,
    +gt_pch_nx (struct xint_hash_t* x ATTRIBUTE_UNUSED,
            ATTRIBUTE_UNUSED gt_pointer_operator op,
            ATTRIBUTE_UNUSED void *cookie)
     {
    -    gt_pch_nx (&((*x)), op, cookie);
     }
    [...]

	gcc/
	PR middle-end/101204
	PR other/103157
	* diagnostic-spec.h (typedef xint_hash_t): Turn into...
	(struct xint_hash_t): ... this.
	* doc/gty.texi: Update.
2021-11-09 13:20:41 +01:00
Przemyslaw Wirkus
32ba7860cc arm: add armv9-a architecture to -march
In this patch:
	+ Add `armv9-a` to -march.
	+ Update multilib with armv9-a and armv9-a+simd.

gcc/ChangeLog:

	* config/arm/arm-cpus.in (armv9): New define.
	(ARMv9a): New group.
	(armv9-a): New arch definition.
	* config/arm/arm-tables.opt: Regenerate.
	* config/arm/arm.h (BASE_ARCH_9A): New arch enum value.
	* config/arm/t-aprofile: Added armv9-a and armv9+simd.
	* config/arm/t-arm-elf: Added arm9-a, v9_fps and all_v9_archs
	to MULTILIB_MATCHES.
	* config/arm/t-multilib: Added v9_a_nosimd_variants and
	v9_a_simd_variants to MULTILIB_MATCHES.
	* doc/invoke.texi: Update docs.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/multilib.exp: Update test with armv9-a entries.
	* lib/target-supports.exp (v9a): Add new armflag.
	(__ARM_ARCH_9A__): Add new armdef.
2021-11-09 11:34:57 +00:00
Martin Jambor
df8690f283
ipa: Fix segfault when remapping debug_binds with expressions (PR 103132)
My initial implementation of the method
ipa_param_body_adjustments::remap_with_debug_expressions was based on
the assumption that if it was asked to remap an expression (as opposed
to a simple SSA_NAME), the expression would not contain an SSA_NAME
operand which is to be debug-reset.  While that is true for when
called from ipa_param_body_adjustments::prepare_debug_expressions, it
turns out it is not true when invoked from remap_gimple_stmt in
tree-inline.c.  This patch adds a simple logic to handle such cases
and simply map the entire value to NULL_TREE in those cases.

gcc/ChangeLog:

2021-11-08  Martin Jambor  <mjambor@suse.cz>

	PR ipa/103132
	* ipa-param-manipulation.c (replace_with_mapped_expr): Early
	return with error_mark_mode when part of expression is mapped to
	NULL.
	(ipa_param_body_adjustments::remap_with_debug_expressions): Set
	mapped value to NULL if walk_tree returns error_mark_mode.

gcc/testsuite/ChangeLog:

2021-11-08  Martin Jambor  <mjambor@suse.cz>

	PR ipa/103132
	* gcc.dg/ipa/pr103132.c: New test.
2021-11-09 11:37:17 +01:00
Ghjuvan Lacambre
77eb8c649d [Ada] Fix Codepeer warning
gcc/ada/

	* freeze.adb (Check_Inherited_Conditions): Initialize
	Ifaces_List.
2021-11-09 09:44:50 +00:00
Eric Botcazou
7df3ac2e9e [Ada] Tidy up implementation of Has_Compatible_Type
gcc/ada/

	* sem_ch4.adb (Analyze_Membership_Op) <Find_Interpretation>: Handle
	both overloaded and non-overloaded cases.
	<Try_One_Interp>: Do a reversed call to Covers if the outcome of the
	call to Has_Compatible_Type is false.
	Simplify implementation after change to Find_Interpretation.
	(Analyze_User_Defined_Binary_Op): Be prepared for previous errors.
	(Find_Comparison_Types) <Try_One_Interp>: Do a reversed call to
	Covers if the outcome of the call to Has_Compatible_Type is false.
	(Find_Equality_Types) <Try_One_Interp>: Likewise.
	* sem_type.adb (Has_Compatible_Type): Remove the reversed calls to
	Covers.  Add explicit return on all paths.
2021-11-09 09:44:50 +00:00
Justin Squirek
a2e4ebe02b [Ada] Invalid GPR_PROJECT_PATH_FILE confuses gnatls
gcc/ada/

	* gnatls.adb (Initialize_Default_Project_Path): Remove early
	abort on invalid path.
2021-11-09 09:44:50 +00:00
Eric Botcazou
5861b128b9 [Ada] Print Storage_Pool and Procedure_To_Call fields
gcc/ada/

	* sprint.adb (Sprint_Node_Actual) <N_Allocator>: Also print the
	Procedure_To_Call field if it is present.
	<N_Extended_Return_Statement>: Also print the Storage_Pool and
	Procedure_To_Call fields if they are present.
	<N_Free_Statement>: Likewise.
	<N_Simple_Return_Statement>: Likewise.
2021-11-09 09:44:50 +00:00