Commit Graph

189471 Commits

Author SHA1 Message Date
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
Patrick Bernardi
09afdaeeeb [Ada] Do not indicate a pending abort if the task is already aborting
gcc/ada/

	* libgnarl/s-tasini.adb (Check_Abort_Status): Don't return 1 if
	the task is aborting.
	* libgnarl/s-tasini.ads (Check_Abort_Status): Update comment.
2021-11-09 09:44:50 +00:00
Patrick Bernardi
f6174ec5bd [Ada] RTEMS: use atomic primitive packages on aarch64
gcc/ada/

	* Makefile.rtl: Add ATOMICS_TARGET_PAIRS and
	ATOMICS_BUILTINS_TARGET_PAIRS to LIBGNAT_TARGET_PAIRS for
	aarch64-rtems.
2021-11-09 09:44:50 +00:00
Justin Squirek
9f24d32cf6 [Ada] Hang on compilation of unit with type extension in body
gcc/ada/

	* exp_util.adb (Ancestor_Primitive): Prevent return of an
	subprogram alias when the ancestor primitive of the alias is the
	same as Subp.
2021-11-09 09:44:50 +00:00
Justin Squirek
686b427ff4 [Ada] Crash on expansion of tagged membership test
gcc/ada/

	* exp_ch4.adb (Tagged_Membership): Use corresponding record type
	when expanding a tagged membership test on protected types.
2021-11-09 09:44:49 +00:00
Alexandre Oliva
d235950e83 [Ada] Improve integration of strub with type systems
gcc/ada/

	* strub.adb, strub.ads: New files.
	* exp_attr.adb (Access_Cases): Copy strub mode to subprogram type.
	* exp_disp.adb (Expand_Dispatching_Call): Likewise.
	* freeze.adb (Check_Inherited_Conditions): Check that strub modes
	match overridden subprograms and interfaces.
	(Freeze_All): Renaming declarations too.
	* sem_attr.adb (Resolve_Attribute): Reject 'Access to
	strub-annotated data object.
	* sem_ch3.adb (Derive_Subprogram): Copy strub mode to
	inherited subprogram.
	* sem_prag.adb (Analyze_Pragma): Propagate Strub Machine_Attribute
	from access-to-subprogram to subprogram type when required,
	but not from access-to-data to data type.  Mark the entity that
	got the pragma as having a gigi rep item.
	* sem_res.adb (Resolve): Reject implicit conversions that
	would change strub modes.
	(Resolve_Type_Conversions): Reject checked conversions
	between incompatible strub modes.
	* doc/gnat_rm/security_hardening_features.rst: Update.
	* gnat_rm.texi: Regenerate.
	* libgnat/a-except.ads (Raise_Exception): Revert strub-callable
	annotation in public subprogram.
	* libgnat/s-arit128.ads (Multiply_With_Ovflo_Check128): Likewise.
	* libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64): Likewise.
	* libgnat/s-secsta.ads (SS_Allocate): Likewise.
	(SS_Mark, SS_Release): Likewise.
	* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add ada/strub.o.
2021-11-09 09:44:49 +00:00
Etienne Servais
80d52cbe59 [Ada] Initialize Current_Source_Unit
gcc/ada/

	* sinput.ads: Initialize Current_Source_Unit to No_Unit.
2021-11-09 09:44:49 +00:00
Piotr Trojanek
c8a0089baf [Ada] Use atomics in runtime on ARM and Aarch64 VxWorks
gcc/ada/

	* Makefile.rtl (ARM and Aarch64 VxWorks): Use atomic variants of
	runtime units.
	* libgnat/a-strunb__shared.ads: Mention AARCH64 and ARM as
	supported.
	* libgnat/s-atocou.ads: Likewise.
2021-11-09 09:44:49 +00:00
Ghjuvan Lacambre
51e99ead91 [Ada] Accessibility fix
gcc/ada/

	* sem_util.adb (Accessibility_Level): Use init_proc_level_formal
	instead of computing a new accessibility level from Scope_Depth
	(E).
2021-11-09 09:44:49 +00:00
Johannes Kliemann
cbe421bd45 [Ada] Add gcc specs with vxworks7 base addresses for cert
gcc/ada/

	* vxworks7-cert-rtp-link.spec: Replace the definition of
	__wrs_rtp_base with the base_link spec.
	* vxworks7-cert-rtp-base-link.spec: Add base_link spec with
	__wrs_rtp_base definition for all architectures.
	* vxworks7-cert-rtp-base-link__ppc64.spec: Add base_link spec
	with __wrs_rtp_base definition for ppc64.
	* vxworks7-cert-rtp-base-link__x86.spec: Add base_link spec with
	__wrs_rtp_base definition for x86.
	* vxworks7-cert-rtp-base-link__x86_64.spec: Add base_link spec
	with __wrs_rtp_base definition for x86_64.
