aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-02-21rtl-optimization/104498: Fix comparing symbol referenceAndre Vieira1-2/+4
gcc/ChangeLog: PR rtl-optimization/104498 * alias.cc (compare_base_symbol_refs): Correct distance computation when swapping x and y.
2022-02-21c: [PR104506] Fix ICE after error due to change of type to error_mark_nodeAndrew Pinski4-7/+47
The problem here is we end up with an error_mark_node when calling useless_type_conversion_p and that ICEs. STRIP_NOPS/tree_nop_conversion has had a check for the inner type being an error_mark_node since g9a6bb3f78c96 (2000). This just adds the check also to tree_ssa_useless_type_conversion. STRIP_USELESS_TYPE_CONVERSION is mostly used inside the gimplifier and the places where it is used outside of the gimplifier would not be adding too much overhead. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski PR c/104506 gcc/ChangeLog: * tree-ssa.cc (tree_ssa_useless_type_conversion): Check the inner type before calling useless_type_conversion_p. gcc/testsuite/ChangeLog: * gcc.dg/pr104506-1.c: New test. * gcc.dg/pr104506-2.c: New test. * gcc.dg/pr104506-3.c: New test.
2022-02-21Daily bump.GCC Administrator5-1/+47
2022-02-21d: Remove handling of deleting GC allocated classes.Iain Buclaw2-23/+7
Now that the `delete' keyword has been removed from the front-end, only compiler-generated uses of DeleteExp reach the code generator via the auto-destruction of `scope class' variables. The run-time library helpers that previously were used to delete GC class objects can now be removed from the compiler. gcc/d/ChangeLog: * expr.cc (ExprVisitor::visit (DeleteExp *)): Remove handling of deleting GC allocated classes. * runtime.def (DELCLASS): Remove. (DELINTERFACE): Remove.
2022-02-20d: Merge upstream dmd cb49e99f8, druntime 55528bd1, phobos 1a3e80ec2.Iain Buclaw245-4937/+5539
D front-end changes: - Import dmd v2.099.0-beta.1. - It's now an error to use `alias this' for partial assignment. - The `delete' keyword has been removed from the language. - Using `this' and `super' as types has been removed from the language, the parser no longer specially handles this wrong code with an informative error. D Runtime changes: - Import druntime v2.099.0-beta.1. Phobos changes: - Import phobos v2.099.0-beta.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd cb49e99f8. * dmd/VERSION: Update version to v2.099.0-beta.1. * decl.cc (layout_class_initializer): Update call to NewExp::create. * expr.cc (ExprVisitor::visit (DeleteExp *)): Remove handling of deleting arrays and pointers. (ExprVisitor::visit (DotVarExp *)): Convert complex types to the front-end library type representing them. (ExprVisitor::visit (StringExp *)): Use getCodeUnit instead of charAt to get the value of each index in a string expression. * runtime.def (DELMEMORY): Remove. (DELARRAYT): Remove. * types.cc (TypeVisitor::visit (TypeEnum *)): Handle anonymous enums. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 55528bd1. * src/MERGE: Merge upstream phobos 1a3e80ec2. * testsuite/libphobos.hash/test_hash.d: Update. * testsuite/libphobos.betterc/test19933.d: New test.
2022-02-20Fortran: improve check of pointer initialization in DATA statementsHarald Anlauf3-0/+28
gcc/fortran/ChangeLog: PR fortran/77693 * data.cc (gfc_assign_data_value): If a variable in a data statement has the POINTER attribute, check for allowed initial data target that is compatible with pointer assignment. * gfortran.h (IS_POINTER): New macro. gcc/testsuite/ChangeLog: PR fortran/77693 * gfortran.dg/data_pointer_2.f90: New test.
2022-02-20Daily bump.GCC Administrator3-1/+53
2022-02-19[nvptx] Use _ as destination operand of atom.exchTom de Vries3-12/+35
We currently generate this code for an atomic store: ... .reg.u32 %r21; atom.exch.b32 %r21,[%r22],%r23; ... where %r21 is set but unused. Use the ptx bit bucket operand '_' instead, such that we have: ... atom.exch.b32 _,[%r22],%r23; ... [ Note that the same problem still occurs for this code: ... void atomic_store (int *ptr, int val) { __atomic_exchange_n (ptr, val, MEMMODEL_RELAXED); } ... ] Tested on nvptx. gcc/ChangeLog: 2022-02-19 Tom de Vries <tdevries@suse.de> * config/nvptx/nvptx.cc (nvptx_reorg_uniform_simt): Handle SET insn. * config/nvptx/nvptx.md (define_insn "nvptx_atomic_store<mode>"): Rename to ... (define_insn "nvptx_atomic_store_sm70<mode>"): This. (define_insn "nvptx_atomic_store<mode>"): New define_insn. (define_expand "atomic_store<mode>"): Handle rename. Use nvptx_atomic_store instead of atomic_exchange. gcc/testsuite/ChangeLog: 2022-02-19 Tom de Vries <tdevries@suse.de> * gcc.target/nvptx/atomic-store-1.c: Update.
2022-02-19[nvptx] Don't skip atomic insns in nvptx_reorg_uniform_simtTom de Vries3-5/+21
In nvptx_reorg_uniform_simt we have a loop: ... for (insn = get_insns (); insn; insn = next) { next = NEXT_INSN (insn); if (!(CALL_P (insn) && nvptx_call_insn_is_syscall_p (insn)) && !(NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == PARALLEL && get_attr_atomic (insn))) continue; ... that intends to handle syscalls and atomic insns. However, this also silently skips the atomic insn nvptx_atomic_store, which has GET_CODE (PATTERN (insn)) == SET. This does not cause problems, because the nvptx_atomic_store actually maps onto a "st" insn, and therefore is not atomic and doesn't need to be handled by nvptx_reorg_uniform_simt. Fix this by: - explicitly setting nvptx_atomic_store's atomic attribute to false, - rewriting the skip condition to make sure all insn with atomic attribute are handled, and - asserting that all handled insns are PARALLEL. Tested on nvptx. gcc/ChangeLog: 2022-02-19 Tom de Vries <tdevries@suse.de> * config/nvptx/nvptx.cc (nvptx_reorg_uniform_simt): Handle all insns with atomic attribute. Assert that all handled insns are PARALLELs. * config/nvptx/nvptx.md (define_insn "nvptx_atomic_store<mode>"): Set atomic attribute to false. gcc/testsuite/ChangeLog: 2022-02-19 Tom de Vries <tdevries@suse.de> * gcc.target/nvptx/uniform-simt-3.c: New test.
2022-02-19[nvptx] Use nvptx_warpsync / nvptx_uniform_warp_check for -muniform-simtTom de Vries3-3/+52
With the default ptx isa 6.0, we have for uniform-simt-1.c: ... @%r33 atom.global.cas.b32 %r26, [a], %r28, %r29; shfl.sync.idx.b32 %r26, %r26, %r32, 31, 0xffffffff; ... The atomic insn is predicated by -muniform-simt, and the subsequent insn does a warp sync, at which point the warp is uniform again. But with -mptx=3.1, we have instead: ... @%r33 atom.global.cas.b32 %r26, [a], %r28, %r29; shfl.idx.b32 %r26, %r26, %r32, 31; ... The shfl does not sync the warp, and we want the warp to go back to executing uniformly asap. We cannot enforce this, but at least check this using nvptx_uniform_warp_check, similar to how that is done for openacc. Likewise, detect the case that no shfl insn is emitted, and add a nvptx_uniform_warp_check or nvptx_warpsync. gcc/ChangeLog: 2022-02-19 Tom de Vries <tdevries@suse.de> * config/nvptx/nvptx.cc (nvptx_unisimt_handle_set): Change return type to bool. (nvptx_reorg_uniform_simt): Insert nvptx_uniform_warp_check or nvptx_warpsync, if necessary. gcc/testsuite/ChangeLog: 2022-02-19 Tom de Vries <tdevries@suse.de> * gcc.target/nvptx/uniform-simt-1.c: Add scan-assembler test. * gcc.target/nvptx/uniform-simt-2.c: New test.
2022-02-19asan: Mark instrumented vars addressable [PR102656]Jakub Jelinek2-2/+34
We ICE on the following testcase, because the asan1 pass decides to instrument <retval>.x = 0; and does that by _13 = &<retval>.x; .ASAN_CHECK (7, _13, 4, 4); <retval>.x = 0; and later sanopt pass turns that into: _39 = (unsigned long) &<retval>.x; _40 = _39 >> 3; _41 = _40 + 2147450880; _42 = (signed char *) _41; _43 = *_42; _44 = _43 != 0; _45 = _39 & 7; _46 = (signed char) _45; _47 = _46 + 3; _48 = _47 >= _43; _49 = _44 & _48; if (_49 != 0) goto <bb 10>; [0.05%] else goto <bb 9>; [99.95%] <bb 10> [local count: 536864]: __builtin___asan_report_store4 (_39); <bb 9> [local count: 1073741824]: <retval>.x = 0; The problem is during expansion, <retval> isn't marked TREE_ADDRESSABLE, even when we take its address in (unsigned long) &<retval>.x. Now, instrument_derefs has code to avoid the instrumentation altogether if we can prove the access is within bounds of an automatic variable in the current function and the var isn't TREE_ADDRESSABLE (or we don't instrument use after scope), but we do it solely for VAR_DECLs. I think we should treat RESULT_DECLs exactly like that too, which is what the following patch does. I must say I'm unsure about PARM_DECLs, those can have different cases, either they are fully or partially passed in registers, then if we take parameter's address, they are in a local copy inside of a function and so work like those automatic vars. But if they are fully passed in memory, we typically just take address of the slot and in that case they live in the caller's frame. It is true we don't (can't) put any asan padding in between the arguments, so all asan could detect in that case is if caller passes fewer on stack arguments or smaller arguments than callee accepts. Anyway, as I'm unsure, I haven't added PARM_DECLs to that case. And another thing is, when we actually build_fold_addr_expr, we need to mark_addressable the inner if it isn't addressable already. 2022-02-19 Jakub Jelinek <jakub@redhat.com> PR sanitizer/102656 * asan.cc (instrument_derefs): If inner is a RESULT_DECL and access is known to be within bounds, treat it like automatic variables. If instrumenting access and inner is {VAR,PARM,RESULT}_DECL from current function and !TREE_STATIC which is not TREE_ADDRESSABLE, mark it addressable. * g++.dg/asan/pr102656.C: New test.
2022-02-19Daily bump.GCC Administrator4-1/+70
2022-02-18libgo: update Hurd supportIan Lance Taylor9-10/+298
Patches from Svante Signell for PR go/104290. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386797
2022-02-18Mark Power10 fusion option undocumented and remove sub-options.Pat Haugen5-238/+174
gcc/ * config/rs6000/rs6000.opt (mpower10-fusion): Mark Undocumented. (mpower10-fusion-ld-cmpi, mpower10-fusion-2logical, mpower10-fusion-logical-add, mpower10-fusion-add-logical, mpower10-fusion-2add, mpower10-fusion-2store): Remove. * config/rs6000/rs6000-cpus.def (ISA_3_1_MASKS_SERVER, OTHER_P9_VECTOR_MASKS): Remove Power10 fusion sub-options. * config/rs6000/rs6000.cc (rs6000_option_override_internal, power10_sched_reorder): Likewise. * config/rs6000/genfusion.pl (gen_ld_cmpi_p10, gen_logical_addsubf, gen_addadd): Likewise * config/rs6000/fusion.md: Regenerate.
2022-02-18libgo: update to Go1.18rc1 releaseIan Lance Taylor188-2976/+3700
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386594
2022-02-18pieces-memset-21.c: Expect vzeroupper for ia32H.J. Lu1-1/+2
Update gcc.target/i386/pieces-memset-21.c to expect vzeroupper for ia32 caused by commit fe79d652c96b53384ddfa43e312cb0010251391b Author: Richard Biener <rguenther@suse.de> Date: Thu Feb 17 14:40:16 2022 +0100 target/104581 - compile-time regression in mode-switching PR target/104581 * gcc.target/i386/pieces-memset-21.c: Expect vzeroupper for ia32.
2022-02-18rs6000: Fix up posix_memalign call in _mm_malloc [PR104598]Jakub Jelinek1-1/+1
The uglification changes went in one spot too far and uglified also the anem of function, posix_memalign should be called like that and not a non-existent function instead of it. 2022-02-18 Jakub Jelinek <jakub@redhat.com> PR target/104257 PR target/104598 * config/rs6000/mm_malloc.h (_mm_malloc): Call posix_memalign rather than __posix_memalign.
2022-02-18target/104581 - compile-time regression in mode-switchingRichard Biener2-76/+5
The x86 backend piggy-backs on mode-switching for insertion of vzeroupper. A recent improvement there was implemented in a way to walk possibly the whole basic-block for all DF reg def definitions in its mode_needed hook which is called for each instruction in a basic-block during mode-switching local analysis. The following mostly reverts this improvement. It needs to be re-done in a way more consistent with a local dataflow which probably means making targets aware of the state of the local dataflow analysis. 2022-02-17 Richard Biener <rguenther@suse.de> PR target/104581 * config/i386/i386.cc (ix86_avx_u128_mode_source): Remove. (ix86_avx_u128_mode_needed): Return AVX_U128_DIRTY instead of calling ix86_avx_u128_mode_source which would eventually have returned AVX_U128_ANY in some very special case. * gcc.target/i386/pr101456-1.c: XFAIL.
2022-02-18tree-optimization/96881 - CD-DCE and CLOBBERsRichard Biener3-4/+109
CD-DCE does not consider CLOBBERs as necessary in the attempt to not prevent DCE of SSA defs it uses. A side-effect of that is that it also removes all its control dependences if they are not made necessary by other means. When we later try to preserve as many CLOBBERs as possible we have to make sure we also preserved the controlling conditions, otherwise a CLOBBER can now appear on a path where it was not executed before, leading to wrong code as seen in the testcase. I've tried to continue to handle both direct and indirect CLOBBERs optimistically, allowing CD-DCE to remove control flow that just controls CLOBBERs but that regresses for example the stack coalescing test g++.dg/opt/pr80032.C. The pattern there is if (pred) D.2512 = CLOBBER; else D.2512 = CLOBBER; basically we have all paths leading to the same clobber but we could safely cut some branches which we do not realize early enough. This regression can be mitigated by no longer considering direct CLOBBERs optimistically - the original motivation for the CD-DCE handling wasn't removal of control flow but SSA defs of the address. Handling indirect vs. direct clobbers differently feels somewhat wrong, still the patch goes with this solution. 2022-02-15 Richard Biener <rguenther@suse.de> PR tree-optimization/96881 * tree-ssa-dce.cc (mark_stmt_if_obviously_necessary): Comment CLOBBER handling. (control_parents_preserved_p): New function. (eliminate_unnecessary_stmts): Check that we preserved control parents before retaining a CLOBBER. (perform_tree_ssa_dce): Pass down aggressive flag to eliminate_unnecessary_stmts. * g++.dg/torture/pr96881-1.C: New testcase. * g++.dg/torture/pr96881-2.C: Likewise.
2022-02-17c++: implicit 'this' in noexcept-spec within class tmpl [PR94944]Patrick Palka3-16/+28
Here when instantiating the noexcept-spec we fail to resolve the implicit object for the member call A<T>::f() ultimately because maybe_instantiate_noexcept sets current_class_ptr/ref to the dependent 'this' (of type B<T>) rather than the specialized 'this' (of type B<int>). This patch fixes this by making maybe_instantiate_noexcept set current_class_ptr/ref to the specialized 'this' instead, consistent with what tsubst_function_type does when substituting into the trailing return type of a non-static member function. PR c++/94944 gcc/cp/ChangeLog: * pt.cc (maybe_instantiate_noexcept): For non-static member functions, set current_class_ptr/ref to the specialized 'this' instead. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/noexcept34.C: Adjusted expected diagnostics. * g++.dg/cpp0x/noexcept75.C: New test.
2022-02-18Daily bump.GCC Administrator10-1/+202
2022-02-17libstdc++: Deprecate non-standard std::vector<bool>::insert(pos) [PR104559]Jonathan Wakely4-2/+28
The SGI STL and pre-1998 drafts of the C++ standard had a default argument for vector<bool>::insert(iterator, const bool&) which was remove by N1051. The default argument is still present in libstdc++ for some reason. There are no tests verifying it as an extension, so I don't think it has been kept intentionally. This removes the default argument but adds an overload without the second parameter, and adds the deprecated attribute to it. This allows any code using it to keep working (for now) but with a warning. libstdc++-v3/ChangeLog: PR libstdc++/104559 * doc/xml/manual/evolution.xml: Document deprecation. * doc/html/manual/api.html: Regenerate. * include/bits/stl_bvector.h (insert(const_iterator, const bool&)): Remove default argument. (insert(const_iterator)): New overload with deprecated attribute. * testsuite/23_containers/vector/bool/modifiers/insert/104559.cc: New test.
2022-02-17c++: inlining explicit instantiations [PR104539]Jason Merrill2-3/+15
The PR10968 fix cleared DECL_COMDAT to force output of explicit instantiations. Then the PR59469 fix added a call to mark_needed, after which we no longer need to clear DECL_COMDAT, and leaving it set allows us to inline explicit instantiations without worrying about symbol interposition. I suppose there's an argument to be made that an explicit instantiation declaration (extern template) should clear DECL_COMDAT, since that suggests that there will be only a single instantiation somewhere that could be subject to interposition, but that doesn't change the 'inline' semantics, and it seems cleaner to treat template instantiations uniformly. PR c++/104539 gcc/cp/ChangeLog: * pt.cc (mark_decl_instantiated): Don't clear DECL_COMDAT. gcc/testsuite/ChangeLog: * g++.dg/ipa/inline-4.C: New test.
2022-02-17tree: tweak warn_deprecated_useJason Merrill2-3/+7
While looking at PR90451 I noticed that this function was failing to find the attributes if called with a variant of the struct. gcc/ChangeLog: * tree.cc (warn_deprecated_use): Look for TYPE_STUB_DECL on TYPE_MAIN_VARIANT. gcc/testsuite/ChangeLog: * g++.dg/warn/deprecated-16.C: New test.
2022-02-17libstdc++: Make std::error_code printer more robustJonathan Wakely2-19/+101
This attempts to implement a partial workaround for the GDB bug https://sourceware.org/bugzilla/show_bug.cgi?id=28856 which causes GDB to crash when printing a frame with a std::error_code argument. By recognising the known error categories defined in the library and hardcoding their names we do not need to call cat->name() on the category. This has the additional benefit of also working when debugging a core file rather than a running process. For those known categories we can also cast the int value to the corresponding error code enum (e.g. future_errc) so that we show an enumerator instead of just an integer. For program-defined categories we just use the name of the dynamic type to identify the category, and print the value as an integer. Once the GDB bug is fixed and the virtual name() function can be called safely, that would be preferable. For now it's better to have an imperfect printer that doesn't crash GDB. This rewritten StdErrorCodePrinter needs gdb.Value.dynamic_type, so is only registered if that is supported, which means GDB 7.7 and later. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Replace code that call cat->name() on std::error_category objects. Identify known categories by symbol name and use a hardcoded name. Print error code values as enumerators where appopriate. * testsuite/libstdc++-prettyprinters/cxx11.cc: Adjust expected name of custom category. Check io_errc and future_errc errors.
2022-02-17c++: avoid duplicate deprecated warning [PR90451]Jason Merrill9-18/+132
We were getting the deprecated warning twice for the same call because we called mark_used first in finish_qualified_id_expr and then again in build_over_call. Let's not call it the first time; C++17 clarified that a function is used only when it is selected from an overload set, which happens later. Then I had to add a few more uses in places that don't do anything further with the expression (convert_to_void, finish_decltype_type), and places that use the expression more unusually (cp_build_addr_expr_1, convert_nontype_argument). The new mark_single_function is mostly so that I only have to put the comment in one place. PR c++/90451 gcc/cp/ChangeLog: * decl2.cc (mark_single_function): New. * cp-tree.h: Declare it. * typeck.cc (cp_build_addr_expr_1): mark_used when making a PMF. * semantics.cc (finish_qualified_id_expr): Not here. (finish_id_expression_1): Or here. (finish_decltype_type): Call mark_single_function. * cvt.cc (convert_to_void): And here. * pt.cc (convert_nontype_argument): And here. * init.cc (build_offset_ref): Adjust assert. gcc/testsuite/ChangeLog: * g++.dg/warn/deprecated-14.C: New test. * g++.dg/warn/deprecated-15.C: New test.
2022-02-17rs6000: __Uglify non-uglified local variables in headersPaul A. Clarke8-1341/+1340
Properly prefix (with "__") all local variables in shipped headers for x86 compatibility intrinsics implementations. This avoids possible problems with usages like: ``` ``` 2022-02-16 Paul A. Clarke <pc@us.ibm.com> gcc PR target/104257 * config/rs6000/bmi2intrin.h: Uglify local variables. * config/rs6000/emmintrin.h: Likewise. * config/rs6000/mm_malloc.h: Likewise. * config/rs6000/mmintrin.h: Likewise. * config/rs6000/pmmintrin.h: Likewise. * config/rs6000/smmintrin.h: Likewise. * config/rs6000/tmmintrin.h: Likewise. * config/rs6000/xmmintrin.h: Likewise.
2022-02-17rs6000: Workaround for new ifcvt behavior [PR104335].Robin Dapp1-0/+6
Since r12-6747-gaa8cfe785953a0 ifcvt passes a "cc comparison" i.e. the representation of the result of a comparison to the backend. rs6000_emit_int_cmove () is not prepared to handle this. Therefore, this patch makes it return false in such a case. PR target/104335 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_int_cmove): Return false if the expected comparison's first operand is of mode MODE_CC.
2022-02-17c-family: Remove names of unused parametersJonathan Wakely1-13/+13
C++ allows unnamed parameters, which means we don't need to call them 'dummy' and mark them with the unused attribute. gcc/c-family/ChangeLog: * c-pragma.cc (handle_pragma_pack): Remove parameter name. (handle_pragma_weak): Likewise. (handle_pragma_scalar_storage_order): Likewise. (handle_pragma_redefine_extname): Likewise. (handle_pragma_visibility): Likewise. (handle_pragma_diagnostic): Likewise. (handle_pragma_target): Likewise. (handle_pragma_optimize): Likewise. (handle_pragma_push_options): Likewise. (handle_pragma_pop_options): Likewise. (handle_pragma_reset_options): Likewise. (handle_pragma_message): Likewise. (handle_pragma_float_const_decimal64): Likewise.
2022-02-17Add missing target selectorEric Botcazou1-1/+1
gcc/testsuite/ PR target/79754 * gcc.target/i386/pr79754.c: Add target dfp.
2022-02-17net: add hurd build tag for setReadMsgCloseOnExecIan Lance Taylor2-2/+2
Patch from Svante Signell. PR go/103573 PR go/104290 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386216
2022-02-17libiberty rust-demangle, ignore .suffixMark Wielaard2-3/+44
Rust symbols can have a .suffix because of compiler transformations. These can be ignored in the demangled name. Which is what this patch implements. By stopping at the first dot for v0 symbols and searching backwards to the ending 'E' for legacy symbols. An alternative implementation could be to follow what C++ does and represent these as [clone .suffix] tagged onto the demangled name. But this seems somewhat confusing since it results in a demangled name that cannot be mangled again. And it would mean trying to decode compiler internal naming. https://bugs.kde.org/show_bug.cgi?id=445916 https://github.com/rust-lang/rust/issues/60705 libiberty/Changelog * rust-demangle.c (rust_demangle_callback): Ignore everything after '.' char in sym for v0. For legacy symbols search backwards to find the last 'E' before any '.'. * testsuite/rust-demangle-expected: Add new .suffix testcases.
2022-02-17[PR104447] LRA: Do not split non-alloc hard regs.Vladimir N. Makarov2-1/+15
LRA tried to split non-allocated hard reg for reload pseudos again and again until number of assignment passes reaches the limit. The patch fixes this. gcc/ChangeLog: PR rtl-optimization/104447 * lra-constraints.cc (spill_hard_reg_in_range): Initiate ignore hard reg set by lra_no_alloc_regs. gcc/testsuite/ChangeLog: PR rtl-optimization/104447 * gcc.target/i386/pr104447.c: New.
2022-02-17c++: double non-dep folding from finish_compound_literal [PR104565]Patrick Palka2-7/+15
In finish_compound_literal, we perform non-dependent expr folding before the call to check_narrowing ever since r9-5973. But ever since r10-7096, check_narrowing also performs non-dependent expr folding of its own. This double folding means tsubst will see non-templated trees during the second folding, which causes a spurious error in the below testcase. This patch removes the former folding operation; it seems obviated by the latter one. PR c++/104565 gcc/cp/ChangeLog: * semantics.cc (finish_compound_literal): Don't perform non-dependent expr folding before calling check_narrowing. gcc/testsuite/ChangeLog: * g++.dg/template/non-dependent22.C: New test.
2022-02-17Restrict the two sources of vect_recog_cond_expr_convert_pattern to be of ↵liuhongt3-2/+34
the same type when convert is extension. It's not equal to transform (cond (cmp @1 @2) (convert@3 @4) (convert@5 @6)) to (convert (cmp @1 @2) (convert)@4 @6) when(convert@3 @4) is extension because it's zero_extend vs sign_extend. gcc/ChangeLog: PR tree-optimization/104551 PR tree-optimization/103771 * match.pd (cond_expr_convert_p): Add types_match check when convert is extension. * tree-vect-patterns.cc (gimple_cond_expr_convert_p): Adjust comments. (vect_recog_cond_expr_convert_pattern): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr104551.c: New test.
2022-02-17valtrack: Avoid creating raw SUBREGs with VOIDmode argument [PR104557]Jakub Jelinek2-1/+25
After the recent r12-7240 simplify_immed_subreg changes, we bail on more simplify_subreg calls than before, e.g. apparently for decimal modes in the NaN representations we almost never preserve anything except the canonical {q,s}NaNs. simplify_gen_subreg will punt in such cases because a SUBREG with VOIDmode is not valid, but debug_lowpart_subreg wants to attempt even harder, even if e.g. target indicates certain mode combinations aren't valid for the backend, dwarf2out can still handle them. But a SUBREG from a VOIDmode operand is just too much, the inner mode is lost there. We'd need some new rtx that would be able to represent those cases. For now, just punt in those cases. 2022-02-17 Jakub Jelinek <jakub@redhat.com> PR debug/104557 * valtrack.cc (debug_lowpart_subreg): Don't call gen_rtx_raw_SUBREG if expr has VOIDmode. * gcc.dg/dfp/pr104557.c: New test.
2022-02-17openmp: Ensure proper diagnostics for -> in map/to/from clauses [PR104532]Jakub Jelinek2-1/+25
The following patch uses the functions normal CPP_DEREF parsing uses, i.e. convert_lvalue_to_rvalue and build_indirect_ref, instead of blindly calling build_simple_mem_ref, so that if the variable does not have correct type, we properly diagnose it instead of ICEing on it. 2022-02-17 Jakub Jelinek <jakub@redhat.com> PR c/104532 * c-parser.cc (c_parser_omp_variable_list): For CPP_DEREF, use convert_lvalue_to_rvalue and build_indirect_ref instead of build_simple_mem_ref. * gcc.dg/gomp/pr104532.c: New test.
2022-02-17Clean up MPX-related bit_{MPX,BNDREGS,BNDCSR}.liuhongt1-5/+0
gcc/ChangeLog: * config/i386/cpuid.h (bit_MPX): Removed. (bit_BNDREGS): Ditto. (bit_BNDCSR): Ditto.
2022-02-16libbacktrace: gather address ranges from skeleton unitsIan Lance Taylor1-11/+20
* dwarf.c (find_address_ranges): Handle skeleton units. (read_function_entry): Likewise.
2022-02-16Define __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__.Michael Meissner2-1/+26
Define the sizes of the PowerPC specific types __float128 and __ibm128 if those types are enabled. This patch will define __SIZEOF_IBM128__ and __SIZEOF_FLOAT128__ if their respective types are created in the compiler. Currently, this means both of these will be defined if float128 support is enabled. But at some point in the future, __ibm128 could be enabled without enabling float128 support and __SIZEOF_IBM128__ would be defined. 2022-02-16 Michael Meissner <meissner@the-meissners.org> gcc/ PR target/99708 * config/rs6000/rs6000-c.cc (rs6000_cpu_cpp_builtins): Define __SIZEOF_IBM128__ if the IBM 128-bit long double type is created. Define __SIZEOF_FLOAT128__ if the IEEE 128-bit floating point type is created. gcc/testsuite/ PR target/99708 * gcc.target/powerpc/pr99708.c: New test.
2022-02-16analyzer: const functions have no side effects [PR104576]David Malcolm4-2/+193
PR analyzer/104576 tracks that we issue a false positive from -Wanalyzer-use-of-uninitialized-value for the reproducers of PR 63311 when optimization is disabled. The root cause is that the analyzer was considering that a call to __builtin_sinf could have side-effects. This patch fixes things by generalizing the handling for "pure" functions to also consider "const" functions. gcc/analyzer/ChangeLog: PR analyzer/104576 * region-model.cc: Include "calls.h". (region_model::on_call_pre): Use flags_from_decl_or_type to generalize check for DECL_PURE_P to also check for ECF_CONST. gcc/testsuite/ChangeLog: PR analyzer/104576 * gcc.dg/analyzer/torture/uninit-pr63311.c: New test. * gcc.dg/analyzer/uninit-pr104576.c: New test. * gfortran.dg/analyzer/uninit-pr63311.f90: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-02-17Daily bump.GCC Administrator9-1/+171
2022-02-16analyzer: fixes to free of non-heap detection [PR104560]David Malcolm14-117/+262
PR analyzer/104560 reports various false positives from -Wanalyzer-free-of-non-heap seen with rdma-core, on what's effectively: free (&ptr->field) where in this case "field" is the first element of its struct, and thus &ptr->field == ptr, and could be on the heap. The root cause is due to malloc_state_machine::on_stmt making "LHS = &EXPR;" transition LHS from start to non_heap when EXPR is not a MEM_REF; this assumption doesn't hold for the above case. This patch eliminates that state transition, instead relying on malloc_state_machine::get_default_state to detect regions known to not be on the heap. Doing so fixes the false positive, but eliminates some events relating to free-of-alloca identifying the alloca, so the patch also reworks free_of_non_heap to capture which region has been freed, adding region creation events to diagnostic paths, so that the alloca calls can be identified, and using the memory space of the region for more precise wording of the diagnostic. The improvement to malloc_state_machine::get_default_state also means we now detect attempts to free VLAs, functions and code labels. In doing so I spotted that I wasn't adding region creation events for regions for global variables, and for cases where an allocation is the last stmt within its basic block, so the patch also fixes these issues. gcc/analyzer/ChangeLog: PR analyzer/104560 * diagnostic-manager.cc (diagnostic_manager::build_emission_path): Add region creation events for globals of interest. (null_assignment_sm_context::get_old_program_state): New. (diagnostic_manager::add_events_for_eedge): Move check for changing dynamic extents from PK_BEFORE_STMT case to after the switch on the dst_point's kind so that we can emit them for the final stmt in a basic block. * engine.cc (impl_sm_context::get_old_program_state): New. * sm-malloc.cc (malloc_state_machine::get_default_state): Rewrite detection of m_non_heap to use get_memory_space. (free_of_non_heap::free_of_non_heap): Add freed_reg param. (free_of_non_heap::subclass_equal_p): Update for changes to fields. (free_of_non_heap::emit): Drop m_kind in favor of get_memory_space. (free_of_non_heap::describe_state_change): Remove logic for detecting alloca. (free_of_non_heap::mark_interesting_stuff): Add region-creation of m_freed_reg. (free_of_non_heap::get_memory_space): New. (free_of_non_heap::kind): Drop enum. (free_of_non_heap::m_freed_reg): New field. (free_of_non_heap::m_kind): Drop field. (malloc_state_machine::on_stmt): Drop transition to m_non_heap. (malloc_state_machine::handle_free_of_non_heap): New function, split out from on_deallocator_call and on_realloc_call, adding detection of the freed region. (malloc_state_machine::on_deallocator_call): Use it. (malloc_state_machine::on_realloc_call): Likewise. * sm.h (sm_context::get_old_program_state): New vfunc. gcc/testsuite/ChangeLog: PR analyzer/104560 * g++.dg/analyzer/placement-new.C: Update expected wording. * g++.dg/analyzer/pr100244.C: Likewise. * gcc.dg/analyzer/attr-malloc-1.c (test_7): Likewise. * gcc.dg/analyzer/malloc-1.c (test_24): Likewise. (test_25): Likewise. (test_26): Likewise. (test_50a, test_50b, test_50c): New. * gcc.dg/analyzer/malloc-callbacks.c (test_5): Update expected wording. * gcc.dg/analyzer/malloc-paths-8.c: Likewise. * gcc.dg/analyzer/pr104560-1.c: New test. * gcc.dg/analyzer/pr104560-2.c: New test. * gcc.dg/analyzer/realloc-1.c (test_7): Updated expected wording. * gcc.dg/analyzer/vla-1.c (test_2): New. Prune output from -Wfree-nonheap-object. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-02-16libgo: restore building on SolarisIan Lance Taylor8-9/+18
Add build tags and a few other changes so that libgo builds on Solaris. Patch partially from Rainer Orth. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386215
2022-02-16libbacktrace: initialize DWARF 5 fields of unitIan Lance Taylor1-0/+3
When I added the fields in 2019-12-13 I forgot to initialize them. * dwarf.c (build_address_map): Initialize DWARF 5 fields of unit.
2022-02-16Use range_compatible_p in condexpr_adjustAndrew MacLeod1-1/+1
* gimple-range-gori.cc (gori_compute::condexpr_adjust): Use range_compatible_p instead of direct type comparison.
2022-02-16c++: treat NON_DEPENDENT_EXPR as not potentially constant [PR104507]Patrick Palka2-1/+17
Here we're crashing from potential_constant_expression because it tries to perform trial evaluation of the first operand '(bool)__r' of the conjunction (which is overall wrapped in a NON_DEPENDENT_EXPR), but cxx_eval_constant_expression ICEs on unsupported trees (of which CAST_EXPR is one). The sequence of events is: 1. build_non_dependent_expr for the array subscript yields NON_DEPENDENT_EXPR<<<(bool)__r && __s>>> ? 1 : 2 2. cp_build_array_ref calls fold_non_dependent_expr on this subscript (after this point, processing_template_decl is cleared) 3. during which, the COND_EXPR case of tsubst_copy_and_build calls fold_non_dependent_expr on the first operand 4. during which, we crash from p_c_e_1 because it attempts trial evaluation of the CAST_EXPR '(bool)__r'. Note that even if this crash didn't happen, fold_non_dependent_expr from cp_build_array_ref would still ultimately be one big no-op here since neither constexpr evaluation nor tsubst handle NON_DEPENDENT_EXPR. In light of this and of the observation that we should never see NON_DEPENDENT_EXPR in a context where a constant expression is needed (it's used primarily in the build_x_* family of functions), it seems futile for p_c_e_1 to ever return true for NON_DEPENDENT_EXPR. And the otherwise inconsistent handling of NON_DEPENDENT_EXPR between p_c_e_1, cxx_evaluate_constexpr_expression and tsubst apparently leads to weird bugs such as this one. PR c++/104507 gcc/cp/ChangeLog: * constexpr.cc (potential_constant_expression_1) <case NON_DEPENDENT_EXPR>: Return false instead of recursing. Assert tf_error isn't set. gcc/testsuite/ChangeLog: * g++.dg/template/non-dependent21.C: New test.
2022-02-16testsuite: Add testcase for already fixed PR [PR104448]Jakub Jelinek1-0/+9
This PR has been fixed with r12-7147-g2f9ab267e725ddf2. 2022-02-16 Jakub Jelinek <jakub@redhat.com> PR target/104448 * gcc.target/i386/pr104448.c: New test.
2022-02-16combine: Fix up -fcompare-debug issue in the combiner [PR104544]Jakub Jelinek2-1/+22
On the following testcase on aarch64-linux, we behave differently with -g and -g0. The problem is that on: (insn 10011 10010 10012 2 (set (reg:CC 66 cc) (compare:CC (reg:DI 105) (const_int 0 [0]))) "pr104544.c":18:3 407 {cmpdi} (expr_list:REG_DEAD (reg:DI 105) (nil))) (insn 10012 10011 10013 2 (set (reg:SI 109) (eq:SI (reg:CC 66 cc) (const_int 0 [0]))) "pr104544.c":18:3 444 {aarch64_cstoresi} (expr_list:REG_DEAD (reg:CC 66 cc) (nil))) (insn 10013 10012 10016 2 (set (reg:DI 110) (zero_extend:DI (reg:SI 109))) "pr104544.c":18:3 111 {*zero_extendsidi2_aarch64} (expr_list:REG_DEAD (reg:SI 109) (nil))) (insn 10016 10013 10017 2 (parallel [ (set (reg:CC 66 cc) (compare:CC (const_int 0 [0]) (reg:DI 110))) (set (reg:DI 111) (neg:DI (reg:DI 110))) ]) "pr104544.c":18:3 281 {negdi_carryout} (expr_list:REG_DEAD (reg:DI 110) (nil))) ... (debug_insn 6 5 7 2 (var_location:SI y (debug_expr:SI D#5)) "pr104544.c":18:3 -1 (nil)) (debug_insn 7 6 10033 2 (debug_marker) "pr104544.c":11:3 -1 (nil)) (insn 10033 7 10034 2 (set (reg:DI 117 [ _14 ]) (ior:DI (reg:DI 111) (reg:DI 112))) "pr104544.c":11:6 496 {iordi3} (expr_list:REG_DEAD (reg:DI 112) (expr_list:REG_DEAD (reg:DI 111) (nil)))) we successfully split 3 insns into two: Trying 10011, 10013 -> 10016: 10011: cc:CC=cmp(r105:DI,0) REG_DEAD r105:DI 10013: r110:DI=cc:CC==0 REG_DEAD cc:CC 10016: {cc:CC=cmp(0,r110:DI);r111:DI=-r110:DI;} REG_DEAD r110:DI Failed to match this instruction: (parallel [ (set (reg:CC 66 cc) (compare:CC (reg:DI 105) (const_int 0 [0]))) (set (reg:DI 111) (neg:DI (eq:DI (reg:DI 105) (const_int 0 [0])))) ]) Failed to match this instruction: (parallel [ (set (reg:CC 66 cc) (compare:CC (reg:DI 105) (const_int 0 [0]))) (set (reg:DI 111) (neg:DI (eq:DI (reg:DI 105) (const_int 0 [0])))) ]) Successfully matched this instruction: (set (reg:DI 111) (neg:DI (eq:DI (reg:DI 105) (const_int 0 [0])))) Successfully matched this instruction: (set (reg:CC 66 cc) (compare:CC (reg:DI 105) (const_int 0 [0]))) Successfully matched this instruction: (set (reg:DI 112) (neg:DI (eq:DI (reg:CC 66 cc) (const_int 0 [0])))) allowing combination of insns 10011, 10013 and 10016 original costs 4 + 4 + 4 = 16 replacement costs 4 + 4 = 12 deferring deletion of insn with uid = 10011. but the code that searches forward for insns to update their log links (before the change there is a link from insn 10033 to insn 10016 for pseudo 111) only finds insn 10033 and updates the log link if -g isn't enabled, otherwise it stops earlier because there are debug insns in between. So, with -g LOG_LINKS of 10033 isn't updated, points eventually to NOTE_INSN_DELETED and so we do not attempt to combine 10033 with other insns, while with -g0 we do. The following patch fixes that by instead ignoring debug insns during the searching. We can still check BLOCK_FOR_INSN (insn) on those, because if we notice DEBUG_INSN in a following basic block, necessarily there won't be any further normal insns in the current block after it. 2022-02-16 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/104544 * combine.cc (try_combine): When looking for insn whose links should be updated from i3 to i2, don't stop on debug insns, instead skip over them. * gcc.dg/pr104544.c: New test.
2022-02-16aarch64: Tweak atomic-inst-cas.c optionsRichard Sandiford1-1/+3
atomic-inst-cas.c has code to skip __atomic_compare_exchange_n calls for invalid memory orderings, but -Winvalid-memory-model applies before the dead code is removed (which is the right behaviour IMO). This patch therefore suppresses the warning for this test. gcc/testsuite/ * gcc.target/aarch64/atomic-inst-cas.c: Add -Wno-invalid-memory-model.