aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-11-08libstdc++: Fix -Wsystem-headers warnings in testsJonathan Wakely13-27/+40
libstdc++-v3/ChangeLog: * testsuite/18_support/new_nothrow.cc: Add missing noexcept to operator delete replacements. * testsuite/20_util/any/cons/92156.cc: Disable -Winit-list-lifetime warnings from instantiating invalid specialization of manager function. * testsuite/20_util/any/modifiers/92156.cc: Likewise. * testsuite/20_util/default_delete/void_neg.cc: Prune additional diagnostics. * testsuite/20_util/headers/memory/synopsis.cc: Add missing noexcept. * testsuite/20_util/shared_ptr/cons/void_neg.cc: Prune additional diagnostic. * testsuite/20_util/unique_ptr/creation/for_overwrite.cc: Add missing noexcept to operator delete replacements. * testsuite/21_strings/basic_string/cons/char/103919.cc: Likewise. * testsuite/23_containers/map/modifiers/emplace/92300.cc: Likewise. * testsuite/23_containers/map/modifiers/insert/92300.cc: Likewise. * testsuite/24_iterators/headers/iterator/range_access_c++11.cc: Add missing noexcept to synopsis declarations. * testsuite/24_iterators/headers/iterator/range_access_c++14.cc: Likewise. * testsuite/24_iterators/headers/iterator/range_access_c++17.cc: Likewise.
2022-11-08libstdc++: Fix -Wsystem-headers warningsJonathan Wakely5-6/+10
Fix some problems noticed with -Wsystem-headers. libstdc++-v3/ChangeLog: * include/bits/stl_tempbuf.h (_Temporary_buffer): Disable warnings about get_temporary_buffer being deprecated. * include/ext/functional (mem_fun1, mem_fun1_ref): Disable warnings about mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t and const_mem_fun1_ref_t being deprecated. * include/std/array (__array_traits<T, 0>): Remove artificial attributes which give warnings about being ignored. * include/std/spanstream (basic_spanbuf::setbuf): Add assertion and adjust to avoid narrowing warning. * libsupc++/exception_ptr.h [!__cpp_rtti && !__cpp_exceptions] (make_exception_ptr): Add missing inline specifier.
2022-11-08libstdc++: Add always_inline to most allocator functionsJonathan Wakely4-15/+72
This reduces the abstraction penalty for allocator support in unoptimized code. Constructing and using allocators in containers calls many one-line (or completely empty) inline functions. Those can all be inlined to reduce code size and function call overhead for -O0. libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h (allocator_traits): Add always_inline attribute to all member functions. (__do_alloc_on_copy, __alloc_on_copy, __do_alloc_on_move) (__alloc_on_move, __do_alloc_on_swap, __alloc_on_swap) (_Destroy(FwdIter, FwdIter, allocator<T>&)): : Add always_inline attribute. * include/bits/allocator.h (allocator): Add always_inline attribute to all member functions and equality operators. * include/bits/new_allocator.h (__new_allocator): Likewise. * include/ext/alloc_traits.h (__gnu_cxx::__alloc_traits): Likewise.
2022-11-08libstdc++: basic_filebuf: don't flush more often than necessary [PR63746]Charles-François Natali2-6/+41
`basic_filebuf::xsputn` would bypass the buffer when passed a chunk of size 1024 and above, seemingly as an optimisation. This can have a significant performance impact if the overhead of a `write` syscall is non-negligible, e.g. on a slow disk, on network filesystems, or simply during IO contention because instead of flushing every `BUFSIZ` (by default), we can flush every 1024 char. The impact is even greater with custom larger buffers, e.g. for network filesystems, because the code could issue `write` for example 1000X more often than necessary with respect to the buffer size. It also introduces a significant discontinuity in performance when writing chunks of size 1024 and above. Instead, it makes sense to only bypass the buffer if the amount of data to be written is larger than the buffer capacity. Signed-off-by: Charles-Francois Natali <cf.natali@gmail.com> libstdc++-v3/ChangeLog: PR libstdc++/63746 * include/bits/fstream.tcc (basic_filbuf::xsputn): Remove 1024-byte chunking that bypasses the buffer for large writes. * testsuite/27_io/basic_filebuf/sputn/char/63746.cc: New test.
2022-11-08libstdc++: Refactor implementation of operator+ for std::stringWill Hawkins2-58/+49
Until now operator+(char*, string) and operator+(string, char*) had different performance characteristics. The former required a single memory allocation and the latter required two. This patch makes the performance equal. After consultation with Jonathan, it seemed like a good idea to create a single function that performed one-allocation string concatenation that could be used by various different version of operator+. This patch adds such a function and calls it from the relevant implementations. Co-authored-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/basic_string.h (__str_cat): Add common function that performs single-allocation string concatenation. (operator+): Use __str_cat. * include/bits/basic_string.tcc (operator+): Move to .h and define inline using __str_cat. Signed-off-by: Will Hawkins <whh8b@obs.cr>
2022-11-08bpf: Use enum for resolved overloaded builtinsDavid Faust1-47/+59
Change several places in the eBPF backend dealing with overloaded built-in functions to consistently use the enum bpf_builtins type, rather than variously using integer constants or booleans. The result is eaiser to read and extend. gcc/ * config/bpf/bpf.cc (struct core_walk_data): Add field `which'... (bpf_resolve_overloaded_builtin): ... set it here. Use values of enum bpf_builtins for error checks. (bpf_core_walk): Use values of enum bpf_builtins. (bpf_core_newdecl): Likewise. (bpf_expand_builtin): Likewise.
2022-11-08[PR24021] Implement PLUS_EXPR range-op entry for floats.Aldy Hernandez2-0/+148
This is the range-op entry for floating point PLUS_EXPR. It's the most intricate range entry we have so far, because we need to keep track of rounding and target FP formats. This will be the last FP entry I commit, mostly to avoid disturbing the tree any further, and also because what we have so far is enough for a solid VRP. So far we track NANs and signs correctly. We also handle relationals (symbolics and numeric), both ordered and unordered, ABS_EXPR and NEGATE_EXPR which are used to fold __builtin_isinf, and __builtin_sign (__builtin_copysign is coming up). All in all, I think this provide more than enough for basic VRP on floats, as well as provide a basis to flesh out the rest if there's interest. My goal with this entry is to provide a template for additional binary operators, as they tend to follow a similar pattern: handle NANs, do the arithmetic while keeping track of rounding, and adjust for NAN. I may abstract the general parts as we do for irange's fold_range and wi_fold. PR tree-optimization/24021 gcc/ChangeLog: * range-op-float.cc (propagate_nans): New. (frange_nextafter): New. (frange_arithmetic): New. (class foperator_plus): New. (floating_op_table::floating_op_table): Add PLUS_EXPR entry. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/vrp-float-plus.c: New test.
2022-11-08Provide normalized and denormal format version of real_isdenormal.Aldy Hernandez3-17/+23
Implement a variant of real_isdenormal() to be used within real.cc where the argument is known to be in denormal format. Rewrite real_isdenormal() for use outside of real.cc where the argument is known to be normalized. gcc/ChangeLog: * real.cc (real_isdenormal): New. (encode_ieee_single): Call real_isdenormal. (encode_ieee_double): Same. (encode_ieee_extended): Same. (encode_ieee_quad): Same. (encode_ieee_half): Same. (encode_arm_bfloat_half): Same. * real.h (real_isdenormal): Add mode argument. Rewrite for normalized values. * value-range.cc (frange::flush_denormals_to_zero): Pass mode to real_isdenormal.
2022-11-08tree-optimization/107389 - honor __builtin_assume_alignment at -O0Richard Biener2-0/+54
The following makes sure to set alignment information on the LHS of __builtin_assume_alignment calls even when not optimizing so uses as arguments to builtin functions like memcpy or __atomic_load_n can be reflected at RTL expansion time. PR tree-optimization/107389 * gimple-low.cc (lower_builtin_assume_aligned): New. (lower_stmt): Call it. * gcc.dg/pr107389.c: New testcase.
2022-11-08CCP: handle division by a power of 2 as a right shift.Aldy Hernandez2-17/+13
We have some code in range-ops that sets better maybe nonzero bits for TRUNC_DIV_EXPR by a power of 2 than CCP does, by just shifting the mask. I'd like to offload this functionality into the CCP mask tracking code, which already does the right thing for right shifts. The testcase for this change is gcc.dg/tree-ssa/vrp123.c and gcc.dg/tree-ssa/pr107541.c. gcc/ChangeLog: * range-op.cc (operator_div::fold_range): Call update_known_bitmask. * tree-ssa-ccp.cc (bit_value_binop): Handle divisions by powers of 2 as a right shift.
2022-11-08amdgcn: Fix expansion of GCN_BUILTIN_LDEXPV builtinKwok Cheung Yeung1-1/+1
2022-11-08 Kwok Cheung Yeung <kcy@codesourcery.com> gcc/ * config/gcn/gcn.cc (gcn_expand_builtin_1): Expand first argument of GCN_BUILTIN_LDEXPV to V64DFmode.
2022-11-08amdgcn: Add builtins for vectorized native versions of abs, floorf and floorKwok Cheung Yeung3-0/+81
2022-11-08 Kwok Cheung Yeung <kcy@codesourcery.com> gcc/ * config/gcn/gcn-builtins.def (FABSV, FLOORVF, FLOORV): New builtins. * config/gcn/gcn.cc (gcn_expand_builtin_1): Expand GCN_BUILTIN_FABSV, GCN_BUILTIN_FLOORVF and GCN_BUILTIN_FLOORV. gcc/testsuite/ * gcc.target/gcn/math-builtins-1.c: New test.
2022-11-08Use bit-CCP in range-ops.Aldy Hernandez1-15/+49
After Jakub and Richi's suggestion of using the same representation for tracking known bits as we do in CCP, I took a peek at the code and realized there's a plethora of bit-tracking code there that we could be sharing with range-ops. For example, the multiplication optimizations are way better than what I had cobbled together. For that matter, our maybe nonzero tracking as a whole has a lot of room for improvement. Being the lazy ass that I am, I think we should just use one code base (CCP's). This patch provides a thin wrapper for converting the irange maybe nonzero bits to what CCP requires, and uses that to call into bit_value_binop(). I have so far converted the MULT_EXPR range-op entry to use it, as the DIV_EXPR entry we have gets a case CCP doesn't get so I'd like to contribute the enhancement to CCP before converting over. I'd like to use this approach with the dozen or so tree_code's that are handled in CCP, thus saving us from having to implement any of them :). Early next season I'd like to change irange's internal representation to a pair of value / mask, and start tracking all known bits. This ties in nicely with our plan for tracking known set bits. Perhaps if the stars align, we could merge the bit twiddling in CCP into range-ops and have a central repository for it. That is, once we make the switch to wide-ints, and assuming there are no performance issues. Note that range-ops is our lowest level abstraction. i.e. it's just the math, there's no GORI or ranger, or even the concept of a symbolic or SSA. gcc/ChangeLog: * range-op.cc (irange_to_masked_value): New. (update_known_bitmask): New. (operator_mult::fold_range): Call update_known_bitmask.
2022-11-08testsuite: Fix failure in test pr105586.c [PR107171]Surya Kumari Jangala1-0/+1
The test pr105586.c fails on a big endian system when run in 32bit mode. The failure occurs as the test case does not guard against unsupported __int128. 2022-10-13 Surya Kumari Jangala <jskumari@linux.ibm.com> gcc/testsuite/ PR testsuite/107171 * gcc.target/powerpc/pr105586.c: Guard against unsupported __int128.
2022-11-08cdce: Fix up get_no_error_domain for new f{16,32,64,128} builtins [PR107547]Jakub Jelinek2-0/+86
I've missed that this function needs to handle all the builtins that are handled in can_test_argument_range. The following patch does that. For many of the builtins (like acos, or log) it is the same range regardless of the floating point type, but for some (cosh, sinh, exp{,m1,2}) it is different for each format, so I had to compute those ranges. Note, seems the existing ranges were in some cases (e.g. for exp2) the smallest in absolute value which results infinite result, in others the largest which still results in finite result (but consistently so for the IEEE single vs. double). I've followed that for IEEE half and quad cases too, just am not sure why it was like that. I think get_domain with true, false is open interval rather than closed and the comments indicate that too, conservatively that is certainly correct. OT, with frange, perhaps we could DCE the calls unconditionally if frange can prove we are in the domain range. 2022-11-08 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/107547 * tree-call-cdce.cc (get_no_error_domain): Handle CASE_FLT_FN_FLOATN_NX of BUILT_IN_{ACOS,ASIN,ACOSH,ATANH,LOG,LOG2,LOG10,LOG1P}. Handle BUILT_IN_{COSH,SINH,EXP,EXPM1,EXP2}F{16,32,64,128}. * gcc.dg/pr107547.c: New test.
2022-11-08i386: Improve vector [GL]E{,U} comparison against vector constants [PR107546]Jakub Jelinek4-11/+113
For integer vector comparisons without XOP before AVX512{F,VL} we are constrained by only GT and EQ being supported in HW. For GTU we play tricks to implement it using GT or unsigned saturating subtraction, for LT/LTU we swap the operands and thus turn it into GT/GTU. For LE/LEU we handle it by using GT/GTU and negating the result and for GE/GEU by using GT/GTU on swapped operands and negating the result. If the second operand is a CONST_VECTOR, we can usually do better though, we can avoid the negation. For LE/LEU cst by doing LT/LTU cst+1 (and then cst+1 GT/GTU x) and for GE/GEU cst by doing GT/GTU cst-1, provided there is no wrap-around on those cst+1 or cst-1. GIMPLE canonicalizes x < cst to x <= cst-1 etc. (the rule is smaller absolute value on constant), but only for scalars or uniform vectors, so in some cases this undoes that canonicalization in order to avoid the extra negation, but it handles also non-uniform constants. E.g. with -mavx2 the testcase assembly difference is: - movl $47, %eax + movl $48, %eax vmovdqa %xmm0, %xmm1 vmovd %eax, %xmm0 vpbroadcastb %xmm0, %xmm0 - vpminsb %xmm0, %xmm1, %xmm0 - vpcmpeqb %xmm1, %xmm0, %xmm0 + vpcmpgtb %xmm1, %xmm0, %xmm0 and - vmovdqa %xmm0, %xmm1 - vmovdqa .LC1(%rip), %xmm0 - vpminsb %xmm1, %xmm0, %xmm1 - vpcmpeqb %xmm1, %xmm0, %xmm0 + vpcmpgtb .LC1(%rip), %xmm0, %xmm0 while with just SSE2: - pcmpgtb .LC0(%rip), %xmm0 - pxor %xmm1, %xmm1 - pcmpeqb %xmm1, %xmm0 + movdqa %xmm0, %xmm1 + movdqa .LC0(%rip), %xmm0 + pcmpgtb %xmm1, %xmm0 and - movdqa %xmm0, %xmm1 - movdqa .LC1(%rip), %xmm0 - pcmpgtb %xmm1, %xmm0 - pxor %xmm1, %xmm1 - pcmpeqb %xmm1, %xmm0 + pcmpgtb .LC1(%rip), %xmm0 2022-11-08 Jakub Jelinek <jakub@redhat.com> PR target/107546 * config/i386/predicates.md (vector_or_const_vector_operand): New predicate. * config/i386/sse.md (vec_cmp<mode><sseintvecmodelower>, vec_cmpv2div2di, vec_cmpu<mode><sseintvecmodelower>, vec_cmpuv2div2di): Use nonimmediate_or_const_vector_operand predicate instead of nonimmediate_operand and vector_or_const_vector_operand instead of vector_operand. * config/i386/i386-expand.cc (ix86_expand_int_sse_cmp): For LE/LEU or GE/GEU with CONST_VECTOR cop1 try to transform those into LE/LEU or GT/GTU with larger or smaller by one cop1 if there is no wrap-around. Force CONST_VECTOR cop0 or cop1 into REG. Formatting fix. * gcc.target/i386/pr107546.c: New test.
2022-11-08libstdc++: Uncomment denorm_min testJakub Jelinek1-1/+1
As r13-3609-g6d9dbdf51f9afe8 has been committed, we can now enable even the denorm_min test. 2022-11-08 Jakub Jelinek <jakub@redhat.com> * testsuite/20_util/to_chars/float128_c++23.cc (test): Uncomment denorm_min test.
2022-11-08gcc: fix PR rtl-optimization/107482Max Filippov1-2/+2
gcc/ PR rtl-optimization/107482 * ira-color.cc (assign_hard_reg): Only call update_costs_from_copies when retry_p is false.
2022-11-08ada: Fix oversight in implementation of allocators for storage modelsEric Botcazou1-7/+26
When the allocator is of an unconstrained array type and has an initializing expression, the copy of the initializing expression must be done separately from that of the bounds. gcc/ada/ * gcc-interface/utils2.cc (build_allocator): For unconstrained array types with a storage model and an initializing expression, copy the initialization expression separately from the bounds. In all cases with a storage model, pass the locally computed size for the store.
2022-11-08ada: Compile-time simplification of 'Image incorrectly ignores Put_ImageSteve Baird1-1/+3
In the case of Some_Enumeration_Type'Image (<some static value>), the compiler will replace this expression in its internal program representation with a corresponding string literal. This is incorrect if the Put_Image aspect has been specified (directly or via inheritance) for the enumeration type. gcc/ada/ * sem_attr.adb (Eval_Attribute): Don't simplify 'Image call if Put_Image has been specified.
2022-11-08ada: Clean up call to check if aspects are presentPiotr Trojanek7-16/+14
Code cleanup; semantics is unaffected. gcc/ada/ * exp_ch6.adb, exp_put_image.adb, sem_aggr.adb, sem_attr.adb, sem_ch5.adb, sem_type.adb, sem_util.adb: Replace "Present (Find_Aspect (...))" with "Has_Aspect".
2022-11-08ada: Adjust classwide contract expression preanalysisRonan Desplanques3-232/+267
Before this patch, a classwide contract expression was preanalyzed only when its primitive operation's type was frozen. It caused name resolution to be off in the cases where the freezing took place after the end of the declaration list the primitive operation was declared in. This patch makes it so that if the compiler gets to the end of the declaration list before the type is frozen, it preanalyzes the classwide contract expression, so that the names are resolved in the right context. gcc/ada/ * contracts.adb (Preanalyze_Class_Conditions): New procedure. (Preanalyze_Condition): Moved out from Merge_Class_Conditions in order to be spec-visible. * contracts.ads (Preanalyze_Class_Conditions): New procedure. * sem_prag.adb (Analyze_Pre_Post_Condition_In_Decl_Part): Call Preanalyze_Class_Conditions when necessary.
2022-11-08ada: Set Support_Atomic_Primitives for VxWorks 7 runtimesJohannes Kliemann12-8/+12
gcc/ada/ * libgnat/system-vxworks7-aarch64-rtp-smp.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-aarch64.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-arm-rtp-smp.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-arm.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-ppc-kernel.ads: Set Support_Atomic_Primitives to False. * libgnat/system-vxworks7-ppc-rtp-smp.ads: Set Support_Atomic_Primitives to False. * libgnat/system-vxworks7-ppc64-kernel.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-ppc64-rtp-smp.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-x86-kernel.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-x86-rtp-smp.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-x86_64-kernel.ads: Set Support_Atomic_Primitives to True. * libgnat/system-vxworks7-x86_64-rtp-smp.ads: Set Support_Atomic_Primitives to True.
2022-11-08ada: Small consistency fixEric Botcazou1-1/+1
gcc/ada/ * fe.h (Get_Warn_On_Questionable_Layout): Add void parameter.
2022-11-08ada: Propagate aspect Ghost when instantiating null formal proceduresPiotr Trojanek1-0/+2
When instantiating generic package that includes a formal subprogram declaration with Ghost aspect and a subprogram_default of null, e.g.: generic with procedure Proc is null with Ghost; package P is ... the Ghost aspect should be propagated to the internally generated null subprogram, so this null subprogram can be used in contexts that require ghost entities. gcc/ada/ * sem_ch12.adb (Instantiate_Formal_Subprogram): Copy aspect Ghost from formal subprogram declaration to the internally generated procedure.
2022-11-08ada: Implement RM 4.5.7(10/3) name resolution ruleEric Botcazou2-82/+156
This rule deals with the specific case of a conditional expression that is the operand of a type conversion and effectively distributes the conversion to the dependent expressions with the help of the dynamic semantics. gcc/ada/ * sem_ch4.adb (Analyze_Case_Expression): Compute the interpretations of the expression only at the end of the analysis, but skip doing it if it is the operand of a type conversion. (Analyze_If_Expression): Likewise. * sem_res.adb (Resolve): Deal specially with conditional expression that is the operand of a type conversion. (Resolve_Dependent_Expression): New procedure. (Resolve_Case_Expression): Call Resolve_Dependent_Expression. (Resolve_If_Expression): Likewise. (Resolve_If_Expression.Apply_Check): Take result type as parameter. (Resolve_Type_Conversion): Do not warn about a redundant conversion when the operand is a conditional expression.
2022-11-08ada: Enforce matching of extra formalsJavier Miranda13-458/+1437
This patch enforces matching of extra formals in overridden subprograms, subprogram renamings, and subprograms to which attributes 'Access, 'Unchecked_Access, or 'Unrestricted_Access is applied (for these access cases the subprogram is checked against its corresponding subprogram type). This enforcement is an internal consistency check, not an implementation of some language legality rule. gcc/ada/ * debug.adb (Debug_Flag_Underscore_XX): Switch -gnatd_X used temporarily to allow disabling extra formal checks. * exp_attr.adb (Expand_N_Attribute_Reference [access types]): Add extra formals to the subprogram referenced in the prefix of 'Unchecked_Access, 'Unrestricted_Access or 'Access; required to check that its extra formals match the extra formals of the corresponding subprogram type. * exp_ch3.adb (Stream_Operation_OK): Declaration moved to the public part of the package. (Validate_Tagged_Type_Extra_Formals): New subprogram. (Expand_Freeze_Record_Type): Improve the code that takes care of adding the extra formals of dispatching primitives; extended to add also the extra formals to renamings of dispatching primitives. * exp_ch3.ads (Stream_Operation_OK): Declaration moved from the package body. * exp_ch6.adb (Check_BIP_Actuals): Complete documentation. (Has_BIP_Extra_Formal): Subprogram declaration moved to the public part of the package. In addition, a parameter has been added to disable an assertion that requires its use with frozen entities. (Duplicate_Params_Without_Extra_Actuals): New subprogram. (Check_Subprogram_Variant): Emit the call without duplicating the extra formals since they will be added when the call is analyzed. (Expand_Call_Helper): Ensure that the called subprogram has all its extra formals, enforce assertion checking extra formals on thunks, and mark calls from thunks as processed-BIP-calls to avoid adding their extra formals twice. (Is_Build_In_Place_Function): Return False for entities with foreign convention. (Is_Build_In_Place_Function_Call): Return True also for not BIP functions that have BIP formals since the extra actuals are required. (Make_Build_In_Place_Call_In_Object_Declaration): Occurrences of Is_Return_Object replaced by the local variable Is_OK_Return_Object that evaluates to False for scopes with foreign convention. (Might_Have_Tasks): Fix check of class-wide limited record types. (Needs_BIP_Task_Actuals): Remove assertion to allow calling this function in more contexts; in addition it returns False for functions returning objects with foreign convention. (Needs_BIP_Finalization_Master): Likewise. (Needs_BIP_Alloc_Form): Likewise. (Validate_Subprogram_Calls): Check that the number of actuals (including extra actuals) of calls in the subtree N match their corresponding formals. * exp_ch6.ads (Has_BIP_Extra_Formal): Subprogram declaration moved to the public part of the package. In addition, a parameter has been added to disable an assertion that requires its use with frozen entities. (Is_Build_In_Place_Function_Call): Complete documentation. (Validate_Subprogram_Calls): Check that the number of actuals (including extra actuals) of calls in the subtree N match their corresponding formals. * freeze.adb (Check_Itype): Add extra formals to anonymous access subprogram itypes. (Freeze_Expression): Improve code that disables the addition of extra formals to functions with foreign convention. (Check_Extra_Formals): Moved to package Sem_Ch6 as Extra_Formals_OK. (Freeze_Subprogram): Add extra formals to non-dispatching subprograms. * frontend.adb (Frontend): Validate all the subprogram calls; it can be disabled using switch -gnatd_X * sem_ch3.adb (Access_Subprogram_Declaration): Defer the addition of extra formals to the freezing point so that we know the convention. (Check_Anonymous_Access_Component): Likewise. (Derive_Subprogram): Fix documentation. * sem_ch6.adb (Has_Reliable_Extra_Formals): New subprogram. (Check_Anonymous_Return): Fix check of access to class-wide limited record types. (Check_Untagged_Equality): Placed in alphabetical order. (Extra_Formals_OK): Subprogram moved from freeze.adb. (Extra_Formals_Match_OK): New subprogram. (Has_BIP_Formals): New subprogram. (Has_Extra_Formals): New subprograms. (Needs_Accessibility_Check_Extra): New subprogram. (Parent_Subprogram): New subprogram. (Add_Extra_Formal): Minor code cleanup. (Create_Extra_Formals): Enforce matching extra formals on overridden and aliased entities. * sem_ch6.ads (Extra_Formals_Match_OK): New subprogram. (Extra_Formals_OK): Subprogram moved from freeze.adb. * sem_eval.adb (Compile_Time_Known_Value): Improve predicate to avoid assertion failure; found working on this ticket; this change does not affect the behavior of the compiler because this subprogram has an exception handler that returns False when the assertion fails. * sem_util.adb (Needs_Result_Accessibility_Level): Do not return False for dispatching operations compiled with Ada_Version < 2012 since they they may be overridden by primitives compiled with Ada_Version >= Ada_2012.
2022-11-08ada: Move warnings switches -- initial workBob Duff11-23/+20
This patch prepares to move warning switches from Opt into Warnsw. gcc/ada/ * warnsw.ads, warnsw.adb, fe.h, err_vars.ads, errout.ads: Move Warning_Doc_Switch from Err_Vars to Warnsw. Access Warn_On_Questionable_Layout on the C side via a function rather than a variable, because we plan to turn the variables into renamings, and you can't Export renamings. * erroutc.adb, switch-c.adb, errout.adb: Likewise. * gcc-interface/decl.cc: Use Get_Warn_On_Questionable_Layout instead of Warn_On_Questionable_Layout. * gcc-interface/Makefile.in (GNATMAKE_OBJS): Add warnsw.o, because it is indirectly imported via Errout. * gcc-interface/Make-lang.in (GNATBIND_OBJS): Likewise and remove restrict.o (not needed).
2022-11-08ada: Align -gnatwc's documentation with its behaviorRonan Desplanques2-2/+2
Shortly after the -gnatwc flag was introduced, its behavior was tweaked, but its documentation was not updated accordingly. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (-gnatwc): Fix flag documentation. * gnat_ugn.texi: Regenerate.
2022-11-08ada: Improve handling of declare expressions in deferred-freezing contextsSteve Baird1-0/+20
In some cases where a declare expression occurs in a deferred-freezing context (e.g., within the default value for a discriminant or for a formal parameter, or within the expression of an expression function), the compiler generates a bugbox. gcc/ada/ * sem_ch3.adb (Analyze_Object_Declaration): Do not perform expansion actions if In_Spec_Expression is true.
2022-11-08ada: Minor consistency tweaks in Sem_Ch4Eric Botcazou1-15/+24
This ensures that, during the analysis of the qualified expressions, type conversions and unchecked type conversions, the determination of the type of the node and the analysis of its expression are done in the same order. No functional changes. gcc/ada/ * sem_ch4.adb (Analyze_Qualified_Expression): Analyze the expression only after setting the type. (Analyze_Unchecked_Type_Conversion): Likewise. (Analyze_Short_Circuit): Likewise for the operands. (Analyze_Type_Conversion): Minor tweaks. (Analyze_Unchecked_Expression): Likewise.
2022-11-08ada: Remove redundant line in Analyze_Qualified_ExpressionEric Botcazou1-2/+0
The same statement is present a few lines above. gcc/ada/ * sem_ch4.adb (Analyze_Qualified_Expression): Remove redundant line.
2022-11-08ada: Preanalyze classwide contracts as spec expressionsRonan Desplanques1-2/+2
Classwide contracts are "spec expressions" as defined in the documentation in sem.ads. Before this patch, the instances of classwide contracts that are destined to class conditions merging were not preanalyzed as spec expressions. That caused preanalysis to emit spurious errors in some cases. gcc/ada/ * contracts.adb (Preanalyze_Condition): Use Preanalyze_Spec_Expression.
2022-11-08ada: Fix expansion of 'Wide_Image and 'Wide_Wide_Image on composite typesPiotr Trojanek4-7/+51
Attributes Wide_Image and Wide_Wide_Image applied to composite types are now expanded just like attribute Image. gcc/ada/ * exp_imgv.adb (Expand_Wide_Image_Attribute): Handle just like attribute Image. (Expand_Wide_Wide_Image_Attribute): Likewise. * exp_put_image.adb (Build_Image_Call): Adapt to also work for Wide and Wide_Wide attributes. * exp_put_image.ads (Build_Image_Call): Update comment. * rtsfind.ads (RE_Id): Support wide variants of Get. (RE_Unit_Table): Likewise.
2022-11-08ada: Fix inconsistent whitespace in Ada.Numerics.Generic_Complex_ArraysPiotr Trojanek2-4/+4
Cleanup only. gcc/ada/ * libgnat/a-ngcoar.ads, libgnat/a-ngcoar.adb: Remove extra spaces.
2022-11-08ada: Remove unneeded code in handling formal type defaultsPiotr Trojanek1-4/+2
Unneeded code found while experimenting with improved detection of unreferenced objects. gcc/ada/ * sem_ch12.adb (Validate_Formal_Type_Default): Remove call to Collect_Interfaces, which had no effect apart from populating a list that was not used; fix style.
2022-11-08ada: Cleanup local variable that is only set as an out parameterPiotr Trojanek2-10/+10
Minor improvements; found experimenting with improved detection of unreferenced objects. gcc/ada/ * exp_spark.adb (SPARK_Freeze_Type): Refine type of a local object. * sem_ch3.adb (Derive_Subprograms): Remove initial value for New_Subp, which is in only written as an out parameter and never read.
2022-11-08ada: Remove obsolete code in Resolve_If_ExpressionEric Botcazou1-12/+1
gcc/ada/ * sem_res.adb (Resolve_If_Expression): Remove obsolete special case.
2022-11-08ada: Reject limited objects in array and record delta aggregatesPiotr Trojanek1-0/+17
For array delta aggregates the base expression cannot be limited; for record delta aggregates the base expression can only be limited if it is a newly constructed object. gcc/ada/ * sem_aggr.adb (Resolve_Delta_Aggregate): Implement rules related to limited objects appearing as the base expression.
2022-11-08ada: Allow initialization of limited objects with delta aggregatesPiotr Trojanek1-0/+1
Objects of a limited type can be initialized with "aggregates", which is a collective term for ordinary aggregates (i.e. record aggregates and array aggregates), extension aggregates and finally for delta aggregates (introduced by Ada 2022). gcc/ada/ * sem_ch3.adb (OK_For_Limited_Init_In_05): Handle delta aggregates just like other aggregates.
2022-11-08ada: Reject record delta aggregates with limited expressionsPiotr Trojanek1-0/+10
Implement a missing check related to record delta aggregates. gcc/ada/ * sem_aggr.adb (Resolve_Delta_Record_Aggregate): Reject expressions of a limited types.
2022-11-08ada: Missing master of task causing assertion failureJavier Miranda1-1/+36
gcc/ada/ * exp_ch9.adb (Build_Master_Entity): Handle missing case: when the context of the master is a BIP function whose result type has tasks.
2022-11-08ada: Raise Tag_Error when Ada.Tags operations are called with No_TagPiotr Trojanek1-7/+15
Implement missing behavior of RM 13.9 (25.1/3): Tag_Error is raised by a call of Interface_Ancestor_Tags and Is_Descendant_At_Same_Level, if any tag passed is No_Tag. This change also fixes Descendant_Tag, which relies on Is_Descendant_At_Same_Level. The remaining operations already worked properly. gcc/ada/ * libgnat/a-tags.adb (Interface_Ancestor_Tags): Raise Tag_Error on No_Tag. (Is_Descendant_At_Same_Level): Likewise.
2022-11-08ada: Add new -gnatw_q switch to usage messageBob Duff1-0/+4
...along with -gnatw_Q. gcc/ada/ * usage.adb: Add -gnatw_q and -gnatw_Q.
2022-11-08libstdc++: Update my author blurb in the manualJonathan Wakely1-1/+4
libstdc++-v3/ChangeLog: * doc/xml/authors.xml: Update the blurb listing my doc contributions.
2022-11-08libstdc++: Remove empty <author> elements in manualJonathan Wakely3-15/+5
This fixes a spurious comma before the list of authors in the PDF version of the libstdc++ manual. Also fix the commented-out examples which should show <personblurb> not <authorblurb>. libstdc++-v3/ChangeLog: * doc/xml/authors.xml: Remove empty author element. * doc/xml/manual/spine.xml: Likewise. * doc/html/manual/index.html: Regenerate.
2022-11-08Revert "i386: Prefer remote atomic insn for atomic_fetch{add, and, or, xor}"konglin14-62/+4
This reverts commit 48fa4131e419942efc9dd762694fdc7e819de392.
2022-11-08Add m_CORE_ATOM for atom coresHaochen Jiang2-31/+41
gcc/ChangeLog: * config/i386/i386-options.cc (m_CORE_ATOM): New. * config/i386/x86-tune.def (X86_TUNE_SCHEDULE): Initial tune for CORE_ATOM. (X86_TUNE_PARTIAL_REG_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY): Ditto. (X86_TUNE_DEST_FALSE_DEP_FOR_GLC): Ditto. (X86_TUNE_MEMORY_MISMATCH_STALL): Ditto. (X86_TUNE_USE_LEAVE): Ditto. (X86_TUNE_PUSH_MEMORY): Ditto. (X86_TUNE_USE_INCDEC): Ditto. (X86_TUNE_INTEGER_DFMODE_MOVES): Ditto. (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB): Ditto. (X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES): Ditto. (X86_TUNE_USE_SAHF): Ditto. (X86_TUNE_USE_BT): Ditto. (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI): Ditto. (X86_TUNE_ONE_IF_CONV_INSN): Ditto. (X86_TUNE_AVOID_MFENCE): Ditto. (X86_TUNE_USE_SIMODE_FIOP): Ditto. (X86_TUNE_EXT_80387_CONSTANTS): Ditto. (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL): Ditto. (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL): Ditto. (X86_TUNE_SSE_TYPELESS_STORES): Ditto. (X86_TUNE_SSE_LOAD0_BY_PXOR): Ditto. (X86_TUNE_AVOID_4BYTE_PREFIXES): Ditto. (X86_TUNE_USE_GATHER_2PARTS): Ditto. (X86_TUNE_USE_GATHER_4PARTS): Ditto. (X86_TUNE_USE_GATHER): Ditto.
2022-11-07analyzer: start adding support for errnoDavid Malcolm10-2/+167
gcc/analyzer/ChangeLog: * region-model-impl-calls.cc (region_model::impl_call_errno_location): New. * region-model-manager.cc (region_model_manager::region_model_manager): Initialize m_thread_local_region and m_errno_region. * region-model-manager.h (region_model_manager::get_errno_region): New accessor. (region_model_manager::m_thread_local_region): New. (region_model_manager::m_errno_region): New. * region-model.cc (region_model::on_call_pre): Special-case "__errno_location". (region_model::set_errno): New. * region-model.h (impl_call_errno_location): New decl. (region_model::set_errno): New decl. * region.cc (thread_local_region::dump_to_pp): New. (errno_region::dump_to_pp): New. * region.h (enum memory_space): Add MEMSPACE_THREAD_LOCAL. (enum region_kind): Add RK_THREAD_LOCAL and RK_ERRNO. (class thread_local_region): New. (is_a_helper <const thread_local_region *>::test): New. (class errno_region): New. (is_a_helper <const errno_region *>::test): New. * store.cc (binding_cluster::escaped_p): New. (store::escaped_p): Treat errno as always having escaped. (store::replay_call_summary_cluster): Handle RK_THREAD_LOCAL and RK_ERRNO. * store.h (binding_cluster::escaped_p): Remove definition. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/errno-1.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-11-07analyzer: introduce succeed_or_fail_call_infoDavid Malcolm2-23/+32
This makes some followup code much cleaner. gcc/analyzer/ChangeLog: * call-info.cc (success_call_info::get_desc): Delete. (failed_call_info::get_desc): Likewise. (succeed_or_fail_call_info::get_desc): New. * call-info.h (class succeed_or_fail_call_info): New. (class success_call_info): Convert to a subclass of succeed_or_fail_call_info. (class failed_call_info): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>