2021-11-09 09:44:49 +00:00
Piotr Trojanek
7751c73202 [Ada] Cleanup copying of parameter lists
gcc/ada/

	* sem_util.adb (Copy_Parameter_List): Refactor to remove
	repeated calls to First_Formal.
2021-11-09 09:44:48 +00:00
Piotr Trojanek
b064f139e3 [Ada] Cleanup building of renamed equality
gcc/ada/

	* exp_ch8.adb (Build_Body_For_Renaming): Remove unnecessary
	calls to Sloc; set Handled_Statement_Sequence when building
	subprogram body; whitespace cleanup.
2021-11-09 09:44:48 +00:00
Piotr Trojanek
b5f17bffea [Ada] Refine type in expansion of array equality
gcc/ada/

	* exp_ch4.adb (Handle_One_Dimension): Parameter N must be always
	positive, because it is translated into expression of 'First and
	'Last.
2021-11-09 09:44:48 +00:00
Piotr Trojanek
e93e554454 [Ada] Simplify building of entity occurrences
gcc/ada/

	* tbuild.adb (New_Occurrence_Of): Simplify by reusing
	Make_Identifier.
2021-11-09 09:44:48 +00:00
Etienne Servais
0803fd245a [Ada] Return a valid value when handling Constraint_Error
gcc/ada/

	* scng.adb (Set_Start_Column): Return Column_Number'Last when
	handling Constraint_Error. Plus reformat a strangely 7 level if
	loop.
2021-11-09 09:44:48 +00:00
Piotr Trojanek
02ca2184cd [Ada] Simplify expansion of array equality
gcc/ada/

	* exp_ch4.adb (Test_Empty_Arrays): Simplify with Evolve_Or_Else;
	remove unnecessary call to Relocate_Node.
	(Test_Lengths_Correspond): Likewise.
2021-11-09 09:44:48 +00:00
Piotr Trojanek
f4665dc4fb [Ada] Reference in Unbounded_String is almost never null
gcc/ada/

	* libgnat/a-strunb.adb (Deallocate): Rename Reference_Copy to
	Old, to make the code similar to other routines in this package.
	(Realloc_For_Chunk): Use a temporary, deallocate the previous
	string using a null-allowing copy of the string reference.
2021-11-09 09:44:48 +00:00
Ghjuvan Lacambre
adc9410f95 [Ada] sem_util.adb: fix typos in Accessibility_Level docs
gcc/ada/

	* sem_util.adb (Accessibility_Level): Fix typos.
2021-11-09 09:44:47 +00:00
Tom Tromey
99c8e906b1 [Ada] Document the SuSE kernel bug
gcc/ada/

	* doc/gnat_ugn/platform_specific_information.rst: Document the
	SuSE kernel bug.
	* gnat_ugn.texi: Regenerate.
2021-11-09 09:44:47 +00:00
Gary Dismukes
64cb8ebef3 [Ada] Errors on globals in expressions of predicate aspects in generic bodies
gcc/ada/

	* sem_ch13.adb (Freeze_Entity_Checks): Analyze the expression of
	a pragma Predicate associated with an aspect at the freeze point
	of the type, to ensure that references to globals get saved when
	the aspect occurs within a generic body. Also, add
	Aspect_Static_Predicate to the choices of the membership test of
	the enclosing guard.
2021-11-09 09:44:47 +00:00
Piotr Trojanek
1275c4031a [Ada] Tune comment about expansion of array equality
gcc/ada/

	* exp_ch4.adb (Arr_Attr): Refine type of the parameter from Int
	to Pos; refine name of the parameter from Num to Dim; fix
	reference to "Expr" in comment.
2021-11-09 09:44:47 +00:00
Steve Baird
c914810688 [Ada] Add missing regular expression syntax error check
gcc/ada/

	* libgnat/s-regexp.adb (Compile.Check_Well_Formed_Patern): When
	a "|" operator is encountered in a pattern, check that it is not
	the last character of the pattern.
2021-11-09 09:44:47 +00:00
Yannick Moy
ea8726cac5 [Ada] Complete support for prefixed call on subtypes/derived types
gcc/ada/

	* sem_ch3.adb (Analyze_Subtype_Declaration,
	Derived_Type_Declaration): Initialize list of primitive
	operations when Extensions_Allowed.
