aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-09-29aarch64: Fix transitive closure of featuresRichard Sandiford3-10/+58
aarch64-option-extensions.def requires us to maintain the transitive closure of options by hand. This patch fixes a few cases where a flag was missed. +noaes and +nosha2 now disable +crypto, which IMO makes more sense and is consistent with the Clang behaviour. gcc/ * config/aarch64/aarch64-option-extensions.def (dotprod): Depend on fp as well as simd. (sha3): Likewise. (aes): Likewise. Make +noaes disable crypto. (sha2): Likewise +nosha2. Also make +nosha2 disable sha3 and sve2-sha3. (sve2-sha3): Depend on sha2 as well as sha3. gcc/testsuite/ * gcc.target/aarch64/options_set_6.c: Expect +crypto+nosha2 to disable crypto but keep aes. * gcc.target/aarch64/pragma_cpp_predefs_4.c: New test.
2022-09-29aarch64: Remove AARCH64_FL_RCPC8_4 [PR107025]Richard Sandiford2-4/+3
AARCH64_FL_RCPC8_4 is an odd-one-out in that it has no associated entry in aarch64-option-extensions.def. This means that, although it is internally separated from AARCH64_FL_V8_4A, there is no mechanism for turning it on and off individually, independently of armv8.4-a. The only place that the flag was used independently was in the entry for thunderx3t110, which enabled it alongside V8_3A. As noted in PR107025, this means that any use of the extension will fail to assemble. In the PR trail, Andrew suggested removing the core entry. That might be best long-term, but since the barrier for removing command-line options without a deprecation period is very high, this patch instead just drops the flag from the core entry. We'll still produce correct code. gcc/ PR target/107025 * config/aarch64/aarch64.h (oAARCH64_FL_RCPC8_4): Delete. (AARCH64_FL_FOR_V8_4A): Update accordingly. (AARCH64_ISA_RCPC8_4): Use AARCH64_FL_V8_4A directly. * config/aarch64/aarch64-cores.def (thunderx3t110): Remove AARCH64_FL_RCPC8_4.
2022-09-29aarch64: Avoid redundancy in aarch64-cores.defRichard Sandiford4-68/+68
The flags fields of the aarch64-cores.def always start with AARCH64_FL_FOR_<ARCH>. After previous changes, <ARCH> is always identical to the previous field, so we can drop the explicit AARCH64_FL_FOR_<ARCH> and derive it programmatically. This isn't a big saving in itself, but it helps with later patches. gcc/ * config/aarch64/aarch64-cores.def: Remove AARCH64_FL_FOR_<ARCH> from the flags field. * common/config/aarch64/aarch64-common.cc (all_cores): Add it here instead. * config/aarch64/aarch64.cc (all_cores): Likewise. * config/aarch64/driver-aarch64.cc (all_cores): Likewise.
2022-09-29aarch64: Small config.gcc cleanupsRichard Sandiford2-9/+1
The aarch64-option-extensions.def parsing in config.gcc had some code left over from when it tried to parse the whole macro definition. Also, config.gcc now only looks at the first fields of the aarch64-arches.def entries. gcc/ * config.gcc: Remove dead aarch64-option-extensions.def code. * config/aarch64/aarch64-arches.def: Update comment.
2022-09-29aarch64: Add "V" to aarch64-arches.def namesRichard Sandiford5-82/+83
This patch completes the renaming of architecture-level related things by adding "V" to the name of the architecture in aarch64-arches.def. Since the "V" is predictable, we can easily drop it when we don't need it (as when matching /proc/cpuinfo). Having a valid C identifier is necessary for later patches. gcc/ * config/aarch64/aarch64-arches.def: Add a leading "V" to the ARCH_IDENT fields. * config/aarch64/aarch64-cores.def: Update accordingly. * common/config/aarch64/aarch64-common.cc (all_cores): Likewise. * config/aarch64/aarch64.cc (all_cores): Likewise. * config/aarch64/driver-aarch64.cc (aarch64_arches): Skip the leading "V".
2022-09-29aarch64: Rename AARCH64_FL_FOR_ARCH macrosRichard Sandiford5-109/+109
This patch renames AARCH64_FL_FOR_ARCH* macros to follow the same V<number><profile> names that we (now) use elsewhere. The names are only temporary -- a later patch will move the information to the .def file instead. However, it helps with the sequencing to do this first. gcc/ * config/aarch64/aarch64.h (AARCH64_FL_FOR_ARCH8): Rename to... (AARCH64_FL_FOR_V8A): ...this. (AARCH64_FL_FOR_ARCH8_1): Rename to... (AARCH64_FL_FOR_V8_1A): ...this. (AARCH64_FL_FOR_ARCH8_2): Rename to... (AARCH64_FL_FOR_V8_2A): ...this. (AARCH64_FL_FOR_ARCH8_3): Rename to... (AARCH64_FL_FOR_V8_3A): ...this. (AARCH64_FL_FOR_ARCH8_4): Rename to... (AARCH64_FL_FOR_V8_4A): ...this. (AARCH64_FL_FOR_ARCH8_5): Rename to... (AARCH64_FL_FOR_V8_5A): ...this. (AARCH64_FL_FOR_ARCH8_6): Rename to... (AARCH64_FL_FOR_V8_6A): ...this. (AARCH64_FL_FOR_ARCH8_7): Rename to... (AARCH64_FL_FOR_V8_7A): ...this. (AARCH64_FL_FOR_ARCH8_8): Rename to... (AARCH64_FL_FOR_V8_8A): ...this. (AARCH64_FL_FOR_ARCH8_R): Rename to... (AARCH64_FL_FOR_V8R): ...this. (AARCH64_FL_FOR_ARCH9): Rename to... (AARCH64_FL_FOR_V9A): ...this. (AARCH64_FL_FOR_ARCH9_1): Rename to... (AARCH64_FL_FOR_V9_1A): ...this. (AARCH64_FL_FOR_ARCH9_2): Rename to... (AARCH64_FL_FOR_V9_2A): ...this. (AARCH64_FL_FOR_ARCH9_3): Rename to... (AARCH64_FL_FOR_V9_3A): ...this. * common/config/aarch64/aarch64-common.cc (all_cores): Update accordingly. * config/aarch64/aarch64-arches.def: Likewise. * config/aarch64/aarch64-cores.def: Likewise. * config/aarch64/aarch64.cc (all_cores): Likewise.
2022-09-29aarch64: Rename AARCH64_FL architecture-level macrosRichard Sandiford1-36/+36
Following on from the previous AARCH64_ISA patch, this one adds the profile name directly to the end of architecture-level AARCH64_FL_* macros. gcc/ * config/aarch64/aarch64.h (AARCH64_FL_V8_1, AARCH64_FL_V8_2) (AARCH64_FL_V8_3, AARCH64_FL_V8_4, AARCH64_FL_V8_5, AARCH64_FL_V8_6) (AARCH64_FL_V9, AARCH64_FL_V8_7, AARCH64_FL_V8_8, AARCH64_FL_V9_1) (AARCH64_FL_V9_2, AARCH64_FL_V9_3): Add "A" to the end of the name. (AARCH64_FL_V8_R): Rename to AARCH64_FL_V8R. (AARCH64_FL_FOR_ARCH8_1, AARCH64_FL_FOR_ARCH8_2): Update accordingly. (AARCH64_FL_FOR_ARCH8_3, AARCH64_FL_FOR_ARCH8_4): Likewise. (AARCH64_FL_FOR_ARCH8_5, AARCH64_FL_FOR_ARCH8_6): Likewise. (AARCH64_FL_FOR_ARCH8_7, AARCH64_FL_FOR_ARCH8_8): Likewise. (AARCH64_FL_FOR_ARCH8_R, AARCH64_FL_FOR_ARCH9): Likewise. (AARCH64_FL_FOR_ARCH9_1, AARCH64_FL_FOR_ARCH9_2): Likewise. (AARCH64_FL_FOR_ARCH9_3, AARCH64_ISA_V8_2A, AARCH64_ISA_V8_3A) (AARCH64_ISA_V8_4A, AARCH64_ISA_V8_5A, AARCH64_ISA_V8_6A): Likewise. (AARCH64_ISA_V8R, AARCH64_ISA_V9A, AARCH64_ISA_V9_1A): Likewise. (AARCH64_ISA_V9_2A, AARCH64_ISA_V9_3A): Likewise.
2022-09-29aarch64: Rename AARCH64_ISA architecture-level macrosRichard Sandiford3-17/+17
All AARCH64_ISA_* architecture-level macros except AARCH64_ISA_V8_R are for the A profile: they cause __ARM_ARCH_PROFILE to be set to 'A' and they are associated with architecture names like armv8.4-a. It's convenient for later patches if we make this explicit by adding an "A" to the name. Also, rather than add an underscore (as for V8_R) it's more convenient to add the profile directly to the number, like we already do in the ARCH_IDENT field of the aarch64-arches.def entries. gcc/ * config/aarch64/aarch64.h (AARCH64_ISA_V8_2, AARCH64_ISA_V8_3) (AARCH64_ISA_V8_4, AARCH64_ISA_V8_5, AARCH64_ISA_V8_6) (AARCH64_ISA_V9, AARCH64_ISA_V9_1, AARCH64_ISA_V9_2) (AARCH64_ISA_V9_3): Add "A" to the end of the name. (AARCH64_ISA_V8_R): Rename to AARCH64_ISA_V8R. (TARGET_ARMV8_3, TARGET_JSCVT, TARGET_FRINT, TARGET_MEMTAG): Update accordingly. * common/config/aarch64/aarch64-common.cc (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-c.cc (aarch64_define_unconditional_macros): Likewise.
2022-09-29Add OPTIONS_H_EXTRA to GTFILESRichard Sandiford1-0/+1
I have a patch that adds a typedef to aarch64's <cpu>-opts.h. The typedef is used for a TargetVariable in the .opt file, which means that it is covered by PCH and so needs to be visible to gengtype. <cpu>-opts.h is not included directly in tm.h, but indirectly by target headers (in this case aarch64.h). There was therefore nothing that caused it to be added to GTFILES. gcc/ * Makefile.in (GTFILES): Add OPTIONS_H_EXTRA.
2022-09-29driver, cppdefault: Unbreak bootstrap on Debian/Ubuntu [PR107059]Jakub Jelinek2-0/+15
My recent change to enable _Float{16,32,64,128,32x,64x,128x} for C++ apparently broke bootstrap on some Debian/Ubuntu setups. Those multiarch targets put some headers into /usr/include/x86_64-linux-gnu/bits/ etc. subdirectory instead of /usr/include/bits/. This is handled by /* /usr/include comes dead last. */ { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 }, { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 }, in cppdefault.cc, where the 2 in the last element of the first initializer means the entry is ignored on non-multiarch and suffixed by the multiarch dir otherwise, so installed gcc has search path like: /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed /usr/local/include /usr/include/x86_64-linux-gnu /usr/include (when installed with DESTDIR=/home/jakub/gcc/obj01inst). Now, when fixincludes is run, it is processing the whole /usr/include dir and all its subdirectories, so floatn{,-common.h} actually go into .../include-fixed/x86_64-linux-gnu/bits/floatn{,-common.h} because that is where they appear in /usr/include too. In some setups, /usr/include also contains /usr/include/bits -> x86_64-linux-gnu/bits symlink and after the r13-2896 tweak it works. In other setups there is no /usr/include/bits symlink and when one #include <bits/floatn.h> given the above search path, it doesn't find the fixincluded header, as /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed/bits/floatn.h doesn't exist and /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed/x86_64-linux-gnu/bits/floatn.h isn't searched and so /usr/include/x86_64-linux-gnu/bits/floatn.h wins and we fail because of typedef whatever _Float128; and similar. The following patch ought to fix this. The first hunk by arranging that the installed search path actually looks like: /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed/x86_64-linux-gnu /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed /usr/local/include /usr/include/x86_64-linux-gnu /usr/include and thus for include-fixed it treats it the same as /usr/include. The second FIXED_INCLUDE_DIR entry there is: { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, /* A multilib suffix needs adding if different multilibs use different headers. */ #ifdef SYSROOT_HEADERS_SUFFIX_SPEC 1 #else 0 #endif }, where SYSROOT_HEADERS_SUFFIX_SPEC is defined only on vxworks or mips*-mti-linux and arranges for multilib path to be appended there. Neither of those systems is multiarch. This isn't enough, because when using the -B option, the driver adds -isystem .../include-fixed in another place, so the second hunk modifies that spot the same. /home/jakub/gcc/obj01/gcc/xgcc -B /home/jakub/gcc/obj01/gcc/ then has search path: /home/jakub/gcc/obj01/gcc/include /home/jakub/gcc/obj01/gcc/include-fixed/x86_64-linux-gnu /home/jakub/gcc/obj01/gcc/include-fixed /usr/local/include /usr/include/x86_64-linux-gnu /usr/include which again is what I think we want to achieve. 2022-09-29 Jakub Jelinek <jakub@redhat.com> PR bootstrap/107059 * cppdefault.cc (cpp_include_defaults): If SYSROOT_HEADERS_SUFFIX_SPEC isn't defined, add FIXED_INCLUDE_DIR entry with multilib flag 2 before FIXED_INCLUDE_DIR entry with multilib flag 0. * gcc.cc (do_spec_1): If multiarch_dir, add include-fixed/multiarch_dir paths before include-fixed paths.
2022-09-29support -gz=zstd for both linker and assemblerMartin Liska4-5/+37
PR driver/106897 gcc/ChangeLog: * common.opt: Add -gz=zstd value. * configure.ac: Detect --compress-debug-sections=zstd for both linker and assembler. * configure: Regenerate. * gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Handle -gz=zstd. (ASM_COMPRESS_DEBUG_SPEC): Likewise.
2022-09-29ada: Remove duplicated doc comment sectionRonan Desplanques1-37/+3
A documentation section was duplicated by mistake in r0-110752. This commit removes the copy that was added by r0-110752, but integrates the small editorial change that it brought to the original. gcc/ada/ * einfo.ads: remove documentation duplicate
2022-09-29ada: Further tweak new expansion of contractsEric Botcazou2-6/+48
The original extended return statement is mandatory for functions whose result type is limited in Ada 2005 and later. gcc/ada/ * contracts.adb (Build_Subprogram_Contract_Wrapper): Put back the extended return statement if the result type is built-in-place. * sem_attr.adb (Analyze_Attribute_Old_Result): Also expect an extended return statement.
2022-09-29ada: Improve efficiency of slice-of-component assignmentBob Duff1-24/+71
This patch improves the efficiency of slice assignment when the left- or right-hand side is a slice of a component or a slice of a slice. Previously, the optimization was disabled in these cases, just in case there might be a volatile or independent component lurking. Now we explicitly check all the relevant subcomponents of the prefix. The previous version said (in exp_ch5.adb): -- ...We could -- complicate this code by actually looking for such volatile and -- independent components. and that's exactly what we are doing here. gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Make the checks for volatile and independent objects more precise.
2022-09-29ada: Fix checking of Refined_State with nested package renamingsPiotr Trojanek1-1/+4
When collecting package state declared in package body, we should only recursively examine the visible part of nested packages while ignoring other entities related to packages (e.g. package bodies or package renamings). gcc/ada/ * sem_util.adb (Collect_Visible_States): Ignore package renamings.
2022-09-29tree-optimization/105646 - re-interpret always executed in uninit diagRichard Biener2-2/+25
The following fixes PR105646, not diagnosing int f1(); int f3(){ auto const & a = f1(); bool v3{v3}; return a; } with optimization because the early uninit diagnostic pass only diagnoses always executed cases. The patch does this by re-interpreting what always executed means and choosing to ignore exceptional and abnormal control flow for this. At the same time it improves things as suggested in a comment - when the value-numbering run done without optimizing figures there's a fallthru path, consider blocks on it as always executed. PR tree-optimization/105646 * tree-ssa-uninit.cc (warn_uninitialized_vars): Pre-compute the set of fallthru reachable blocks from function entry and use that to determine wlims.always_executed. * g++.dg/uninit-pr105646.C: New testcase.
2022-09-29Check nonlinear iv in vect_can_advance_ivs_p.liuhongt4-35/+64
vectorizable_nonlinear_induction doesn't always guard vect_peel_nonlinear_iv_init when it's called by vect_update_ivs_after_vectorizer. It's supposed to be guarded by vect_can_advance_ivs_p. gcc/ChangeLog: PR tree-optimization/107055 * tree-vect-loop-manip.cc (vect_can_advance_ivs_p): Check for nonlinear induction variables. * tree-vect-loop.cc (vect_can_peel_nonlinear_iv_p): New functions. (vectorizable_nonlinear_induction): Put part codes into vect_can_peel_nonlinear_iv_p. * tree-vectorizer.h (vect_can_peel_nonlinear_iv_p): Declare. gcc/testsuite/ChangeLog: * gcc.target/i386/pr107055.c: New test.
2022-09-29Daily bump.GCC Administrator8-1/+254
2022-09-29libstdc++: Disable volatile-qualified std::bind for C++20Jonathan Wakely13-33/+87
LWG 2487 added a precondition to std::bind for C++17, making volatile-qualified uses undefined. We still support it, but with a deprecated warning. P1065R2 made it explicitly ill-formed for C++20, so we should no longer accept it as deprecated. This implements that change. libstdc++-v3/ChangeLog: * doc/xml/manual/evolution.xml: Document std::bind API changes. * doc/xml/manual/intro.xml: Document LWG 2487 status. * doc/xml/manual/using.xml: Clarify default value of _GLIBCXX_USE_DEPRECATED. * doc/html/*: Regenerate. * include/std/functional (_Bind::operator()(Args&&...) volatile) (_Bind::operator()(Args&&...) const volatile) (_Bind_result::operator()(Args&&...) volatile) (_Bind_result::operator()(Args&&...) const volatile): Replace with deleted overload for C++20 and later. * testsuite/20_util/bind/cv_quals.cc: Check for deprecated warnings in C++17. * testsuite/20_util/bind/cv_quals_2.cc: Likewise, and check for ill-formed in C++20.
2022-09-29libstdc++: Make INVOKE<R> refuse to create dangling references [PR70692]Jonathan Wakely7-28/+80
This is the next part of the library changes from P2255R2. This makes INVOKE<R> ill-formed if converting the INVOKE expression to R would bind a reference to a temporary object. The is_invocable_r trait is now false if the invocation would create a dangling reference. This is done by adding the dangling check to the __is_invocable_impl partial specialization used for INVOKE<R> expressions. This change also slightly simplifies the nothrow checking recently added to that partial specialization. This change also removes the is_invocable_r checks from the pre-C++17 implementation of std::__invoke_r, because there is no need for it to be SFINAE-friendly. None of our C++11 and C++14 uses of INVOKE<R> require those constraints. The std::function constructor needs to check is_invocable_r, but that's already done explicitly, so we don't need to recheck when calling __is_invoke_r in std::function::operator(). The other uses of std::__is_invoke_r do not need to be constrained and can just be ill-formed if the INVOKE<R> expression is ill-formed. libstdc++-v3/ChangeLog: PR libstdc++/70692 * include/bits/invoke.h [__cplusplus < 201703] (__invoke_r): Remove is_invocable and is_convertible constraints. * include/std/type_traits (__is_invocable_impl::_S_conv): Use non-deduced context for parameter. (__is_invocable_impl::_S_test): Remove _Check_noex template parameter and use deduced noexcept value in its place. Add bool parameter to detect dangling references. (__is_invocable_impl::type): Adjust call to _S_test to avoid deducing unnecessary noexcept property.. (__is_invocable_impl::__nothrow_type): Rename to ... (__is_invocable_impl::__nothrow_conv): ... this. Adjust call to _S_test to deduce noexcept property. * testsuite/20_util/bind/dangling_ref.cc: New test. * testsuite/20_util/function/cons/70692.cc: New test. * testsuite/20_util/function_objects/invoke/dangling_ref.cc: New test. * testsuite/20_util/is_invocable/dangling_ref.cc: New test. * testsuite/30_threads/packaged_task/cons/dangling_ref.cc: New test.
2022-09-28Add instruction level discriminator support.Eugene Rozenfeld21-55/+187
This is the first in a series of patches to enable discriminator support in AutoFDO. This patch switches to tracking discriminators per statement/instruction instead of per basic block. Tracking per basic block was problematic since not all statements in a basic block needed a discriminator and, also, later optimizations could move statements between basic blocks making correlation during AutoFDO compilation unreliable. Tracking per statement also allows us to assign different discriminators to multiple function calls in the same basic block. A subsequent patch will add that support. The idea of this patch is based on commit 4c311d95cf6d9519c3c20f641cc77af7df491fdf by Dehao Chen in vendors/google/heads/gcc-4_8 but uses a slightly different approach. In Dehao's work special (normally unused) location ids and side tables were used to keep track of locations with discriminators. Things have changed since then and I don't think we have unused location ids anymore. Instead, I made discriminators a part of ad-hoc locations. The difference from Dehao's work also includes support for discriminator reading/writing in lto streaming and in modules. Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: * basic-block.h: Remove discriminator from basic blocks. * cfghooks.cc (split_block_1): Remove discriminator from basic blocks. * final.cc (final_start_function_1): Switch from per-bb to per statement discriminator. (final_scan_insn_1): Don't keep track of basic block discriminators. (compute_discriminator): Switch from basic block discriminators to instruction discriminators. (insn_discriminator): New function to return instruction discriminator. (notice_source_line): Use insn_discriminator. * gimple-pretty-print.cc (dump_gimple_bb_header): Remove dumping of basic block discriminators. * gimple-streamer-in.cc (input_bb): Remove reading of basic block discriminators. * gimple-streamer-out.cc (output_bb): Remove writing of basic block discriminators. * input.cc (make_location): Pass 0 discriminator to COMBINE_LOCATION_DATA. (location_with_discriminator): New function to combine locus with a discriminator. (has_discriminator): New function to check if a location has a discriminator. (get_discriminator_from_loc): New function to get the discriminator from a location. * input.h: Declarations of new functions. * lto-streamer-in.cc (cmp_loc): Use discriminators in location comparison. (apply_location_cache): Keep track of current discriminator. (input_location_and_block): Read discriminator from stream. * lto-streamer-out.cc (clear_line_info): Set current discriminator to UINT_MAX. (lto_output_location_1): Write discriminator to stream. * lto-streamer.h: Add discriminator to cached_location. Add current_discr to lto_location_cache. Add current_discr to output_block. * print-rtl.cc (print_rtx_operand_code_i): Print discriminator. * rtl.h: Add extern declaration of insn_discriminator. * tree-cfg.cc (assign_discriminator): New function to assign a unique discriminator value to all statements in a basic block that have the given line number. (assign_discriminators): Assign discriminators to statement locations. * tree-pretty-print.cc (dump_location): Dump discriminators. * tree.cc (set_block): Preserve discriminator when setting block. (set_source_range): Preserve discriminator when setting source range. gcc/cp/ChangeLog: * module.cc (write_location): Write discriminator. (read_location): Read discriminator. libcpp/ChangeLog: * include/line-map.h: Add discriminator to location_adhoc_data. (get_combined_adhoc_loc): Add discriminator parameter. (get_discriminator_from_adhoc_loc): Add external declaration. (get_discriminator_from_loc): Add external declaration. (COMBINE_LOCATION_DATA): Add discriminator parameter. * lex.cc (get_location_for_byte_range_in_cur_line) Pass 0 discriminator in a call to COMBINE_LOCATION_DATA. (warn_about_normalization): Pass 0 discriminator in a call to COMBINE_LOCATION_DATA. (_cpp_lex_direct): Pass 0 discriminator in a call to COMBINE_LOCATION_DATA. * line-map.cc (location_adhoc_data_hash): Use discriminator compute location_adhoc_data hash. (location_adhoc_data_eq): Use discriminator when comparing location_adhoc_data. (can_be_stored_compactly_p): Check discriminator to determine compact storage. (get_combined_adhoc_loc): Add discriminator parameter. (get_discriminator_from_adhoc_loc): New function to get the discriminator from an ad-hoc location. (get_discriminator_from_loc): New function to get the discriminator from a location. gcc/testsuite/ChangeLog: * c-c++-common/ubsan/pr85213.c: Pass -gno-statement-frontiers.
2022-09-28c++: Add DECL_NTTP_OBJECT_P lang flagNathan Sidwell5-22/+26
VAR_DECLs for NTTPs need to be handled specially by module streaming, in the same manner to type info decls. This reworks their handling to allow that work to drop in. We use DECL_LANG_FLAG_5 to indicate such decls (I didn't notice template_parm_object_p, which looks at the mangled name -- anyway a bit flag on the node is better, IMHO). We break apart the creation routine, so there's now an entry point the module machinery can use directly. gcc/cp/ * cp-tree.h (DECL_NTTP_OBJECT_P): New. (template_parm_object_p): Delete. (build_template_parm_object): Declare. * cxx-pretty-print.cc (pp_cx_template_argument_list): Use DECL_NTTP_OBJECT_P. * error.cc (dump_simple_decl): Likewise. * mangle.cc (write_template_arg): Likewise. * pt.cc (template_parm_object_p): Delete. (create_template_parm_object): Separated out checking from ... (get_template_parm_object): ... this, new external entry point.
2022-09-28i386: Mark XMM4-XMM6 as clobbered by encodekey128/encodekey256H.J. Lu4-14/+12
encodekey128 and encodekey256 operations clear XMM4-XMM6. But it is documented that XMM4-XMM6 are reserved for future usages and software should not rely upon them being zeroed. Change encodekey128 and encodekey256 to clobber XMM4-XMM6. gcc/ PR target/107061 * config/i386/predicates.md (encodekey128_operation): Check XMM4-XMM6 as clobbered. (encodekey256_operation): Likewise. * config/i386/sse.md (encodekey128u32): Clobber XMM4-XMM6. (encodekey256u32): Likewise. gcc/testsuite/ PR target/107061 * gcc.target/i386/keylocker-encodekey128.c: Don't check XMM4-XMM6. * gcc.target/i386/keylocker-encodekey256.c: Likewise.
2022-09-29RISC-V: Add ABI-defined RVV types.Ju-Zhe Zhong17-1/+1317
gcc/ChangeLog: * config.gcc: Add riscv-vector-builtins.o. * config/riscv/riscv-builtins.cc (riscv_init_builtins): Add RVV builtin function. * config/riscv/riscv-protos.h (riscv_v_ext_enabled_vector_mode_p): New function. * config/riscv/riscv.cc (ENTRY): New macro. (riscv_v_ext_enabled_vector_mode_p): New function. (riscv_mangle_type): Add RVV mangle. (riscv_vector_mode_supported_p): Adjust RVV machine mode. (riscv_verify_type_context): Add context check for RVV. (riscv_vector_alignment): Add RVV alignment target hook support. (TARGET_VECTOR_MODE_SUPPORTED_P): New target hook support. (TARGET_VERIFY_TYPE_CONTEXT): Ditto. (TARGET_VECTOR_ALIGNMENT): Ditto. * config/riscv/t-riscv: Add riscv-vector-builtins.o * config/riscv/riscv-vector-builtins.cc: New file. * config/riscv/riscv-vector-builtins.def: New file. * config/riscv/riscv-vector-builtins.h: New file. * config/riscv/riscv-vector-switch.def: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/abi-1.c: New test. * gcc.target/riscv/rvv/base/abi-2.c: New test. * gcc.target/riscv/rvv/base/abi-3.c: New test. * gcc.target/riscv/rvv/base/abi-4.c: New test. * gcc.target/riscv/rvv/base/abi-5.c: New test. * gcc.target/riscv/rvv/base/abi-6.c: New test. * gcc.target/riscv/rvv/base/abi-7.c: New test. * gcc.target/riscv/rvv/rvv.exp: New test.
2022-09-28var-tracking: Add entry values up to max register modeStefan Schulze Frielinghaus1-0/+17
For parameter of type integer which do not consume a whole register (modulo sign/zero extension) this patch adds entry values up to maximal register mode. gcc/ChangeLog: * var-tracking.cc (vt_add_function_parameter): Add entry values up to maximal register mode.
2022-09-28cselib: Keep track of further subvalue relationsStefan Schulze Frielinghaus1-0/+20
Whenever a new cselib value is created check whether a smaller value exists which is contained in the bigger one. If so add a subreg relation to locs of the smaller one. gcc/ChangeLog: * cselib.cc (new_cselib_val): Keep track of further subvalue relations.
2022-09-28arm: Define __ARM_FEATURE_AES and __ARM_FEATURE_SHA2 when march +crypto is ↵Andrea Corallo2-0/+10
selected Hi all, this patch fixes the missing definition of __ARM_FEATURE_AES and __ARM_FEATURE_SHA2 when AES SHA1 & SHA2 crypto instructions are available [1] (read when march +crypto is selected). Okay for master? Thanks Andrea [1] <https://raw.githubusercontent.com/ARM-software/acle/main/main/acle.md> gcc/ChangeLog 2022-09-14 Andrea Corallo <andrea.corallo@arm.com> * config/arm/arm-c.cc (arm_cpu_builtins): Define __ARM_FEATURE_AES and __ARM_FEATURE_SHA2. gcc/testsuite/ChangeLog 2022-09-14 Andrea Corallo <andrea.corallo@arm.com> * gcc.target/arm/attr-crypto.c: Update test.
2022-09-28Bugfix for gcc/doc/gm2.texi add Linking section to the Using node.Gaius Mulley1-0/+1
Add a Linking section to the Using menu node. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2022-09-28Remove unnecessary directoriesGaius Mulley45-6058/+0
More tidying up, removal of the script to generate the webpages and removal of a modern modula-2 emacs mode. gcc/m2/Changelog: * www: Removed. * el: Removed. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2022-09-28LoongArch: Use UNSPEC for fmin/fmax RTL pattern [PR105414]Xi Ruoyao1-4/+8
I made a mistake defining fmin/fmax RTL patterns in r13-2085: I used smin and smax in the definition mistakenly. This causes the optimizer to perform constant folding as if fmin/fmax was "really" smin/smax operations even with -fsignaling-nans. Then pr105414.c fails. We don't have fmin/fmax RTL codes for now (PR107013) so we can only use an UNSPEC for fmin and fmax patterns. gcc/ChangeLog: PR tree-optimization/105414 * config/loongarch/loongarch.md (UNSPEC_FMAX): New unspec. (UNSPEC_FMIN): Likewise. (fmax<mode>3): Use UNSPEC_FMAX instead of smax. (fmin<mode>3): Use UNSPEC_FMIN instead of smin.
2022-09-28testsuite: Skip intrinsics test if armTorbjörn SVENSSON6-6/+6
In the test cases, it's clearly written that intrinsics are not implemented on arm*. A simple xfail does not help since there are link error and that would cause an UNRESOLVED testcase rather than XFAIL. By changing to dg-skip-if, the entire test case is omitted. gcc/testsuite/ChangeLog: * gcc.target/aarch64/advsimd-intrinsics/vld1x2.c: Rephrase to unimplemented. * gcc.target/aarch64/advsimd-intrinsics/vld1x3.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vld1x4.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vst1x2.c: Replace dg-xfail-if with dg-skip-if. * gcc.target/aarch64/advsimd-intrinsics/vst1x3.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vst1x4.c: Likewise. Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-09-28LoongArch: Fixed a typo in the comment information of the function ↵Lulu Cheng1-1/+1
loongarch_asan_shadow_offset. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_asan_shadow_offset): Fixed typo in "asan_mapping.h".
2022-09-28libgomp.texi: Status 'P' for 'assume', remove duplicated lineTobias Burnus1-2/+1
libgomp/ * libgomp.texi (OpenMP 5.1): Mark 'assume' as implemented for C/C++. Remove duplicated 'begin declare target' entry.
2022-09-28LoongArch: Libitm add LoongArch support.Lulu Cheng4-0/+233
Co-Authored-By: Yang Yujie <yangyujie@loongson.cn> libitm/ChangeLog: * configure.tgt: Add loongarch support. * config/loongarch/asm.h: New file. * config/loongarch/sjlj.S: New file. * config/loongarch/target.h: New file.
2022-09-27stack-protector: Check stack canary before throwing exceptionH.J. Lu3-2/+16
Check stack canary before throwing exception to avoid stack corruption. gcc/ PR middle-end/58245 * calls.cc: Include "tree-eh.h". (expand_call): Check stack canary before throwing exception. gcc/testsuite/ PR middle-end/58245 * g++.dg/fstack-protector-strong.C: Adjusted. * g++.dg/pr58245-1.C: New test.
2022-09-27Fix AutoFDO tests to not look for hot/cold splitting.Eugene Rozenfeld4-8/+8
AutoFDO counts are not reliable and we are currently not performing hot/cold splitting based on them. This change adjusts several tree-prof tests not to check for hot/cold splitting when run with AutoFDO. gcc/testsuite/ChangeLog: * gcc.dg/tree-prof/cold_partition_label.c: Don't check for hot/cold splitting with AutoFDO. * gcc.dg/tree-prof/section-attr-1.c: Don't check for hot/cold splitting with AutoFDO. * gcc.dg/tree-prof/section-attr-2.c: Don't check for hot/cold splitting with AutoFDO. * gcc.dg/tree-prof/section-attr-3.c: Don't check for hot/cold splitting with AutoFDO.
2022-09-28Daily bump.GCC Administrator14-1/+470
2022-09-27Fix profile count comparison.Eugene Rozenfeld1-2/+2
The comparison was incorrect when the counts weren't PRECISE. For example, crossmodule-indir-call-topn-1.c was failing with AutoFDO: when count_sum is 0 with quality AFDO, count_sum > profile_count::zero() evaluates to true. Taking that branch then leads to an assert in the call to to_sreal(). Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: * ipa-cp.cc (good_cloning_opportunity_p): Fix profile count comparison.
2022-09-27c++: Implement C++23 P2266R1, Simpler implicit move [PR101165]Marek Polacek28-36/+620
This patch implements https://wg21.link/p2266, which, once again, changes the implicit move rules. Here's a brief summary of various changes in this area: r125211: Introduced moving from certain lvalues when returning them r171071: CWG 1148, enable move from value parameter on return r212099: CWG 1579, it's OK to call a converting ctor taking an rvalue r251035: CWG 1579, do maybe-rvalue overload resolution twice r11-2411: Avoid calling const copy ctor on implicit move r11-2412: C++20 implicit move changes, remove the fallback overload resolution, allow move on throw of parameters and implicit move of rvalue references P2266 enables the implicit move even for functions that return references. That is, we will now perform a move in X&& foo (X&& x) { return x; } P2266 also removes the fallback overload resolution, but this was resolved by r11-2412: we only do convert_for_initialization with LOOKUP_PREFER_RVALUE in C++17 and older. P2266 also says that a returned move-eligible id-expression is always an xvalue. This required some further short, but nontrivial changes, especially when it comes to deduction, because we have to pay attention to whether we have auto, auto&& (which is like T&&), or decltype(auto) with (un)parenthesized argument. In C++23, decltype(auto) f(int&& x) { return (x); } auto&& f(int x) { return x; } both should deduce to 'int&&' but decltype(auto) f(int x) { return x; } should deduce to 'int'. A cornucopia of tests attached. I've also verified that we behave like clang++. xvalue_p seemed to be broken: since the introduction of clk_implicit_rval, it cannot use '==' when checking for clk_rvalueref. Since this change breaks code, it's only enabled in C++23. In particular, this code will not compile in C++23: int& g(int&& x) { return x; } because x is now treated as an rvalue, and you can't bind a non-const lvalue reference to an rvalue. This patch also fixes PR106882 (the check_return_expr changes). PR c++/101165 PR c++/106882 gcc/c-family/ChangeLog: * c-cppbuiltin.cc (c_cpp_builtins): Define __cpp_implicit_move. gcc/cp/ChangeLog: * call.cc (reference_binding): Check clk_implicit_rval in C++20 only. * cp-tree.h (unparenthesized_id_or_class_member_access_p): Declare. * pt.cc (unparenthesized_id_or_class_member_access_p): New function, broken out of... (do_auto_deduction): ...here. Use it. In C++23, maybe call treat_lvalue_as_rvalue_p. * tree.cc (xvalue_p): Check & clk_rvalueref, not == clk_rvalueref. * typeck.cc (check_return_expr): Allow implicit move for functions returning a reference as well, or when the return value type is not a scalar type. gcc/testsuite/ChangeLog: * g++.dg/conversion/pr41426.C: Add dg-error for C++23. * g++.dg/cpp0x/elision_weak.C: Likewise. * g++.dg/cpp0x/move-return3.C: Only link in c++20_down. * g++.dg/cpp1y/decltype-auto2.C: Add dg-error for C++23. * g++.dg/cpp1y/lambda-generic-89419.C: Likewise. * g++.dg/cpp23/feat-cxx2b.C: Test __cpp_implicit_move. * g++.dg/gomp/pr56217.C: Only compile in c++20_down. * g++.dg/warn/Wno-return-local-addr.C: Add dg-error for C++23. * g++.dg/warn/Wreturn-local-addr.C: Adjust dg-error. * g++.old-deja/g++.brendan/crash55.C: Add dg-error for C++23. * g++.old-deja/g++.jason/temporary2.C: Likewise. * g++.old-deja/g++.mike/p2846b.C: Adjust. * g++.dg/cpp1y/decltype-auto6.C: New test. * g++.dg/cpp23/decltype1.C: New test. * g++.dg/cpp23/decltype2.C: New test. * g++.dg/cpp23/elision1.C: New test. * g++.dg/cpp23/elision2.C: New test. * g++.dg/cpp23/elision3.C: New test. * g++.dg/cpp23/elision4.C: New test. * g++.dg/cpp23/elision5.C: New test. * g++.dg/cpp23/elision6.C: New test. * g++.dg/cpp23/elision7.C: New test.
2022-09-27Fortran: error recovery while simplifying intrinsic UNPACK [PR107054]Harald Anlauf2-3/+23
gcc/fortran/ChangeLog: PR fortran/107054 * simplify.cc (gfc_simplify_unpack): Replace assert by condition that terminates simplification when there are not enough elements in the constructor of argument VECTOR. gcc/testsuite/ChangeLog: PR fortran/107054 * gfortran.dg/pr107054.f90: New test.
2022-09-27runtime: portable access to sigev_notify_thread_idIan Lance Taylor3-2/+30
Previously, libgo relied on the _sigev_un implementation-specific field in struct sigevent, which is only available on glibc. This patch uses the sigev_notify_thread_id macro instead which is mandated by timer_create(2). In theory, this should work with any libc implementation for Linux. Unfortunately, there is an open glibc bug as glibc does not define this macro. For this reason, a glibc-specific workaround is required. Other libcs (such as musl) define the macro and don't require the workaround. See https://sourceware.org/bugzilla/show_bug.cgi?id=27417 This makes libgo compatible with musl libc. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/434755
2022-09-27runtime: synchronize empty struct field handlingmelonedo2-5/+11
In GCCGO and gollvm, the logic for allocating one byte for the last field is: 1. the last field has zero size 2. the struct itself does not have zero size 3. the last field is not blank this commit adds the last two conditions to runtime.structToFFI. For golang/go#55146 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/431735
2022-09-27docs: update abi version infoKim Kuparinen1-2/+9
gcc/ * doc/invoke.texi: Update ABI version info.
2022-09-27range-ops: Calculate the popcount of a singleton.Aldy Hernandez2-0/+14
The legacy popcount folding didn't actually fold singleton ranges. I don't think anyone noticed because there are match.pd patterns that fold __builtin_popcount using the global nonzero bits set by CCP. It's good form to handle this, even without CCP's help. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range-op.cc (cfn_popcount): Calculate the popcount of a singleton. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/popcount6b.c: New test.
2022-09-27c++: Don't quote nothrow in diagnosticMarek Polacek3-13/+12
In <https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602057.html> Jason noticed that we quote "nothrow" in diagnostics even though it's not a keyword in C++. This patch removes the quotes and also drops "nothrow" from c_keywords. gcc/c-family/ChangeLog: * c-format.cc (c_keywords): Drop nothrow. gcc/cp/ChangeLog: * constraint.cc (diagnose_trait_expr): Say "nothrow" without quotes rather than in quotes. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-traits3.C: Adjust expected diagnostics.
2022-09-27c++: Make __is_{,nothrow_}convertible SFINAE on access [PR107049]Jonathan Wakely4-0/+85
The is_convertible built-ins should return false if the conversion fails an access check, not report an error. PR c++/107049 gcc/cp/ChangeLog: * method.cc (is_convertible_helper): Use access check sentinel. gcc/testsuite/ChangeLog: * g++.dg/ext/is_convertible4.C: New test. * g++.dg/ext/is_nothrow_convertible4.C: New test. libstdc++-v3/ChangeLog: * testsuite/20_util/is_convertible/requirements/access.cc: New test.
2022-09-27libstdc++: Adjust deduction guides for static operator() [PR106651]Jonathan Wakely4-5/+70
Adjust the deduction guides for std::function and std::packaged_task to work with static call operators. This finishes the implementation of P1169R4 for C++23. libstdc++-v3/ChangeLog: PR c++/106651 * include/bits/std_function.h (__function_guide_t): New alias template. [__cpp_static_call_operator] (__function_guide_static_helper): New class template. (function): Use __function_guide_t in deduction guide. * include/std/future (packaged_task): Use __function_guide_t in deduction guide. * testsuite/20_util/function/cons/deduction_c++23.cc: New test. * testsuite/30_threads/packaged_task/cons/deduction_c++23.cc: New test.
2022-09-27fixincludes: FIx up for Debian/Ubuntu includesJakub Jelinek2-8/+8
As reported by Tobias, my C++ _Float{16,32,64,128,32x,64x,128x} support patch broke Debian/Ubuntu bootstraps. The problem is that there glibc bits/floatn.h and bits/floatn-common.h isn't in /usr/include/ directly, but in a subdirectory like /usr/include/x86_64-linux-gnu/ Seems other fixinclude rules for bits/* headers use files = bits/whatever.h, "*/bits/whatever.h"; so this patch just follows the suit. 2022-06-27 Jakub Jelinek <jakub@redhat.com> * inclhack.def (glibc_cxx_floatn_1, glibc_cxx_floatn_2, glibc_cxx_floatn_3): Add to files also "*/bits/floatn.h" and "*/bits/floatn-common.h". * fixincl.x: Regenerated.
2022-09-27d: Merge upstream dmd d579c467c1, phobos 88aa69b14.Iain Buclaw171-5182/+3160
D front-end changes: - Throwing from contracts of `nothrow' functions has been deprecated, as this breaks the guarantees of `nothrow'. - Added language support for initializing the interior pointer of associative arrays using `new' keyword. Phobos changes: - The std.digest.digest module has been removed. - The std.xml module has been removed. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd d579c467c1. * decl.cc (layout_struct_initializer): Update for new front-end interface. * expr.cc (ExprVisitor::visit (AssignExp *)): Remove lowering of array assignments. (ExprVisitor::visit (NewExp *)): Add new lowering of new'ing associative arrays to an _aaNew() library call. * runtime.def (ARRAYSETASSIGN): Remove. (AANEW): Define. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime d579c467c1. * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Remove rt/arrayassign.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 88aa69b14. * src/Makefile.am (PHOBOS_DSOURCES): Remove std/digest/digest.d, std/xml.d. * src/Makefile.in: Regenerate.
2022-09-27irange: keep better track of powers of 2.Aldy Hernandez2-0/+25
When setting the nonzero bits to a mask containing only one bit, set the range immediately, as it can be devined from the mask. This helps us keep better track of powers of two. For example, with this patch a nonzero mask of 0x8000 is set to a range of [0,0][0x8000,0x8000] with a nonzero mask of 0x8000. gcc/ChangeLog: * value-range.cc (irange::set_nonzero_bits): Set range when known. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/popcount6.c: New test.