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__.
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.
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.
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.
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.
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.
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'.
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.
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=.
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.
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.
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.
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.
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.
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.
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.
gcc/ada/
* exp_ch8.adb (Build_Body_For_Renaming): Remove unnecessary
calls to Sloc; set Handled_Statement_Sequence when building
subprogram body; whitespace cleanup.
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.
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.
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.
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.
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.
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.
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.
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.
The first issue is that the !gotoff_operand path of legitimize_pic_address
in the large PIC model does not make use of REG when it is available, which
breaks for thunks because new pseudo-registers can no longer be created.
And the second issue is that the system compiler (LLVM) generates @GOTOFF
in large model even for RTP, so we do the same.
gcc/
* config/i386/i386.c (legitimize_pic_address): Adjust comment and
use the REG argument on the CM_LARGE_PIC code path as well.
* config/i386/predicates.md (gotoff_operand): Do not treat VxWorks
specially with the large code models.