2021-11-09 09:44:47 +00:00
Piotr Trojanek
51ad879c72 [Ada] Fix detection of array aggregates with single others associations
gcc/ada/

	* checks.adb (Apply_Constraint_Check): Guard against calling
	Choices when the first association in an array aggregate is a
	N_Iterated_Component_Association node.
2021-11-09 09:44:47 +00:00
Yannick Moy
ca803c3d7b [Ada] Fix support for prefixed call with incomplete type declarations
gcc/ada/

	* sem_ch3.adb (Analyze_Incomplete_Type_Decl): Add the missing
	initialization.
2021-11-09 09:44:46 +00:00
Piotr Trojanek
9c8bb4d682 [Ada] Guard against illegal items in Global but not Depends
gcc/ada/

	* sem_prag.adb (Check_Usage): Guard against calling Usage_Error
	with illegal Item_Id. The intention to do this was already
	described in the comment but not implemented.
2021-11-09 09:44:46 +00:00
Etienne Servais
74e514af79 [Ada] Build activation chain for BIP only when needed
gcc/ada/

	* exp_ch6.adb (Expand_Actuals): Add a condition to check for the
	possibility of task.
2021-11-09 09:44:46 +00:00
Aldy Hernandez
6b8b959675 Convert strlen pass from evrp to ranger.
The following patch converts the strlen pass from evrp to ranger,
leaving DOM as the last remaining user.

No additional cleanups have been done.  For example, the strlen pass
still has uses of VR_ANTI_RANGE, and the sprintf still passes around
pairs of integers instead of using a proper range.  Fixing this
could further improve these passes.

Basically the entire patch is just adjusting the calls to range_of_expr
to include context.  The previous context of si->stmt was mostly
empty, so not really useful ;-).

With ranger we are now able to remove the range calculation from
before_dom_children entirely.  Just working with the ranger on-demand
catches all the strlen and sprintf testcases with the exception of
builtin-sprintf-warn-22.c which is due to a limitation of the sprintf
code.  I have XFAILed the test and documented what the problem is.

On a positive note, these changes found two possible sprintf overflow
bugs in the C++ and Fortran front-ends which I have fixed below.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-strlen.c (compare_nonzero_chars): Pass statement
	context to ranger.
	(get_addr_stridx): Same.
	(get_stridx): Same.
	(get_range_strlen_dynamic): Same.
	(handle_builtin_strlen): Same.
	(handle_builtin_strchr): Same.
	(handle_builtin_strcpy): Same.
	(maybe_diag_stxncpy_trunc): Same.
	(handle_builtin_stxncpy_strncat): Same.
	(handle_builtin_memcpy): Same.
	(handle_builtin_strcat): Same.
	(handle_alloc_call): Same.
	(handle_builtin_memset): Same.
	(handle_builtin_string_cmp): Same.
	(handle_pointer_plus): Same.
	(count_nonzero_bytes_addr): Same.
	(count_nonzero_bytes): Same.
	(handle_store): Same.
	(fold_strstr_to_strncmp): Same.
	(handle_integral_assign): Same.
	(check_and_optimize_stmt): Same.
	(class strlen_dom_walker): Replace evrp with ranger.
	(strlen_dom_walker::before_dom_children): Remove evrp.
	(strlen_dom_walker::after_dom_children): Remove evrp.
	* gimple-ssa-warn-access.cc (maybe_check_access_sizes):
	Restrict sprintf output.

gcc/cp/ChangeLog:

	* ptree.c (cxx_print_xnode): Add more space to pfx array.

gcc/fortran/ChangeLog:

	* misc.c (gfc_dummy_typename): Make sure ts->kind is
	non-negative.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/builtin-sprintf-warn-22.c: XFAIL.
2021-11-09 09:55:58 +01:00
Rasmus Villemoes
cc6b8cd9a2 libstdc++: only define _GLIBCXX_HAVE_TLS for VxWorks >= 6.6
According to
https://gcc.gnu.org/legacy-ml/gcc-patches/2008-03/msg01698.html, the
TLS support, including the __tls_lookup function, was added to VxWorks
in 6.6.

It certainly doesn't exist on our VxWorks 5 platform, but the fallback
code in eh_globals.cc using __gthread_key_create() etc. used to work
just fine.

libstdc++-v3/ChangeLog:

	* config/os/vxworks/os_defines.h (_GLIBCXX_HAVE_TLS): Only
	define for VxWorks >= 6.6.
2021-11-09 09:51:08 +01:00