aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2020-12-02compiler: reword "declared and not used" error messageIan Lance Taylor5-18/+8
This is a gofrontend copy of https://golang.org/cl/203282. From the CL 203282 description: "declared and not used" is technically correct, but might confuse the user. Switching "and" to "but" will hopefully create the contrast for the users: they did one thing (declaration), but not the other --- actually using the variable. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273629
2020-12-02compiler: improve mixed named/unnamed parameter error messageIan Lance Taylor3-5/+5
Use the same error as the current gc compiler. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273628
2020-12-02compiler: don't advance past unexpected semicolonIan Lance Taylor2-2/+1
We've already read the unexpected semicolon, so advancing again causes us to skip the next token, causing future errors to be out of sync. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274439
2020-12-02Upgrade ACATS testsuite to latest ACATS 2.6Eric Botcazou30-484/+3475
This upgrades the ACATS tesuite present in ada/acats from 2.5 to latest 2.6, removing 3 tests and adding 11 tests, some of them written very recently. gcc/testsuite/ChangeLog: * ada/acats/support/acats25.lst: Delete. * ada/acats/support/acats26.lst: New file. * ada/acats/support/fcndecl.ada: Minor tweak. * ada/acats/support/impdef.a: Add commentary. * ada/acats/support/impdefg.a (Negative_Zero return): Simplify. * ada/acats/support/macro.dfs (TASK_STORAGE_SIZE): Bump. * ada/acats/support/repbody.ada: Upgrade to ACATS 2.6. * ada/acats/support/tctouch.ada: Likewise. * ada/acats/tests/c3/c352001.a: New file. * ada/acats/tests/c4/c433001.a: Correct error messages. * ada/acats/tests/c4/c453001.a: New file. * ada/acats/tests/c4/c45622a.ada: Delete. * ada/acats/tests/c4/c45624a.ada: Likewise. * ada/acats/tests/c4/c45624b.ada: Likewise. * ada/acats/tests/c4/c460013.a: New file. * ada/acats/tests/c4/c460014.a: Likewise. * ada/acats/tests/c6/c620001.a: Likewise. * ada/acats/tests/c6/c620002.a: Likewise. * ada/acats/tests/c7/c761006.a: Redo Unchecked_Deallocation case. * ada/acats/tests/c9/c96004a.ada: Adjust for Ada 2005. * ada/acats/tests/c9/c96007a.ada: Likewise. * ada/acats/tests/cb/cb41004.a: Adjust for AI95-0044. * ada/acats/tests/cc/cc3016f.ada: Minor tweak. * ada/acats/tests/cd/cd30011.a: New file. * ada/acats/tests/cd/cd30012.a: Likewise. * ada/acats/tests/cd/cd90001.a: Fix comparison. * ada/acats/tests/cxa/cxa3004.a: New file. * ada/acats/tests/cxa/cxa5013.a: Likewise. * ada/acats/tests/cxa/cxac005.a: Adjust for return-by-reference. * ada/acats/tests/cxb/cxb30061.am: New file. * ada/acats/tests/cxf/cxf2001.a: Fix failure message.
2020-12-02c++: Add lang_decl, type_decl APINathan Sidwell2-7/+8
We need to call the lang_decl and type_decl creators from the module loading machinery. This makes them reachable. gcc/cp/ * cp-tree.h (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Declare. * lex.c (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Externalize, reformat.
2020-12-02c++: Extend build_array_type APINathan Sidwell2-12/+20
The modules machinery needs to construct array types, and that wanted to determine type dependency. That doesn't work during loading, but the module loader can stream that fact too and tell the array builder. Thus this extends the API to allow a caller to specify the dependency explicitly. The call in cp_build_qualified_type_real is unreachable during the loading, so that one's ok as is. gcc/cp/ * cp-tree.h (build_cplus_array_type): Add defaulted DEP parm. * tree.c (set_array_type_common): Add DEP parm. (build_cplus_array_type): Add DEP parm, determine dependency if needed. (cp_build_qualified_type_real): Adjust array-building call. (strip_typedefs): Likewise.
2020-12-02c++: Fix bootstrapNathan Sidwell1-3/+3
I made the prefix for dumping a binding-vector slightly too small. Fixed thusly. gcc/cp/ * ptree.c (cxx_print_xnode): Increase binding-vector prefix size.
2020-12-02tree-optimization/97630 - fix SLP cycle memory leakRichard Biener3-10/+39
This fixes SLP cycles leaking memory by maintaining a double-linked list of allocatd SLP nodes we can zap when we free the alloc pool. 2020-12-02 Richard Biener <rguenther@suse.de> PR tree-optimization/97630 * tree-vectorizer.h (_slp_tree::next_node, _slp_tree::prev_node): New. (vect_slp_init): Declare. (vect_slp_fini): Likewise. * tree-vectorizer.c (vectorize_loops): Call vect_slp_init/fini. (pass_slp_vectorize::execute): Likewise. * tree-vect-slp.c (vect_slp_init): New. (vect_slp_fini): Likewise. (slp_first_node): New global. (_slp_tree::_slp_tree): Link node into the SLP tree list. (_slp_tree::~_slp_tree): Delink node from the SLP tree list.
2020-12-02vec.h: Fix GCC build with -std=gnu++20 [PR98059]Scott Snyder1-1/+1
Apparently vec.h doesn't build with -std=c++20/gnu++20, since the DR2237 r11-532 change. template <typename T> class auto_delete_vec { private: auto_vec_delete<T> (const auto_delete_vec<T> &) = delete; }; which vec.h uses is invalid C++20, one needs to use auto_vec_delete (const auto_delete_vec &) = delete; instead which is valid all the way back to C++11 (and without = delete to C++98). 2020-12-02 Scott Snyder <sss@li-snyder.org> PR plugins/98059 * vec.h (auto_delete_vec): Use DISABLE_COPY_AND_ASSIGN(auto_delete_vec) instead of DISABLE_COPY_AND_ASSIGN(auto_delete_vec<T>) to make it valid C++20 after DR2237.
2020-12-02C++ Module Binding VectorNathan Sidwell6-2/+185
This adds the vector necessary to hold different module's namespace bindings. We add a new tree-node 'tree_binding_vec', which contains a sparse array, indexed by module number. To avoid space wasting, this is allocated in clusters using 'unsigned short' as the index value (so that's one of the upper bounds on module importing). If there are only bindings from the current TU, there is no vector, so we have the same representation as a non-module compilation. To support lazy loading, a binding slot can contain either a tree (the binding), or a cookie that the module machinery uses to load the required binding on demand. The first 2 or 3 slots end up being reserved for fixed meanings. There are a couple of flags we have to record on a binding, to know whether the same declaration could appear in two different slots. gcc/cp/ * cp-tree.def (BINDING_VECTOR): New. * name-lookup.h (struct binding_slot): New. (BINDING_VECTOR_SLOTS_PER_CLUSTER): New. (struct binding_index, struct binding_cluster): New. (BINDING_VECTOR_ALLOC_CLUSTERS, BINDING_VECTOR_CLUSTER_BASE) (BINDING_VECTOR_CLUSTER): New. (struct tree_binding_vec): New. (BINDING_VECTOR_NAME, BINDING_VECTOR_GLOBAL_DUPS_P) (BINDING_VECTOR_PARTITION_DUPS_P): New. (BINDING_BINDING_GLOBAL_P, BINDING_BINDING_PARTITION_P): New. (BINDING_VECTOR_PENDING_SPECIALIZATIONS) (BINDING_VECTOR_PENDING_IS_HEADER_P) (BINDING_VECTOR_PENDING_IS_PARTITION_P): New. * cp-tree.h (enum cp_tree_node_structure_enum): Add TS_CP_BINDING_VECTOR. (union lang_tree_node): Add binding_vec field. (make_binding_vec): Declare. (named_decl_hash::hash, named_decl_hash::equal): Check for binding vector. * decl.c (cp_tree_node_structure): Add BINDING_VECTOR case. * ptree.c (cxx_print_xnode): Add BINDING_VECTOR case. * tree.c (make_binding_vec): New.
2020-12-02ipa: do not DECL_IS_MALLOC for void fnsMartin Liska3-1/+34
gcc/ChangeLog: PR ipa/98075 * cgraph.c (cgraph_node::dump): Dump decl_is_malloc flag. * ipa-pure-const.c (propagate_malloc): Do not set malloc attribute for void functions. gcc/testsuite/ChangeLog: PR ipa/98075 * g++.dg/ipa/pr98075.C: New test.
2020-12-02Use the section flag 'o' for __patchable_function_entriesH.J. Lu10-2/+180
This commit in GNU binutils 2.35: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=b7d072167715829eed0622616f6ae0182900de3e added the section flag 'o' to .section directive: .section __patchable_function_entries,"awo",@progbits,foo which specifies the symbol name which the section references. Assembler creates a unique __patchable_function_entries section with the section, where foo is defined, as its linked-to section. Linker keeps a section if its linked-to section is kept during garbage collection. This patch checks assembler support for the section flag 'o' and uses it to implement __patchable_function_entries section. Since Solaris may use GNU assembler with Solairs ld. Even if GNU assembler supports the section flag 'o', it doesn't mean that Solairs ld supports it. This feature is disabled for Solairs targets. gcc/ PR middle-end/93195 PR middle-end/93197 * configure.ac (HAVE_GAS_SECTION_LINK_ORDER): New. Define 1 if the assembler supports the section flag 'o' for specifying section with link-order. * output.h (SECTION_LINK_ORDER): New. Defined to 0x8000000. (SECTION_MACH_DEP): Changed from 0x8000000 to 0x10000000. * targhooks.c (default_print_patchable_function_entry): Pass SECTION_LINK_ORDER to switch_to_section if the section flag 'o' works. Pass current_function_decl to switch_to_section. * varasm.c (default_elf_asm_named_section): Use 'o' flag for SECTION_LINK_ORDER if assembler supports it. * config.in: Regenerated. * configure: Likewise. * doc/sourcebuild.texi: Document o_flag_in_section. gcc/testsuite/ PR middle-end/93195 * g++.dg/pr93195a.C: New test. * g++.dg/pr93195b.C: Likewise. * lib/target-supports.exp (check_effective_target_o_flag_in_section): New proc.
2020-12-02x86: Add the missing '.' for -mneededH.J. Lu1-1/+1
* config/i386/i386.opt: Add the missing '.' for -mneeded.
2020-12-02Add new test-case.Martin Liska1-0/+21
gcc/testsuite/ChangeLog: PR tree-optimization/98084 * gcc.dg/tree-ssa/pr98094.c: New test.
2020-12-02guard maybe_set_vectorized_backedge_value callsRichard Biener1-11/+13
This makes sure to not call maybe_set_vectorized_backedge_value when we did not vectorize the latch def candidate. 2020-12-02 Richard Biener <rguenther@suse.de> * tree-vect-loop.c (vect_transform_loop_stmt): Return whether we vectorized a stmt. (vect_transform_loop): Only call maybe_set_vectorized_backedge_value when we vectorized the stmt.
2020-12-02expansion: Fix up infinite recursion due to double-word modulo optimizationJakub Jelinek5-38/+53
Jeff has reported that my earlier patch broke rl78-elf, e.g. with unsigned short foo (unsigned short x) { return x % 7; } when compiled with -O2 -mg14. The problem is that rl78 is a BITS_PER_WORD == 8 target which doesn't have 8-bit modulo or divmod optab, but has instead 16-bit divmod, so my patch attempted to optimize it, then called expand_divmod to do 8-bit modulo and that in turn tried to do 16-bit modulo again. The following patch fixes it in two ways. One is to not perform the optimization when we have {u,s}divmod_optab handler for the double-word mode, in that case it is IMHO better to just do whatever we used to do before. This alone should fix the infinite recursion. But I'd be afraid some other target might have similar problem and might not have a divmod pattern, but only say a library call. So the patch also introduces a methods argument to expand_divmod such that normally we allow everything that was allowed before (using libcalls and widening), but when called from these expand_doubleword*mod routines we restrict it to no widening and no libcalls. 2020-12-02 Jakub Jelinek <jakub@redhat.com> * expmed.h (expand_divmod): Only declare if GCC_OPTABS_H is defined. Add enum optabs_method argument defaulted to OPTAB_LIB_WIDEN. * expmed.c: Include expmed.h after optabs.h. (expand_divmod): Add methods argument, if it is not OPTAB_{,LIB_}WIDEN, don't choose a wider mode, and pass it to other calls instead of hardcoded OPTAB_LIB_WIDEN. Avoid emitting libcalls if not OPTAB_LIB or OPTAB_LIB_WIDEN. * optabs.c: Include expmed.h after optabs.h. (expand_doubleword_mod, expand_doubleword_divmod): Pass OPTAB_DIRECT as last argument to expand_divmod. (expand_binop): Punt if {s,u}divmod_optab has handler for double-word int_mode. * expr.c: Include expmed.h after optabs.h. * explow.c: Include expmed.h after optabs.h.
2020-12-02expansion: Further improve double-word modulo, division and divmod [PR97459]Jakub Jelinek10-34/+414
The following patch implements what Thomas wrote about, in particular that we can handle also double-word divison by the constants for which the earlier patch optimized modulo (if it would be otherwise a library call) and that we can also easily handle such constants shifted to the left. Unfortunately, seems CSE isn't able to optimize away the two almost identical sequences (one to compute remainder, one to compute quotient), probably because of the ADD_OVERFLOW introduced jumps, so the patch also adjusts expand_DIVMOD. 2020-12-02 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/97459 * optabs.h (expand_doubleword_divmod): Declare. * optabs.c (expand_doubleword_divmod): New function. (expand_binop): Use it. * internal-fn.c (expand_DIVMOD): Likewise. * gcc.target/i386/pr97282.c (foo): Use 123456 divisor instead of 10. * gcc.dg/pr97459-1.c (TESTS): Add tests for 10, 12 and 6144. * gcc.dg/pr97459-2.c (TESTS): Likewise. * gcc.dg/pr97459-3.c: New test. * gcc.dg/pr97459-4.c: New test. * gcc.dg/pr97459-5.c: New test. * gcc.dg/pr97459-6.c: New test.
2020-12-02Fix __builtin_clear_padding for empty struct.Martin Liska2-0/+16
gcc/ChangeLog: PR c/98087 * gimple-fold.c (clear_padding_type): Do not divide by zero. gcc/testsuite/ChangeLog: PR c/98087 * gcc.c-torture/compile/pr98087.c: New test.
2020-12-02GDB hooks: improve documentationMartin Liska1-19/+19
gcc/ChangeLog: * gdbinit.in: Write what each command calls for a debugging function.
2020-12-02rs6000: Disable HTM for Power10 and later by defaultKewen Lin2-6/+9
Power ISA 3.1 has dropped transactional memory support, this patch is to disable HTM feature for power10 and later by default. Bootstrapped/regtested on powerpc64le-linux-gnu P8 and P10. gcc/ChangeLog: * config/rs6000/rs6000.c (rs6000_option_override_internal): Use OPTION_MASK_DIRECT_MOVE for Power8 target_enable instead of OPTION_MASK_HTM. * config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Remove OPTION_MASK_HTM. (RS6000_CPU): Add OPTION_MASK_HTM to power8, power9 and powerpc64le entries.
2020-12-02i386: Fix abs an maxmin expanders for TARGET_PARTIAL_REG_STALL [PR98079].Uros Bizjak2-2/+19
QImode shold be enabled only for !TARGET_PARTIAL_REG_STALL 2020-12-02 Uroš Bizjak <ubizjak@gmail.com> PR target/98079 gcc/ * config/i386/i386.md (abs<mode>2): Enable QImode only for !TARGET_PARTIAL_REG_STALL. (*abs<mode>2_1): Ditto. (<maxmin:code><mode>3): Ditto. (*<maxmin:code><mode>3_1): Ditto. gcc/testsuite/ * gcc.target/i386/pr98079.c: New test.
2020-12-02diagnostics: ignore -fmax-errors for ICEMartin Liska1-1/+1
Right now I see: ./xgcc -B. ~/Programming/testcases/json.i -c -O2 -fmax-errors=1 /home/marxin/Programming/testcases/json.i: In function ‘json_variant_type’: /home/marxin/Programming/testcases/json.i:22:1: error: non-integral type switch statement 22 | } | ^ int * switch (v_2(D)) <default: <L16> [INV], case 0B: <L11> [INV], case 5B: <L12> [INV], case 6B: <L13> [INV], case 7B: <L14> [INV], case 8B: <L15> [INV]> compilation terminated due to -fmax-errors=1. with the patch I get: ./xgcc -B. ~/Programming/testcases/json.i -c -O2 -fmax-errors=1 -c /home/marxin/Programming/testcases/json.i: In function ‘json_variant_type’: /home/marxin/Programming/testcases/json.i:22:1: error: non-integral type switch statement 22 | } | ^ int * switch (v_2(D)) <default: <L16> [INV], case 0B: <L11> [INV], case 5B: <L12> [INV], case 6B: <L13> [INV], case 7B: <L14> [INV], case 8B: <L15> [INV]> during GIMPLE pass: iftoswitch /home/marxin/Programming/testcases/json.i:22:1: internal compiler error: verify_gimple failed 0xe4478c verify_gimple_in_cfg(function*, bool) /home/marxin/Programming/gcc/gcc/tree-cfg.c:5467 0xd201cf execute_function_todo /home/marxin/Programming/gcc/gcc/passes.c:2042 0xd2101c do_per_function /home/marxin/Programming/gcc/gcc/passes.c:1687 0xd2101c execute_todo /home/marxin/Programming/gcc/gcc/passes.c:2096 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. gcc/ChangeLog: * diagnostic.c (diagnostic_report_diagnostic): ICE causes to terminate compiler immediately, so I guess it should be printed always.
2020-12-02if-to-switch: Support chain with 2 BBs.Martin Liska2-2/+15
As seen in the test-case, even 2 BBs can handle interesting cases covered by a jump table or a bit-test. gcc/ChangeLog: PR tree-optimization/88702 * gimple-if-to-switch.cc (pass_if_to_switch::execute): Require at least 2 BBs. * gimple-if-to-switch.cc (find_conditions): Require equal precision for low and high of a range. gcc/testsuite/ChangeLog: PR tree-optimization/88702 * gcc.dg/tree-ssa/if-to-switch-9.c: New test.
2020-12-02if-to-switch: consider only integral typesMartin Liska2-0/+27
gcc/ChangeLog: PR tree-optimization/98084 * gimple-if-to-switch.cc (find_conditions): Consider only integral types. gcc/testsuite/ChangeLog: PR tree-optimization/98084 * gcc.dg/tree-ssa/pr98084.c: New test.
2020-12-01Use add/sub/neg insns to eliminate compare/test insns on H8Jeff Law9-20/+333
gcc/ * config/h8300/addsub.md (addqi3_clobber_flags): Rename to addqi3_flags and annotate with a <cczn> for define_subst. (addhi3_h8sx_clobber_flags): Likewise. (subqi3_clobber_flags, sub<mode>3_clobber_flags): Likewise. (neg<mode2>_clobber_flags): Similarly. (addsi3_clobber_flags): Similarly. Update last argument to output_plussi to distinguish when we need flags or do not need flags. (addhi3_clobber_flags): Similarly. Twiddle code for cases +-1, +-2 and +-4. * config/h8300/h8300.md: Define iterators, mode attributes and substitutions for use in compare/test elimination. * config/h8300/jumpcall.md (branch, branch_1): Use H8cc mode iterator to cover the different modes for the CC register. (branch_1_false): Likewise. gcc/testsuite * gcc.target/h8300/add.c: New test. * gcc.target/h8300/add-2.c: New test. * gcc.target/h8300/add-3.c: New test. * gcc.target/h8300/sub.c: New test. * gcc.target/h8300/sub-2.c: New test. * gcc.target/h8300/sub-3.c: New test.
2020-12-02loop-iv: Fix typo in `iv_analyze_expr' descriptionMaciej W. Rozycki1-1/+1
gcc/ * loop-iv.c: Fix a typo, s/bu/by/, in the `iv_analyze_expr' description in the introduction.
2020-12-01go-test.exp: permit trailing */ on ERROR lineIan Lance Taylor1-1/+1
* go.test/go-test.exp (errchk): Permit trailing */ on ERROR line.
2020-12-01Use SHF_GNU_RETAIN to preserve symbol definitionsH.J. Lu13-4/+205
In assemly code, the section flag 'R' sets the SHF_GNU_RETAIN flag to indicate that the section must be preserved by the linker. Add SECTION_RETAIN to indicate a section should be retained by the linker and set SECTION_RETAIN on section for the preserved symbol if assembler supports SHF_GNU_RETAIN. All retained symbols are placed in separate sections with .section .data.rel.local.preserved_symbol,"awR" preserved_symbol: ... .section .data.rel.local,"aw" not_preserved_symbol: ... to avoid .section .data.rel.local,"awR" preserved_symbol: ... not_preserved_symbol: ... which places not_preserved_symbol definition in the SHF_GNU_RETAIN section. gcc/ 2020-12-01 H.J. Lu <hjl.tools@gmail.com> * configure.ac (HAVE_GAS_SHF_GNU_RETAIN): New. Define 1 if the assembler supports marking sections with SHF_GNU_RETAIN flag. * output.h (SECTION_RETAIN): New. Defined as 0x4000000. (SECTION_MACH_DEP): Changed from 0x4000000 to 0x8000000. (default_unique_section): Add a bool argument. * varasm.c (get_section): Set SECTION_RETAIN for the preserved symbol with HAVE_GAS_SHF_GNU_RETAIN. (resolve_unique_section): Used named section for the preserved symbol if assembler supports SHF_GNU_RETAIN. (get_variable_section): Handle the preserved common symbol with HAVE_GAS_SHF_GNU_RETAIN. (default_elf_asm_named_section): Require the full declaration and use the 'R' flag for SECTION_RETAIN. * config.in: Regenerated. * configure: Likewise. * doc/sourcebuild.texi: Document R_flag_in_section. gcc/testsuite/ 2020-12-01 H.J. Lu <hjl.tools@gmail.com> Jozef Lawrynowicz <jozef.l@mittosystems.com> * c-c++-common/attr-used.c: Check the 'R' flag. * c-c++-common/attr-used-2.c: Likewise. * c-c++-common/attr-used-3.c: New test. * c-c++-common/attr-used-4.c: Likewise. * gcc.c-torture/compile/attr-used-retain-1.c: Likewise. * gcc.c-torture/compile/attr-used-retain-2.c: Likewise. * lib/target-supports.exp (check_effective_target_R_flag_in_section): New proc.
2020-12-01x86: Add -mneeded for GNU_PROPERTY_X86_ISA_1_V[234] markerH.J. Lu10-82/+175
GCC 11 supports -march=x86-64-v[234] to enable x86 micro-architecture ISA levels: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97250 Binutils has been updated to support GNU_PROPERTY_X86_ISA_1_V[234] marker: https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13 with commit b0ab06937385e0ae25cebf1991787d64f439bf12 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Oct 30 06:49:57 2020 -0700 x86: Support GNU_PROPERTY_X86_ISA_1_BASELINE marker and commit 32930e4edbc06bc6f10c435dbcc63131715df678 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Oct 9 05:05:57 2020 -0700 x86: Support GNU_PROPERTY_X86_ISA_1_V[234] marker in x86 ELF binaries. Add -mneeded to emit GNU_PROPERTY_X86_ISA_1_NEEDED property to indicate the micro-architecture ISA level required to execute the binary. gcc/ * config.gcc: Replace cet.o with gnu-property.o. Replace i386/t-cet with i386/t-gnu-property. * config/i386/cet.c: Renamed to ... * config/i386/gnu-property.c: This. (emit_gnu_property): New function. (file_end_indicate_exec_stack_and_cet): Renamed to ... (file_end_indicate_exec_stack_and_gnu_property): This. Call emit_gnu_property to generate GNU_PROPERTY_X86_FEATURE_1_AND and GNU_PROPERTY_X86_ISA_1_NEEDED properties. * config/i386/i386.opt (mneeded): New. * config/i386/linux-common.h (file_end_indicate_exec_stack_and_cet): Renamed to ... (file_end_indicate_exec_stack_and_gnu_property): This. (TARGET_ASM_FILE_END): Updated. * config/i386/t-cet: Renamed to ... * config/i386/t-gnu-property: This. (cet.o): Renamed to ... (gnu-property.o): This. * doc/invoke.texi: Document -mneeded. gcc/testsuite/ * gcc.target/i386/x86-needed-1.c: New test. * gcc.target/i386/x86-needed-2.c: Likewise. * gcc.target/i386/x86-needed-3.c: Likewise.
2020-12-02Daily bump.GCC Administrator5-1/+340
2020-12-01Optimize max/min pattern with comparisonEugene Rozenfeld3-0/+106
gcc/ PR tree-optimization/96708 * match.pd: New pattern for comparing X with MAX (X, Y) or MIN (X, y). gcc/testsuite * gcc.dg/pr96708-negative.c: New test. * gcc.dg/pr96708-positive.c: New test.
2020-12-01Fix mcore multilib specificationJeff Law1-1/+1
gcc * config/mcore/t-mcore (MULTILIB_EXCEPTIONS): Define.
2020-12-02Add pretty-printing support for __is_nothrow_{assignable,constructible}.Ville Voutilainen1-0/+6
gcc/cp/ChangeLog: PR c++/98054 * cxx-pretty-print.c (pp_cxx_trait_expression): Add support for __is_nothrow_{assignable,constructible}.
2020-12-01PR middle-end/97595 - bogus -Wstringop-overflow due to DECL_SIZE_UNIT ↵Martin Sebor4-6/+49
underreporting field size gcc/ChangeLog: PR middle-end/97595 * tree.c (component_ref_size): Fail when DECL_SIZE != TYPE_SIZE. * tree.h (DECL_SIZE, TYPE_SIZE): Update comment. gcc/testsuite/ChangeLog: PR middle-end/97595 * g++.dg/warn/Warray-bounds-14.C: New test. * g++.dg/warn/Wstringop-overflow-6.C: New test.
2020-12-01Fix more minor testsuite fallout from improved switch optimizationJeff Law1-1/+1
gcc/testsuite * gcc.dg/tree-ssa/pr96480.c: Disable jump table optimization
2020-12-01Feature: Macros for identifying the wide and narrow execution string literal ↵JeanHeyd Meneide3-0/+29
encoding gcc/c-family * c-cppbuiltin.c (c_cpp_builtins): Add predefined {__GNUC_EXECUTION_CHARSET_NAME} and _WIDE_EXECUTION_CHARSET_NAME} macros. gcc/ * doc/cpp.texi: Document new macros. gcc/testsuite/ * c-c++-common/cpp/wide-narrow-predef-macros.c: New test. libcpp/ * charset.c (init_iconv_desc): Initialize "to" and "from" fields. * directives.c (cpp_get_narrow_charset_name): New function. (cpp_get_wide_charset_name): Likewise. * include/cpplib.h (cpp_get_narrow_charset_name): Prototype. (cpp_get_wide_charset_name): Likewise. * internal.h (cset_converter): Add "to" and "from" fields.
2020-12-01Fix compromised tests after recent switch table improvementsJeff Law1-1/+1
gcc/testsuite * gcc.dg/pr46309-2.c: Add -fno-bit-tests and -fno-jump-tables to avoid compromising the test.
2020-12-01openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]Jakub Jelinek2-0/+13
Since r11-5430 we ICE on the following testcase. When parsing the depobj directive we don't really use cp_parser_omp_all_clauses routine which ATM disables generation of location wrappers and the newly added assertion that there are no location wrappers thus triggers. Fixed by adding the location wrappers suppression sentinel. Longer term, we should handle location wrappers inside of OpenMP clauses. 2020-12-01 Jakub Jelinek <jakub@redhat.com> PR c++/98072 * parser.c (cp_parser_omp_depobj): Suppress location wrappers when parsing depend clause. * c-c++-common/gomp/depobj-2.c: New test.
2020-12-01PR middle-end/97373 - missing warning on sprintf into allocated destinationMartin Sebor6-90/+444
gcc/ChangeLog: PR middle-end/97373 * builtins.c (compute_objsize): Rename... (compute_objsize_r): to this. Change order and types of arguments. Use new argument. Adjust calls to self. (access_ref::get_ref): New member function. (pointer_query::pointer_query): New member function. (pointer_query::get_ref): Same. (pointer_query::put_ref): Same. (handle_min_max_size): Change order and types of arguments. (maybe_emit_free_warning): Add a test. * builtins.h (class pointer_query): New class. (compute_objsize): Declare an overload. * gimple-ssa-sprintf.c (get_destination_size): Add argument. (handle_printf_call): Change argument type. * tree-ssa-strlen.c (adjust_last_stmt): Add an argument and use it. (maybe_warn_overflow): Same. (handle_builtin_strcpy): Same. (maybe_diag_stxncpy_trunc): Same. (handle_builtin_memcpy): Change argument type. Adjust calls. (handle_builtin_strcat): Same. (handle_builtin_memset): Same. (handle_store): Same. (strlen_check_and_optimize_call): Same. (check_and_optimize_stmt): Same. (strlen_dom_walker): Add new data members. (strlen_dom_walker::before_dom_children): Use new member. (printf_strlen_execute): Dump cache performance counters. Remove objsize pass cleanup. * tree-ssa-strlen.h (maybe_diag_stxncpy_trunc): Add argument. (handle_printf_call): Change argument type. gcc/testsuite/ChangeLog: PR middle-end/97373 * gcc.dg/tree-ssa/builtin-sprintf-warn-25.c: New test.
2020-12-01Make -fzero-call-used-regs work on the SPARCEric Botcazou2-0/+54
This contains both a generic fixlet for targets implementing the leaf register optimization (SPARC and Xtensa) and the implementation of the target hook TARGET_ZERO_CALL_USED_REGS which is needed to make this work on the SPARC. gcc/ChangeLog: * function.c (gen_call_used_regs_seq): In a function subject to the leaf register optimization, skip registers that are not present. * config/sparc/sparc.c (TARGET_ZERO_CALL_USED_REGS): Define to... (sparc_zero_call_used_regs): ...this. New function.
2020-12-01testsuite: replace .* with a better regexMartin Liska5-5/+5
gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/if-to-switch-1.C: Do not allow newlines in .* pattern. * gcc.dg/tree-ssa/if-to-switch-1.c: Likewise. * gcc.dg/tree-ssa/if-to-switch-2.c: Likewise. * gcc.dg/tree-ssa/if-to-switch-3.c: Likewise. * gcc.dg/tree-ssa/if-to-switch-5.c: Likewise.
2020-12-01Darwin, D : Adjust the X spec to cater for duplicate use.Iain Sandoe1-2/+2
The '-X' flag is an obsolete spelling for a command to tell the linker to 'strip local symbols'. This has been the default action for a long time - but, as per the usual GCC approach, although the flag is retired, we have not removed it; rather, we just delete it in the driver self-spec. The D language adds this flag as a front end option (to emit json) which means that deleting it in the driver disables that function in D. This patch works around the duplication by removing the unused flag in the link_spec instead of the driver self-spec. gcc/ChangeLog: * config/darwin.h: Remove unused 'X' specs in the link spec rather than driver self-specs.
2020-12-01if-to-switch: Fix test-suite patterns.Martin Liska5-7/+7
gcc/testsuite/ChangeLog: PR testsuite/98085 * g++.dg/tree-ssa/if-to-switch-1.C: Do not expect precise number of BBs. * gcc.dg/tree-ssa/if-to-switch-1.c: Likewise. * gcc.dg/tree-ssa/if-to-switch-2.c: Likewise. Find better name for the function. * gcc.dg/tree-ssa/if-to-switch-3.c: Likewise. Find better name for the function. * gcc.dg/tree-ssa/if-to-switch-5.c: Likewise.
2020-12-01C++ Module keywordsNathan Sidwell4-0/+17
This adds the module keywords. These are special internal tokens generated by the preprocessor's module-control-line token peeking logic. Spelling them with a space means that they turn back into regular tokens in preprocessor output (but do skew the column numbering :() gcc/c-family/ * c-common.c (module, import, export): New internal tokens (with trailing space). * c-common.h (RID__MODULE, RID__IMPORT & RID__EXPORT): Enumerate them. (D_CXX_MODULES, D_CXX_MODULES_FLAGS): Enable them. * c-cppbuiltin.c (c_cpp_builtins): Feature macro. gcc/cp/ * lex.c (init_reswords): Maybe enable module keywords.
2020-12-01C++ Module parameters & timersNathan Sidwell2-0/+7
Here is the new parameter and instrumentation timers for modules. gcc/ * params.opt (lazy-modules): New. * timevar.def (TV_MODULE_IMPORT, TV_MODULE_EXPORT) (TV_MODULE_MAPPER): New.
2020-12-01C++ Module optionsNathan Sidwell4-7/+126
This adds the C++ module options, and wires them into lang-specs. The options are not connected to any machinery. The options! They do nothing! gcc/c-family/ * c-opts.c (c_common_init_options): Ask for module dependencies. (c_common_handle_option): Handle -Mmodules -Mno-modules. * c-pch.c (c_common_valid_pch): ... does not play with C++ modules. * c.opt (Mmodules, Mno-modules): New preprocessor dependency options. (fmodules-ts, fmodule-header, fmodule-implicit-inline) (fmodule-only, fmodule-mapper, fmodule-lazy) (fmodule-version-ignore, Winvalid-imported-macros) (flang-info-include-translate, flang-info-include-translate-not): New options gcc/cp/ * lang-specs.h: Add module-related options.
2020-12-01Improve double-word mod even on powerpc [PR97459]Jakub Jelinek1-2/+1
I have noticed that while my (already committed, thanks for review) patch works on x86, it doesn't work on powerpc*. The problem is that we don't have lshr double-word optab (neither TImode nor for -m32 DImode), but as expander has code for double-word shift, that doesn't really matter. As the implementation is prepared to punt whenever something can't be expanded with OPTAB_DIRECT and in the end also punts if any library calls would be emitted, the optab_handler checks were just to save compile time. On the other side, for even divisors, we know that (1 << bit) % (2 * x) for bit > 0 will never be equal to 1, because both dividend and divisor are even and so remainder will be even too, so we can save some compile time by adding an early exit. The even divisors can be handled with the approach Thomas wrote about (perhaps generalized into divisors equal to what expand_doubleword_mod can handle times some power of two where we can handle power of two modulo cheaply), but that would be done in a different function... And we could use ctz to find the power of two... 2020-12-01 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/97459 * optabs.c (expand_doubleword_mod): Punt early for even op1. (expand_binop): Don't require lshr_optab double-word handler.
2020-12-01loop-invariant: JUMP_INSNs aren't loop invariant [PR97954]Jakub Jelinek2-0/+16
The following testcase ICEs because loop invariant motion moves asm goto with a single output as invariant. Normally, jumps aren't really moved, because if they are single set, they have their SET_DEST (pc) and pc_rtx has VOIDmode on which one of the functions find_invariant_insn calls bails out. The code already punts on insns that can throw or trap. And for asm goto without outputs, it isn't single set, or asm goto with two or more outputs it isn't single set either. 2020-12-01 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/97954 * loop-invariant.c (find_invariant_insn): Punt on JUMP_P insns. * gcc.dg/pr97954.c: New test.
2020-12-01configury : Fix LEB128 support for non-GNU assemblers.Iain Sandoe2-38/+46
The current configuration test for LEB128 support in the assembler is (a) specific to GNU assemblers and (b) only checks that the directives are accepted, not that they give correct output. The patch extends the asm test to cover one failure case present in assemblers based off an older version of GAS (where a 64 bit value with the MSB set presented to a .uleb128 directive causes a fail). The test is now generalized such that it does not make use of any specific test for assembler source/version, but checks that the output is as expected. We cater for scanning the object with objdump (either binutils or LLVM) or Darwin otool. gcc/ChangeLog: * configure.ac (check leb128 support): Check that assemblers both accept the LEB128 directives and also give the expected output. Add a test for uleb128 with the MSB set for a 64 bit value. * configure: Regenerated.
2020-12-01Regenerate a configure script omitted in r11-5520.Iain Sandoe1-4/+4
Additional change for : hppa64-hpux11 build to remove source paths from embedded path. gcc/ChangeLog: * configure: Regnerated.