aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-11-07ada: Remove redundant suppression for non-modified IN OUT parametersPiotr Trojanek1-6/+4
Non-modified IN OUT parameters are first collected and then filtered by examining uses of their enclosing subprograms. In this filtering we don't need to look again at properties of the formal parameters themselves. Cleanup related to improved detection of references to uninitialized objects; semantics is unaffected. gcc/ada/ * sem_warn.adb (No_Warn_On_In_Out): For subprograms we can simply call Warnings_Off. (Output_Non_Modified_In_Out_Warnings): Remove repeated suppression.
2022-11-07ada: Reject boxes in delta array aggregatesPiotr Trojanek1-1/+12
Implement Ada 2022 4.3.4(11/5), which rejects box compound delimiter <> in delta record aggregates, just like another rule rejects it in delta array aggregates. gcc/ada/ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): Reject boxes in delta array aggregates.
2022-11-07ada: Allow reuse of Enclosing_Declaration_Or_Statement by GNATprovePiotr Trojanek3-31/+31
Move routine Enclosing_Declaration_Or_Statement from body of Sem_Res to spec of Sem_Util, so it can be reused. In particular, GNATprove needs this functionality to climb from an arbitrary subexpression with target_name (@) to the enclosing assignment statement. Behaviour of the compiler is unaffected. gcc/ada/ * sem_res.adb (Enclosing_Declaration_Or_Statement): Moved to Sem_Util. * sem_util.ads (Enclosing_Declaration_Or_Statement): Moved from Sem_Res. * sem_util.adb (Enclosing_Declaration_Or_Statement): Likewise.
2022-11-07ada: Clean up unnecesary call in resolution of overloaded expressionsPiotr Trojanek1-2/+2
When experimentally enabling frontend inlining by default, the unnecessary call to Comes_From_Predefined_Lib_Unit in Resolve appears to be a performance bottleneck (most likely this call is expensive because it involves a loop over the currently inlined subprograms). Code cleanup; semantics is unaffected. gcc/ada/ * sem_res.adb (Resolve): Only call Comes_From_Predefined_Lib_Unit when its result might be needed.
2022-11-07ada: Clean up code for visibility of generic actualsPiotr Trojanek1-8/+6
Code cleanup related to fixing visibility of actual parameters in inlining-for-proof in GNATprove mode; semantics is unaffected. gcc/ada/ * sem_ch12.adb (Check_Generic_Actuals): Remove redundant parens; refactor an excessive if-statement; remove repeated call to Node.
2022-11-07ada: Cleanup comment about mapping parameters when inliningPiotr Trojanek1-8/+8
Improve location of the comment about a special case for GNATprove mode. gcc/ada/ * inline.adb (Establish_Actual_Mapping_For_Inlined_Call): Move comment next to a condition that it describes.
2022-11-07ada: Put_Image aspect spec incorrectly not inheritedSteve Baird1-3/+3
In some cases, a Put_Image aspect specification for a scalar type was not correctly inherited by a descendant of that type. gcc/ada/ * exp_put_image.adb (Image_Should_Call_Put_Image): Correctly handle the case of an inherited Put_Image aspect specification for a scalar type.
2022-11-07ada: Tune layout after switching to Ada 2022 aggregate syntaxPiotr Trojanek1-6/+5
Whitespace cleanup only. gcc/ada/ * libgnarl/s-interr.adb: Tune whitespace.
2022-11-07ada: Cleanup WITH clauses after switching from obsolescent Ada 83 unitPiotr Trojanek1-11/+6
Cleanup after replacing Unchecked_Conversion with Ada.Unchecked_Conversion. gcc/ada/ * libgnarl/s-interr.adb: Reorder context items and pragmas.
2022-11-07ada: Create operator nodes in functional stylePiotr Trojanek2-70/+76
A recent patch removed two rewritings, where we kept the operator node but replaced its operands. This patch removes explicit setting of the operands; instead, the operator is already created together with its operands, which seems a bit safer and more consistent with how we typically create operator nodes. It is a cleanup only; semantics is unaffected. gcc/ada/ * exp_ch4.adb (Expand_Modular_Addition): Rewrite using Make_XXX calls. (Expand_Modular_Op): Likewise. (Expand_Modular_Subtraction): Likewise. * exp_imgv.adb (Expand_User_Defined_Enumeration_Image): Likewise.
2022-11-07ada: Don't reuse operator nodes in expansionPiotr Trojanek4-59/+58
This patch removes handling of references to unset objects that relied on Original_Node. This handling was only needed because of rewriting that reused operator nodes, for example, when an array inequality like: A < B was rewritten into: System.Compare_Array_Unsigned_8.Compare_Array_U8 (A'Address, B'Address, A'Length, B'Length) < 0 by keeping the node for operator "<" and only substituting its operands. It seems safer to simply create an new operator node when rewriting and not rely on Original_Node afterwards. Cleanup related to improved detection uninitialized objects. gcc/ada/ * checks.adb (Apply_Arithmetic_Overflow_Strict): Rewrite using a newly created operator node. * exp_ch4.adb (Expand_Array_Comparison): Likewise. * exp_ch6.adb (Add_Call_By_Copy_Code): Rewriting actual parameter using its own location and not the location of the subprogram call. * sem_warn.adb (Check_References): Looping with Original_Node is no longer needed.
2022-11-07ada: Simplify detection of pragmas in the context itemsPiotr Trojanek1-11/+5
Code cleanup; semantics is unaffected. gcc/ada/ * sem_prag.adb (Is_In_Context_Clause): Rewrite without negations and inequalities.
2022-11-07ada: Reject misplaced pragma ObsolescentPiotr Trojanek1-2/+8
Pragma Obsolescent appearing before declaration was putting the Obsolescent flag on the Standard package, which is certainly wrong. The problem was that we relied on the Find_Lib_Unit_Name routine without sanitizing the pragma placement with Check_Valid_Library_Unit_Pragma. Part of cleaning up the warnings machinery to better handle references to unset objects. gcc/ada/ * sem_prag.adb (Analyze_Pragma [Pragma_Obsolescent]): Reject misplaced pragma.
2022-11-07ada: Fix missing tag for with of an obsolescent functionPiotr Trojanek1-1/+1
Fix minor inconsistency in tags of warnings about obsolescent entities. Part of cleaning up the warnings machinery to better handle references to unset objects. gcc/ada/ * sem_warn.adb (Output_Obsolescent_Entity_Warnings): Tag warnings about obsolescent functions just like we tag similar warnings for packages and procedures.
2022-11-07ada: Remove useless validity suppression for attribute InputPiotr Trojanek1-3/+2
Attributes 'Input and 'Read are similar, but only the 'Read denotes a subprogram with parameter of mode OUT where operand validity checks need to be suppressed. Cleanup related to fix for attributes 'Has_Same_Storage and 'Overlaps_Storage. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): Remove useless skipping for attribute Input.
2022-11-07vect: Fold LEN_{LOAD,STORE} if it's for the whole vector [PR107412]Kewen Lin3-14/+64
As the test case in PR107412 shows, we can fold IFN .LEN_{LOAD, STORE} into normal vector load/store if the given length is known to be equal to the length of the whole vector. It would help to improve overall cycles as normally the latency of vector access with length in bytes is bigger than normal vector access, and it also saves the preparation for length if constant length can not be encoded into instruction (such as on power). PR tree-optimization/107412 gcc/ChangeLog: * gimple-fold.cc (gimple_fold_mask_load_store_mem_ref): Rename to ... (gimple_fold_partial_load_store_mem_ref): ... this, add one parameter mask_p indicating it's for mask or length, and add some handlings for IFN LEN_{LOAD,STORE}. (gimple_fold_mask_load): Rename to ... (gimple_fold_partial_load): ... this, add one parameter mask_p. (gimple_fold_mask_store): Rename to ... (gimple_fold_partial_store): ... this, add one parameter mask_p. (gimple_fold_call): Add the handlings for IFN LEN_{LOAD,STORE}, and adjust calls on gimple_fold_mask_load_store_mem_ref to gimple_fold_partial_load_store_mem_ref. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr107412.c: New test. * gcc.target/powerpc/p9-vec-length-epil-8.c: Adjust scan times for folded LEN_LOAD.
2022-11-07Initial Grand Ridge supportHu, Lin112-2/+45
gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_intel_cpu): Handle Grand Ridge. * common/config/i386/i386-common.cc (processor_names): Add grandridge. (processor_alias_table): Ditto. * common/config/i386/i386-cpuinfo.h: (enum processor_types): Add INTEL_GRANDRIDGE. * config.gcc: Add -march=grandridge. * config/i386/driver-i386.cc (host_detect_local_cpu): Handle grandridge. * config/i386/i386-c.cc (ix86_target_macros_internal): Ditto. * config/i386/i386-options.cc (m_GRANDRIDGE): New define. (processor_cost_table): Add grandridge. * config/i386/i386.h (enum processor_type): Add PROCESSOR_GRANDRIDGE. (PTA_GRANDRIDGE): Ditto. * doc/extend.texi: Add grandridge. * doc/invoke.texi: Ditto. gcc/testsuite/ChangeLog: * g++.target/i386/mv16.C: Add grandridge. * gcc.target/i386/funcspec-56.inc: Handle new march.
2022-11-07i386: Prefer remote atomic insn for atomic_fetch{add, and, or, xor}konglin14-4/+62
Add flag -mprefer-remote-atomic to control whether to generate raoint insn for atomic operations. gcc/ChangeLog: * config/i386/i386.opt:Add -mprefer-remote-atomic. * config/i386/sync.md (atomic_<plus_logic><mode>): New define_expand. (atomic_add<mode>): Rename to below one. (atomic_add<mode>_1): To this. (atomic_<logic><mode>): Ditto. (atomic_<logic><mode>_1): Ditto. * doc/invoke.texi: Add -mprefer-remote-atomic. gcc/testsuite/ChangeLog: * gcc.target/i386/raoint-atomic-fetch.c: New test.
2022-11-07Support Intel RAO-INTkonglin137-21/+412
gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_available_features): Detect raoint. * common/config/i386/i386-common.cc (OPTION_MASK_ISA2_RAOINT_SET, OPTION_MASK_ISA2_RAOINT_UNSET): New. (ix86_handle_option): Handle -mraoint. * common/config/i386/i386-cpuinfo.h (enum processor_features): Add FEATURE_RAOINT. * common/config/i386/i386-isas.h: Add ISA_NAME_TABLE_ENTRY for raoint. * config.gcc: Add raointintrin.h * config/i386/cpuid.h (bit_RAOINT): New. * config/i386/i386-builtin.def (BDESC): Add new builtins. * config/i386/i386-c.cc (ix86_target_macros_internal): Define __RAOINT__. * config/i386/i386-isa.def (RAOINT): Add DEF_PTA(RAOINT). * config/i386/i386-options.cc (ix86_valid_target_attribute_inner_p): Add -mraoint. * config/i386/sync.md (rao_a<raointop><mode>): New define insn. * config/i386/i386.opt: Add option -mraoint. * config/i386/x86gprintrin.h: Include raointintrin.h. * doc/extend.texi: Document raoint. * doc/invoke.texi: Document -mraoint. * doc/sourcebuild.texi: Document target raoint. * config/i386/raointintrin.h: New file. gcc/testsuite/ChangeLog: * g++.dg/other/i386-2.C: Add -mraoint. * g++.dg/other/i386-3.C: Ditto. * gcc.target/i386/funcspec-56.inc: Add new target attribute. * gcc.target/i386/sse-12.c: Add -mraoint. * gcc.target/i386/sse-13.c: Ditto. * gcc.target/i386/sse-14.c: Ditto. * gcc.target/i386/sse-22.c: Add raoint target. * gcc.target/i386/sse-23.c: Ditto. * lib/target-supports.exp: Add check_effective_target_raoint. * gcc.target/i386/rao-helper.h: New test. * gcc.target/i386/raoint-1.c: Ditto. * gcc.target/i386/raoint-aadd-2.c: Ditto. * gcc.target/i386/raoint-aand-2.c: Ditto. * gcc.target/i386/raoint-aor-2.c: Ditto. * gcc.target/i386/raoint-axor-2.c: Ditto. * gcc.target/i386/x86gprintrin-1.c: Ditto. * gcc.target/i386/x86gprintrin-2.c: Ditto. * gcc.target/i386/x86gprintrin-3.c: Ditto. * gcc.target/i386/x86gprintrin-4.c: Ditto. * gcc.target/i386/x86gprintrin-5.c: Ditto.
2022-11-07Initial Granite Rapids SupportHaochen Jiang12-3/+52
gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_intel_cpu): Handle Granite Rapids. * common/config/i386/i386-common.cc: (processor_names): Add graniterapids. (processor_alias_table): Ditto. * common/config/i386/i386-cpuinfo.h (enum processor_subtypes): Add INTEL_GRANTIERAPIDS. * config.gcc: Add -march=graniterapids. * config/i386/driver-i386.cc (host_detect_local_cpu): Handle graniterapids. * config/i386/i386-c.cc (ix86_target_macros_internal): Ditto. * config/i386/i386-options.cc (m_GRANITERAPIDS): New. (processor_cost_table): Add graniterapids. * config/i386/i386.h (enum processor_type): Add PROCESSOR_GRANITERAPIDS. (PTA_GRANITERAPIDS): Ditto. * doc/extend.texi: Add graniterapids. * doc/invoke.texi: Ditto. gcc/testsuite/ChangeLog: * g++.target/i386/mv16.C: Add graniterapids. * gcc.target/i386/funcspec-56.inc: Handle new march.
2022-11-07Support Intel prefetchit0/t1Haochen Jiang36-20/+345
gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_available_features): Detect PREFETCHI. * common/config/i386/i386-common.cc (OPTION_MASK_ISA2_PREFETCHI_SET, OPTION_MASK_ISA2_PREFETCHI_UNSET): New. (ix86_handle_option): Handle -mprefetchi. * common/config/i386/i386-cpuinfo.h (enum processor_features): Add FEATURE_PREFETCHI. * common/config/i386/i386-isas.h: Add ISA_NAME_TABLE_ENTRY for prefetchi. * config.gcc: Add prfchiintrin.h. * config/i386/cpuid.h (bit_PREFETCHI): New. * config/i386/i386-builtin-types.def: Add DEF_FUNCTION_TYPE (VOID, PCVOID, INT) and DEF_FUNCTION_TYPE (VOID, PCVOID, INT, INT, INT). * config/i386/i386-builtin.def (BDESC): Add new builtins. * config/i386/i386-c.cc (ix86_target_macros_internal): Define __PREFETCHI__. * config/i386/i386-expand.cc: Handle new builtins. * config/i386/i386-isa.def (PREFETCHI): Add DEF_PTA(PREFETCHI). * config/i386/i386-options.cc (ix86_valid_target_attribute_inner_p): Handle prefetchi. * config/i386/i386.md (prefetchi): New define_insn. * config/i386/i386.opt: Add option -mprefetchi. * config/i386/predicates.md (local_func_symbolic_operand): New predicates. * config/i386/x86gprintrin.h: Include prfchiintrin.h. * config/i386/xmmintrin.h (enum _mm_hint): New enum for prefetchi. (_mm_prefetch): Handle the highest bit of enum. * doc/extend.texi: Document prefetchi. * doc/invoke.texi: Document -mprefetchi. * doc/sourcebuild.texi: Document target prefetchi. * config/i386/prfchiintrin.h: New file. gcc/testsuite/ChangeLog: * g++.dg/other/i386-2.C: Add -mprefetchi. * g++.dg/other/i386-3.C: Ditto. * gcc.target/i386/avx-1.c: Ditto. * gcc.target/i386/funcspec-56.inc: Add new target attribute. * gcc.target/i386/sse-13.c: Add -mprefetchi. * gcc.target/i386/sse-23.c: Ditto. * gcc.target/i386/x86gprintrin-1.c: Ditto. * gcc.target/i386/x86gprintrin-2.c: Ditto. * gcc.target/i386/x86gprintrin-3.c: Ditto. * gcc.target/i386/x86gprintrin-4.c: Ditto. * gcc.target/i386/x86gprintrin-5.c: Ditto. * gcc.target/i386/prefetchi-1.c: New test. * gcc.target/i386/prefetchi-2.c: Ditto. * gcc.target/i386/prefetchi-3.c: Ditto. * gcc.target/i386/prefetchi-4.c: Ditto. Co-authored-by: Hongtao Liu <hongtao.liu@intel.com>
2022-11-07Daily bump.GCC Administrator5-1/+59
2022-11-06optabs: Use operand[2] mode in can_vec_set_var_idx_pUros Bizjak1-1/+6
Use operand[2] mode in can_vec_set_var_idx_p when checking vec_set_optab. This change allows non-VOID index operand in vec_set_optab. 2022-11-06 Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog: * optabs.cc (can_vec_set_var_idx_p): Use operand[2] mode when checking vec_set_optab.
2022-11-06libstdc++: Declare const global variables inlinePatrick Palka5-23/+23
The changes inside the regex_constants and execution namespaces seem to be (the only) unimplemented parts of P0607R0 "Inline Variable for the Standard Library"; the rest of the changes are to implementation details. libstdc++-v3/ChangeLog: * include/bits/atomic_wait.h (_detail::__platform_wait_alignment): Declare inline. Remove redundant static specifier. (__detail::__atomic_spin_count_relax): Declare inline. (__detail::__atomic_spin_count): Likewise. * include/bits/regex_automaton.h (__detail::_S_invalid_state_id): Declare inline for C++17. Declare constexpr. Remove redundant const and static specifiers. * include/bits/regex_error.h (regex_constants::error_collate): Declare inline for C++17 as per P0607R0. (regex_constants::error_ctype): Likewise. (regex_constants::error_escape): Likewise. (regex_constants::error_backref): Likewise. (regex_constants::error_brack): Likewise. (regex_constants::error_paren): Likewise. (regex_constants::error_brace): Likewise. (regex_constants::error_badbrace): Likewise. (regex_constants::error_range): Likewise. (regex_constants::error_space): Likewise. (regex_constants::error_badrepeat): Likewise. (regex_constants::error_complexity): Likewise. (regex_constants::error_stack): Likewise. * include/ext/concurrence.h (__gnu_cxx::__default_lock_policy): Likewise. Remove redundant static specifier. * include/pstl/execution_defs.h (execution::seq): Declare inline for C++17 as per P0607R0. (execution::par): Likewise. (execution::par_unseq): Likewise. (execution::unseq): Likewise.
2022-11-06libstdc++: Move stream initialization into compiled library [PR44952]Patrick Palka3-0/+18
This patch moves the static object for constructing the standard streams out from <iostream> and into the compiled library on systems that support init priorities. This'll mean <iostream> no longer introduces a separate global constructor in each TU that includes it. We can do this only if the init_priority attribute is supported because we need a way to ensure the stream initialization runs first before any user global initializer, particularly when linking with a static libstdc++.a. PR libstdc++/44952 PR libstdc++/39796 PR libstdc++/98108 libstdc++-v3/ChangeLog: * include/std/iostream (__ioinit): No longer define here if the init_priority attribute is usable. * src/c++98/ios_init.cc (__ioinit): Define here instead if init_priority is usable, via ... * src/c++98/ios_base_init.h: ... this new file.
2022-11-06c++: correct __has_attribute(init_priority)Patrick Palka2-13/+17
Currently __has_attribute(init_priority) always returns true, even on targets that don't actually support init priorities, and when using the attribute on such targets we just get a hard error about them being unsupported. This makes it impossible to conditionally use the attribute by querying __has_attribute. This patch fixes this by including init_priority in the attribute table only if the target supports init priorities. Thus on such targets __has_attribute(init_priority) will now return false and we'll treat it as just another unrecognized attribute (e.g. using it gives a -Wattribute warning instead of a hard error). gcc/cp/ChangeLog: * tree.cc (cxx_attribute_table): Include init_priority entry only if SUPPORTS_INIT_PRIORITY. (handle_init_priority_attribute): Add ATTRIBUTE_UNUSED. Assert SUPPORTS_INIT_PRIORITY is true. gcc/testsuite/ChangeLog: * g++.dg/special/initpri3.C: New test.
2022-11-06Manually add ChangeLog entries from ↵Jakub Jelinek5-0/+56
r13-3652-ge4cba49413ca429dc82f6aa2e88129ecb3fdd943 This commit caused failure of update_version_git due to the removal of liboffloadmic with ChangeLog in it, so I had to blacklist that commit and here I'm adding ChangeLog entries manually.
2022-11-06Daily bump.GCC Administrator12-1/+616
2022-11-06Add another commit to ignoreJakub Jelinek1-1/+2
We can't handle r13-3652-ge4cba49413ca429dc82f6aa2e88129ecb3fdd943 * gcc-changelog/git_update_version.py: Add e4cba49413ca429dc82f6aa2e88129ecb3fdd943 to ignored commits.
2022-11-06LoongArch: Add fcopysign instructionsXi Ruoyao2-1/+37
Add fcopysign.{s,d} with the names copysign{sf,df}3 so GCC will expand __builtin_copysign{f,} to a single instruction. Link: https://sourceware.org/pipermail/libc-alpha/2022-November/143177.html gcc/ChangeLog: * config/loongarch/loongarch.md (UNSPEC_FCOPYSIGN): New unspec. (type): Add fcopysign. (copysign<mode>3): New instruction template. gcc/testsuite/ChangeLog: * gcc.target/loongarch/fcopysign.c: New test.
2022-11-06Plug memory leak in attribute target_clonesBernhard Reutner-Fischer1-4/+8
It looks like there was some memory leak in the handling of attribute target_clones. Ok for trunk if testing passes? gcc/ChangeLog: * multiple_target.cc (expand_target_clones): Free memory. Signed-off-by: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2022-11-06cgraph_node: Remove redundant section clearingBernhard Reutner-Fischer2-2/+0
Ok for trunk if testing passes? gcc/ChangeLog: * cgraph.cc (cgraph_node::make_local): Remove redundant set_section. * multiple_target.cc (create_dispatcher_calls): Likewise. Signed-off-by: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2022-11-05d: Adjust test to pass when compiling with -m32Iain Buclaw1-2/+2
Noticed when running on x86_64-linux-gnu with `-m32', this test triggered other errors. Adjusted the test to use a different register that is common between x86 and x86_64. gcc/testsuite/ChangeLog: * gdc.dg/attr_register2.d: Adjust test.
2022-11-05d: Add support for vector comparison operatorsIain Buclaw15-186/+79
The front-end added semantic support to permit comparing two vector expressions. This removes the restriction in the code generator, as well as the intrisics that previously exposed the same operation. gcc/d/ChangeLog: * d-target.cc (Target::isVectorOpSupported): Remove cases for comparison operators. * intrinsics.cc (maybe_set_intrinsic): Remove cases for vector comparison intrinsics. (maybe_warn_intrinsic_mismatch): Likewise. (expand_intrinsic_vec_cond): Remove. (maybe_expand_intrinsic): Remove cases for vector comparison intrinsics. * intrinsics.def (INTRINSIC_EQUALMASK): Remove. (INTRINSIC_NOTEQUALMASK): Remove. (INTRINSIC_GREATERMASK): Remove. (INTRINSIC_GREATEREQUALMASK): Remove. libphobos/ChangeLog: * libdruntime/gcc/simd.d (equalMask): Implement using generics. (notEqualMask): Likewise. (greaterMask): Likewise. (greaterOrEqualMask): Likewise. (notMask): Likewise. (andAndMask): Likewise. (orOrMask): Likewise. gcc/testsuite/ChangeLog: * gdc.dg/Wbuiltin_declaration_mismatch2.d: Remove comparision tests. * gdc.dg/simd2a.d: Update comparison tests. * gdc.dg/simd2b.d: Likewise. * gdc.dg/simd2c.d: Likewise. * gdc.dg/simd2d.d: Likewise. * gdc.dg/simd2e.d: Likewise. * gdc.dg/simd2f.d: Likewise. * gdc.dg/simd2g.d: Likewise. * gdc.dg/simd2h.d: Likewise. * gdc.dg/simd2i.d: Likewise. * gdc.dg/simd2j.d: Likewise.
2022-11-05c++: libcpp: Support raw strings with newlines in directives [PR55971]Lewis Hyatt4-10/+148
It's not currently possible to use a C++11 raw string containing a newline as part of the definition of a macro, or in any other preprocessing directive, such as: #define X R"(two lines)" #error R"(this error has two lines)" Add support for that by relaxing the conditions under which _cpp_get_fresh_line() refuses to get a new line. For the case of lexing a raw string, it's OK to do so as long as there is another line within the current buffer. The code in cpp_get_fresh_line() was refactored into a new function get_fresh_line_impl(), so that the new logic is applied only when processing a raw string and not any other times. libcpp/ChangeLog: PR preprocessor/55971 * lex.cc (get_fresh_line_impl): New function refactoring the code from... (_cpp_get_fresh_line): ...here. (lex_raw_string): Use the new version of get_fresh_line_impl() to support raw strings containing new lines when processing a directive. gcc/testsuite/ChangeLog: PR preprocessor/55971 * c-c++-common/raw-string-directive-1.c: New test. * c-c++-common/raw-string-directive-2.c: New test. gcc/c-family/ChangeLog: PR preprocessor/55971 * c-ppoutput.cc (adjust_for_newlines): Update comment.
2022-11-05libstdc++: fix pointer type exception catch (no RTTI) [PR105387]Jakob Hasse3-1/+94
__pbase_type_info::__do_catch(), used to catch pointer type exceptions, did not check if the type info object to compare against is a pointer type info object before doing a static down-cast to a pointer type info object. If RTTI is disabled, this leads to the following situation: Since a pointer type info object has additional fields, they would end up being undefined if the actual type info object was not a pointer type info object. A simple check has been added before the down-cast happens. Note that a consequence of this check is that exceptions of type pointer-to-member cannot be caught anymore. In case RTTI is enabled, this does not seem to be a problem because RTTI-based checks would run before and prevent running into the bad down-cast. Hence, the fix is disabled if RTTI is enabled and exceptions of type pointer-to-member can still be caught. libstdc++-v3/ChangeLog: PR libstdc++/105387 * libsupc++/pbase_type_info.cc (__do_catch) [!__cpp_rtti]: Add check that the thrown type is actually a pointer. * testsuite/18_support/105387.cc: New test. * testsuite/18_support/105387_memptr.cc: New test. Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
2022-11-05libstdc++: Do not use SFINAE for propagate_const conversions [PR107525]Jonathan Wakely2-22/+113
As the PR notes, the current conversion operators are defined as function templates so that we can use SFINAE. But this changes how they are considered for overload resolution. This moves those operators into base classes that can be specialized so the operators are obsent unless the constraints are satisfied. libstdc++-v3/ChangeLog: PR libstdc++/107525 * include/experimental/propagate_const (operator element_type*()): Move into base class that can be partially specilized to iompose constraints. (operator const element_type*()): Likewise. * testsuite/experimental/propagate_const/observers/107525.cc: New test.
2022-11-05doc: Document correct -fwide-exec-charset defaults [PR41041]Jonathan Wakely1-3/+4
As shown in the PR, the default is not UTF-32 but rather UTF-32BE or UTF-32LE, avoiding the need for a byte order mark in literals. gcc/ChangeLog: PR c/41041 * doc/cppopts.texi: Document -fwide-exec-charset defaults correctly.
2022-11-05Support multilib-aware target lib flags self-specs overridingAlexandre Oliva4-2/+42
This patch introduces -fmultiflags, short for multilib TFLAGS, as an option that does nothing by default, but that can be added to TFLAGS and mapped to useful options by driver self-specs. for gcc/ChangeLog * common.opt (fmultiflags): New. * doc/invoke.texi: Document it. * gcc.cc (driver_self_specs): Discard it. * opts.cc (common_handle_option): Ignore it in the driver.
2022-11-04testsuite: Add testcase from C++23 P2314R4 - Character sets and encodingsJakub Jelinek1-0/+10
I've read the paper and I believe we just implement it with no changes needed (at least since PR67224 and similar libcpp changes in GCC 10), but I could be wrong. The following patch at least adds a testcase from the start of the paper. 2022-11-04 Jakub Jelinek <jakub@redhat.com> * g++.dg/cpp23/charset1.C: New testcase from C++23 P2314R4.
2022-11-04libcpp: Update to Unicode 15Jakub Jelinek4-16992/+17225
The following pseudo-patch regenerates the libcpp tables with Unicode 15.0.0 which added 4489 new characters. As mentioned previously, this isn't just a matter of running the two libcpp/make*.cc programs on the new Unicode files, but one needs to manually update a table inside of makeuname2c.cc according to a table in Unicode text (which is partially reflected in the text files, but e.g. in Unicode 14.0.0 not 100% accurately, in 15.0.0 actually accurately). I've also added some randomly chosen subset of those 4489 new characters to a testcase. 2022-11-04 Jakub Jelinek <jakub@redhat.com> gcc/testsuite/ * c-c++-common/cpp/named-universal-char-escape-1.c: Add tests for some characters newly added in Unicode 15.0.0. libcpp/ * makeuname2c.cc (struct generated): Update from Unicode 15.0.0 table 4-8. * ucnid.h: Regenerated for Unicode 15.0.0. * uname2c.h: Likewise.
2022-11-04AArch64: Fix testcaseWilco Dijkstra1-3/+3
gcc/testsuite/ * gcc.target/aarch64/mgeneral-regs_3.c: Fix testcase.
2022-11-04input: add get_source_text_betweenJeff Chapman II2-0/+93
The c++-contracts branch uses this to retrieve the source form of the contract predicate, to be returned by contract_violation::comment(). Co-authored-by: Jason Merrill <jason@redhat.com> gcc/ChangeLog: * input.cc (get_source_text_between): New fn. * input.h (get_source_text_between): Declare.
2022-11-04Set nonzero bits for multiplication and divisions by a power of 2.Aldy Hernandez3-0/+96
We're missing a lot of TLC in keeping track of nonzero bits across range-ops. It isn't an oversight, but just limited amount of hours to implement stuff. This patch keeps better track of the nonzero mask (really maybe_nonzero bits as discussed) across multiplication and division when the RHS is a power of 2. It fixes PR107342 and also touches on PR55157. In the latter, the nonzero mask is being set quite late (CCP2) but could be set by evrp time if we enhanced range-ops. I have added tests from both PRs. Tested PR tree-optimization/107342 gcc/ChangeLog: * range-op.cc (operator_mult::fold_range): New. (operator_div::fold_range): New. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/vrp122.c: New test. * gcc.dg/tree-ssa/vrp123.c: New test.
2022-11-04Fix recent thinko in operand_equal_pEric Botcazou5-14/+61
There is a thinko in a recent improvement made to operand_equal_p where the code just looks at operand 2 of COMPONENT_REF, if it is present, to compare addresses. That's wrong because operand 2 contains the number of DECL_OFFSET_ALIGN-bit-sized words so, when DECL_OFFSET_ALIGN > 8, not all the bytes are included and some of them are in DECL_FIELD_BIT_OFFSET, see get_inner_reference for the model computation. In other words, you would need to compare operand 2 and DECL_OFFSET_ALIGN and DECL_FIELD_BIT_OFFSET in this situation, but I'm not sure this is worth the hassle in practice so the fix just removes this alternate handling. gcc/ * fold-const.cc (operand_compare::operand_equal_p) <COMPONENT_REF>: Do not take into account operand 2. (operand_compare::hash_operand) <COMPONENT_REF>: Likewise. gcc/testsuite/ * gnat.dg/opt99.adb: New test. * gnat.dg/opt99_pkg1.ads, gnat.dg/opt99_pkg1.adb: New helper. * gnat.dg/opt99_pkg2.ads: Likewise.
2022-11-04Do not use subword paradoxical subregs in emit_group_storeEric Botcazou1-13/+13
The goal of the trick is to make life easier for the combiner, but subword paradoxical subregs make it harder for the register allocator instead. gcc/ * expr.cc (emit_group_store): Do not use subword paradoxical subregs
2022-11-04libstdc++: Simplify lifetime of eh_globals variable [PR107500]Jonathan Wakely1-15/+5
Since this is a trivial type, we probably don't need to do anything to ensure it's still accessible after other static dtors. libstdc++-v3/ChangeLog: PR libstdc++/107500 * libsupc++/eh_globals.cc (eh_globals): Remove immortalizing wrapper. (__cxxabiv1::__cxa_get_globals_fast): Adjust. (__cxxabiv1::__cxa_get_globals): Adjust.
2022-11-04libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR107511]Jonathan Wakely1-0/+5
As in r12-6867-ge20486d508afdf we need to define _GNU_SOURCE explicitly for Cygwin, because configure finds it in libc but it isn't declared unless we request it. libstdc++-v3/ChangeLog: PR libstdc++/107511 * libsupc++/eh_alloc.cc (_GNU_SOURCE): Define.
2022-11-04ada: Fix for validity checks combined with aliasing checksJustin Squirek1-5/+11
Attribute Overlaps_Storage, which can appear implicitly in expansion of aliasing checks, is now excluded from operand validity checks. Likewise for attribute Has_Same_Storage. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): Skip operand validity checks for attributes Has_Same_Storage and Overlaps_Storage.
2022-11-04ada: Fix couple of issues with arrays indexed by enumeration typeEric Botcazou2-15/+5
The first one is that Remove_Warning_Messages reinstates the Original_Node of an N_Raise_Constraint_Error node in the tree for no clear reasons, and the Original_Node may contain constructs whose expansion has been stopped when the Constraint_Error was asserted, eventually causing gigi to stop. The second one is that a path in Build_Array_Aggr_Code.Gen_Loop does not copy the loop bounds, unlike other paths, thus triggering a sharing issue. gcc/ada/ * errout.adb (Remove_Warning_Messages.Check_For_Warning): Do not reinstate the Original_Node in the tree. * exp_aggr.adb (Build_Array_Aggr_Code.Gen_Loop): Copy the bounds on all paths.