aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-10-02Daily bump.GCC Administrator5-1/+66
2022-10-01Fortran: Fix ICE and wrong code for assumed-rank arrays [PR100029, PR100040]José Rui Faustino de Sousa3-21/+85
gcc/fortran/ChangeLog: PR fortran/100040 PR fortran/100029 * trans-expr.cc (gfc_conv_class_to_class): Add code to have assumed-rank arrays recognized as full arrays and fix the type of the array assignment. (gfc_conv_procedure_call): Change order of code blocks such that the free of ALLOCATABLE dummy arguments with INTENT(OUT) occurs first. gcc/testsuite/ChangeLog: PR fortran/100029 * gfortran.dg/PR100029.f90: New test. PR fortran/100040 * gfortran.dg/PR100040.f90: New test.
2022-10-01c++: make some cp_trait_kind switch statements exhaustivePatrick Palka1-6/+25
This replaces the unreachable default case in some cp_trait_kind switches with an exhaustive listing of the trait codes that we don't expect to see, so that when adding a new trait we'll get a helpful -Wswitch warning if we forget to handle the new trait in a relevant switch. gcc/cp/ChangeLog: * semantics.cc (trait_expr_value): Make cp_trait_kind switch statement exhaustive. (finish_trait_expr): Likewise. (finish_trait_type): Likewise.
2022-10-01or1k: Only define TARGET_HAVE_TLS when HAVE_AS_TLSStafford Horne1-0/+2
This was found when testing buildroot with linuxthreads enabled. In this case, the build passes --disable-tls to the toolchain during configuration. After building the OpenRISC toolchain it was still generating TLS code sequences and causing linker failures such as: ..../or1k-buildroot-linux-uclibc-gcc -o gpsd-3.24/gpsctl .... -lusb-1.0 -lm -lrt -lnsl ..../ld: ..../sysroot/usr/lib/libusb-1.0.so: undefined reference to `__tls_get_addr' This patch fixes this by disabling tls for the OpenRISC target when requested via --disable-tls. gcc/ChangeLog: * config/or1k/or1k.cc (TARGET_HAVE_TLS): Only define if HAVE_AS_TLS is defined. Tested-by: Yann E. MORIN <yann.morin@orange.com>
2022-10-01OpenACC: Fix struct-component-kind-1.c testJulian Brown1-1/+1
This patch is a minimal fix for the recently-added struct-component-kind-1.c test (which is currently failing to emit one of the errors it expects in scan output). This fragment was erroneously omitted from the second version of the patch posted previously: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602504.html 2022-10-01 Julian Brown <julian@codesourcery.com> gcc/ * gimplify.cc (omp_group_base): Fix IF_PRESENT (no_create) handling.
2022-10-01Improve Z flag handling on H8Jeff Law2-0/+269
This patch improves handling of the Z bit in the status register in a variety of ways to improve either the code size or code speed on various H8 subtargets. For example, we can test the zero/nonzero status of the upper byte of a 16 bit register using mov.b, we can move the Z or an inverted Z into a QImode register profitably on some subtargets. We can move Z or an inverted Z into the sign bit on the H8/SX profitably, etc. gcc/ * config/h8300/h8300.md (HSI2): New iterator. (eqne_invert): Similarly. * config/h8300/testcompare.md (testhi_upper_z): New pattern. (cmpqi_z, cmphi_z, cmpsi_z): Likewise. (store_z_qi, store_z_i_qi, store_z_hi, store_z_hi_sb): New define_insn_and_splits and/or define_insns. (store_z_hi_neg, store_z_hi_and, store_z_<mode>): Likewise. (store_z_<mode>_neg, store_z_<mode>_and, store_z): Likewise.
2022-09-30c++: loop through array CONSTRUCTORJason Merrill1-1/+5
I noticed that we were ignoring all the special rules for when to use a simple INIT_EXPR for array initialization from a CONSTRUCTOR, because split_nonconstant_init_1 was also passing 1 to the from_array parameter. Arguably that's the real bug, but I think we can be flexible. The test that I noticed this with no longer fails without it. gcc/cp/ChangeLog: * init.cc (build_vec_init): Clear from_array for CONSTRUCTOR initializer.
2022-09-30c++: cast split_nonconstant_init return val to voidJason Merrill1-7/+12
We were already converting the result of expand_vec_init_expr to void; we need to do the same for split_nonconstant_init. The test that I noticed this with no longer fails without it. gcc/cp/ChangeLog: * cp-gimplify.cc (cp_genericize_init): Also convert the result of split_nonconstant_init to void.
2022-09-30Install correct patch version.Jeff Law1-5/+5
gcc/ * tree-ssa-dom.cc (record_edge_info): Install correct version of patch.
2022-09-30Emit discriminators for inlined call sites.Eugene Rozenfeld1-1/+5
This change is based on commit 9fa26998a63d4b22b637ed8702520819e408a694 by Dehao Chen in vendors/google/heads/gcc-4_8. Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: * dwarf2out.cc (add_call_src_coords_attributes): Emit discriminators for inlined call sites.
2022-10-01Daily bump.GCC Administrator9-1/+257
2022-09-30More gimple const/copy propagation opportunitiesJeff Law2-2/+157
While investigating a benchmark for optimization opportunities I came across single block loop which either iterates precisely once or forever. This is an interesting scenario as we can ignore the infinite looping path and treat any PHI nodes as degenerates. So more concretely let's consider this trivial testcase: volatile void abort (void); void foo(int a) { int b = 0; while (1) { if (!a) break; b = 1; } if (b != 0) abort (); } Quick analysis shows that b's initial value is 0 and its value only changes if we enter an infinite loop. So if we get to the test b != 0, the only possible value b could have would be 0 and the test and its true arm can be eliminated. The DOM3 dump looks something like this: ;; basic block 2, loop depth 0, count 118111600 (estimated locally), maybe hot ;; prev block 0, next block 3, flags: (NEW, VISITED) ;; pred: ENTRY [always] count:118111600 (estimated locally) (FALLTHRU,EXECUTABLE) ;; succ: 3 [always] count:118111600 (estimated locally) (FALLTHRU,EXECUTABLE) ;; basic block 3, loop depth 1, count 1073741824 (estimated locally), maybe hot ;; prev block 2, next block 4, flags: (NEW, VISITED) ;; pred: 2 [always] count:118111600 (estimated locally) (FALLTHRU,EXECUTABLE) ;; 3 [89.0% (guessed)] count:955630224 (estimated locally) (FALSE_VALUE,EXECUTABLE) # b_1 = PHI <0(2), 1(3)> if (a_3(D) == 0) goto <bb 4>; [11.00%] else goto <bb 3>; [89.00%] ;; succ: 4 [11.0% (guessed)] count:118111600 (estimated locally) (TRUE_VALUE,EXECUTABLE) ;; 3 [89.0% (guessed)] count:955630224 (estimated locally) (FALSE_VALUE,EXECUTABLE) ;; basic block 4, loop depth 0, count 118111600 (estimated locally), maybe hot ;; prev block 3, next block 5, flags: (NEW, VISITED) ;; pred: 3 [11.0% (guessed)] count:118111600 (estimated locally) (TRUE_VALUE,EXECUTABLE) if (b_1 != 0) goto <bb 5>; [0.00%] else goto <bb 6>; [100.00%] ;; succ: 5 [never] count:0 (precise) (TRUE_VALUE,EXECUTABLE) ;; 6 [always] count:118111600 (estimated locally) (FALSE_VALUE,EXECUTABLE) This is a good representative of what the benchmark code looks like. The primary effect we want to capture is to realize that the test if (b_1 != 0) is always false and optimize it accordingly. In the benchmark, this opportunity is well hidden until after the loop optimizers have completed, so the first chance to capture this case is in DOM3. Furthermore, DOM wants loops normalized with latch blocks/edges. So instead of bb3 looping back to itself, there's an intermediate empty block during DOM. I originally thought this was likely to only affect the benchmark. But when I instrumented the optimization and bootstrapped GCC, much to my surprise there were several hundred similar cases identified in GCC itself. So it's not as benchmark specific as I'd initially feared. Anyway, detecting this in DOM is pretty simple. We detect the infinite loop, including the latch block. Once we've done that, we walk the PHI nodes and attach equivalences to the appropriate outgoing edge. That's all we need to do as the rest of DOM is already prepared to handle equivalences on edges. gcc/ * tree-ssa-dom.cc (single_block_loop_p): New function. (record_edge_info): Also record equivalences for the outgoing edge of a single block loop where the condition is an invariant. gcc/testsuite/ * gcc.dg/infinite-loop.c: New test.
2022-09-30Minor cleanup/prep in DOMJeff Law1-5/+4
It's a bit weird that free_dom_edge_info leaves a dangling pointer in e->aux. Not sure what I was thinking. There's two callers. One wipes e->aux immediately after the call, the other attaches a newly created object immediately after the call. So we can wipe e->aux within the call and simplify one of the two call sites. This is preparatory work for a minor optimization where we want to detect another class of edge equivalences in DOM (until something better is available) and either attach them an existing edge_info structure or create a new one if one doesn't currently exist for a given edge. gcc/ * tree-ssa-dom.cc (free_dom_edge_info): Clear e->aux too. (free_all_edge_infos): Do not clear e->aux here.
2022-09-30Document -fexcess-precision=16 in target.defH.J. Lu1-1/+1
* target.def (TARGET_C_EXCESS_PRECISION): Document -fexcess-precision=16.
2022-09-30Document -fexcess-precision=16 in tm.texiPalmer Dabbelt1-1/+1
I just happened to stuble on this one while trying to sort out the RISC-V bits. gcc/ChangeLog * doc/tm.texi (TARGET_C_EXCESS_PRECISION): Add 16.
2022-09-30RISC-V: Support -fexcess-precision=16Palmer Dabbelt1-0/+1
This fixes f19a327077e ("Support -fexcess-precision=16 which will enable FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 when backend supports _Float16.") on RISC-V targets. gcc/ChangeLog PR target/106815 * config/riscv/riscv.cc (riscv_excess_precision): Add support for EXCESS_PRECISION_TYPE_FLOAT16.
2022-09-30libstdc++: Remove <sstream> dependency from std::bitset::to_ulong() testJonathan Wakely1-12/+1
There's no need to use a stringstream to test the to_ulong() member. This will allow the test to be used in freestanding mode. libstdc++-v3/ChangeLog: * testsuite/20_util/bitset/access/to_ulong.cc: Construct bitset from binary literal instead of using stringstream.
2022-09-30libstdc++: Optimize operator>> for std::bitsetJonathan Wakely1-9/+27
We can improve performance by using a char buffer instead of basic_string. The loop bound already means we can't overflow the buffer, and we don't need to keep writing a null character after every character written to the buffer. We could just use basic_string::resize(N) to zero-init the whole string, then overwrite those chars. But that zero-init of all N chars would be wasted in the case where we are writing to a bitset<N> with large N, but only end up extracting one or two chars from the stream. With this change we just use buffer of uninitialized chars. For a small-ish bitset (currently <= 256) we can improve performance further by using alloca instead of the heap. libstdc++-v3/ChangeLog: * include/std/bitset (operator>>): Use a simple buffer instead of std::basic_string.
2022-09-30libstdc++: Remove non-standard public members in std::bitsetJonathan Wakely1-36/+33
This makes _M_copy_from_ptr, _M_copy_from_string and _M_copy_to_string private, and declares operator<< and operator>> as friends. Also remove the historical _M_copy_from_string and _M_copy_to_string overloads. Those were used before DR 396 was implemented but are not needed now. There are no tests or docs describing them, so I don't think we intend to support them as extensions. libstdc++-v3/ChangeLog: * include/std/bitset (_M_copy_from_ptr, _M_copy_from_string) (_M_copy_to_string): Change access to private. (_M_copy_from_string(const basic_string&, size_t, size_t)): Remove. (_M_copy_to_string(const basic_string&)): Remove.
2022-09-30libstdc++: Fix broken dg-prune-outputJonathan Wakely1-1/+1
The new pattern in the dg-prune-output directive doesn't work. Instead of a messy regex full of leaning toothpicks, just match on the diagnostic text instead of the header paths. libstdc++-v3/ChangeLog: * testsuite/20_util/bind/ref_neg.cc: Fix dg-prune-output directive.
2022-09-30arm, csky: Fix C++ ICEs with _Float16 and __fp16 [PR107080]Jakub Jelinek3-5/+26
On Fri, Sep 30, 2022 at 09:54:49AM -0400, Jason Merrill wrote: > > Note, there is one further problem on aarch64/arm, types with HFmode > > (_Float16 and __fp16) are there mangled as Dh (which is standard > > Itanium mangling: > > ::= Dh # IEEE 754r half-precision floating point (16 bits) > > ::= DF <number> _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits) > > so in theory is also ok, but DF16_ is more specific. Should we just > > change Dh to DF16_ in those backends, or should __fp16 there be distinct > > type from _Float16 where __fp16 would mangle Dh and _Float16 DF16_ ? > > You argued for keeping __float128 separate from _Float128, does the same > argument not apply to this case? Actually, they already were distinct types that just mangled the same. So the same issue that had to be solved on i?86, ia64 and rs6000 for _Float64x vs. long double is a problem on arm and aarch64 with _Float16 vs. __fp16. The following patch fixes it for arm after aarch64 has been changed already before. > > And there is csky, which mangles __fp16 (but only if type's name is __fp16, > > not _Float16) as __fp16, that looks clearly invalid to me as it isn't > > valid in the mangling grammar. So perhaps just nuke csky's mangle_type > > and have it mangled as DF16_ by the generic code? And seems even on csky __fp16 is distinct type from _Float16 (which is a good thing for consistency, these 3 targets are the only ones that have __fp16 type), so instead the patch handles it the same as on arm/aarch64, Dh mangling for __fp16 and DF16_ for _Float16. 2022-09-30 Jakub Jelinek <jakub@redhat.com> PR c++/107080 * config/arm/arm.cc (arm_mangle_type): Mangle just __fp16 as Dh and _Float16 as DF16_. * config/csky/csky.cc (csky_init_builtins): Fix a comment typo. (csky_mangle_type): Mangle __fp16 as Dh and _Float16 as DF16_ rather than mangling __fp16 as __fp16. * g++.target/arm/pr107080.C: New test.
2022-09-30diagnostics: Fix virtual location for -Wuninitialized [PR69543]Lewis Hyatt5-25/+73
Warnings issued for -Wuninitialized have been using the spelling location of the problematic usage, discarding any information on the location of the macro expansion point if such usage was in a macro. This makes the warnings impossible to control reliably with #pragma GCC diagnostic, and also discards useful context in the diagnostic output. There seems to be no need to discard the virtual location information, so this patch fixes that. PR69543 was mostly about _Pragma issues which have been fixed for many years now. The PR remains open because two of the testcases added in response to it still have xfails, but those xfails have nothing to do with _Pragma and rather just with the issue fixed by this patch, so the PR can be closed now as well. The other testcase modified here, pragma-diagnostic-2.c, was explicitly testing for the undesirable behavior that was xfailed in pr69543-3.c. I have adjusted that and also added a new testcase verifying all 3 types of warning that come from tree-ssa-uninit.cc get the proper location information now. gcc/ChangeLog: PR preprocessor/69543 * tree-ssa-uninit.cc (warn_uninit): Stop stripping macro tracking information away from the diagnostic location. (maybe_warn_read_write_only): Likewise. (maybe_warn_operand): Likewise. gcc/testsuite/ChangeLog: PR preprocessor/69543 * c-c++-common/pr69543-3.c: Remove xfail. * c-c++-common/pr69543-4.c: Likewise. * gcc.dg/cpp/pragma-diagnostic-2.c: Adjust test for new behavior. * c-c++-common/pragma-diag-16.c: New test.
2022-09-30aarch64: Fix C++ ICEs with _Float16 and __fp16 [PR107080]Jakub Jelinek2-0/+21
On Fri, Sep 30, 2022 at 09:54:49AM -0400, Jason Merrill wrote: > > Note, there is one further problem on aarch64/arm, types with HFmode > > (_Float16 and __fp16) are there mangled as Dh (which is standard > > Itanium mangling: > > ::= Dh # IEEE 754r half-precision floating point (16 bits) > > ::= DF <number> _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits) > > so in theory is also ok, but DF16_ is more specific. Should we just > > change Dh to DF16_ in those backends, or should __fp16 there be distinct > > type from _Float16 where __fp16 would mangle Dh and _Float16 DF16_ ? > > You argued for keeping __float128 separate from _Float128, does the same > argument not apply to this case? Actually, they already were distinct types that just mangled the same. So the same issue that had to be solved on i?86, ia64 and rs6000 for _Float64x vs. long double is a problem on arm and aarch64 with _Float16 vs. __fp16. The following patch fixes it so far for aarch64. 2022-09-30 Jakub Jelinek <jakub@redhat.com> PR c++/107080 * config/aarch64/aarch64.cc (aarch64_mangle_type): Mangle just __fp16 as Dh and _Float16 as DF16_. * g++.target/aarch64/pr107080.C: New test.
2022-09-30i386, rs6000, ia64, s390: Fix C++ ICEs with _Float64x or _Float128 [PR107080]Jakub Jelinek5-11/+91
The following testcase ICEs on x86 as well as ppc64le (the latter with -mabi=ieeelongdouble), because _Float64x there isn't mangled as DF64x but e or u9__ieee128 instead. Those are the mangling that should be used for the non-standard types with the same mode or for long double, but not for _Float64x. All the 4 mangle_type targhook implementations start with type = TYPE_MAIN_VARIANT (type); so I think it is cleanest to handle it the same in all and return NULL before the switches on mode or whatever other tests. s390 doesn't actually have a bug, but while I was there, having type = TYPE_MAIN_VARIANT (type); if (TYPE_MAIN_VARIANT (type) == long_double_type_node) looked useless to me. Note, there is one further problem on aarch64/arm, types with HFmode (_Float16 and __fp16) are there mangled as Dh (which is standard Itanium mangling: ::= Dh # IEEE 754r half-precision floating point (16 bits) ::= DF <number> _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits) so in theory is also ok, but DF16_ is more specific. Should we just change Dh to DF16_ in those backends, or should __fp16 there be distinct type from _Float16 where __fp16 would mangle Dh and _Float16 DF16_ ? And there is csky, which mangles __fp16 (but only if type's name is __fp16, not _Float16) as __fp16, that looks clearly invalid to me as it isn't valid in the mangling grammar. So perhaps just nuke csky's mangle_type and have it mangled as DF16_ by the generic code? 2022-09-30 Jakub Jelinek <jakub@redhat.com> PR c++/107080 * config/i386/i386.cc (ix86_mangle_type): Always return NULL for float128_type_node or float64x_type_node, don't check float128t_type_node later on. * config/ia64/ia64.cc (ia64_mangle_type): Always return NULL for float128_type_node or float64x_type_node. * config/rs6000/rs6000.cc (rs6000_mangle_type): Likewise. Don't check float128_type_node later on. * config/s390/s390.cc (s390_mangle_type): Don't use TYPE_MAIN_VARIANT on type which was set to TYPE_MAIN_VARIANT a few lines earlier. * g++.dg/cpp23/ext-floating11.C: New test.
2022-09-30testsuite: Windows paths use \ and not /Torbjörn SVENSSON1-1/+1
libstdc++-v3/ChangeLog: * testsuite/20_util/bind/ref_neg.cc: Prune Windows paths too. Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-09-30testsuite: Only run test on target if VMA == LMATorbjörn SVENSSON7-5/+62
Checking that the triplet matches arm*-*-eabi (or msp430-*-*) is not enough to know if the execution will enter an endless loop, or if it will give a meaningful result. As the execution test only work when VMA and LMA are equal, make sure that this condition is met. gcc/ChangeLog: * doc/sourcebuild.texi: Document new vma_equals_lma effective target check. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_vma_equals_lma): New. * c-c++-common/torture/attr-noinit-1.c: Requre VMA == LMA to run. * c-c++-common/torture/attr-noinit-2.c: Likewise. * c-c++-common/torture/attr-noinit-3.c: Likewise. * c-c++-common/torture/attr-persistent-1.c: Likewise. * c-c++-common/torture/attr-persistent-3.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-30testsuite: Do not prefix linker script with "-Wl,"Torbjörn SVENSSON1-1/+1
The linker script should not be prefixed with "-Wl," - it's not an input file and does not interfere with the new dump output filename strategy. gcc/testsuite/ChangeLog: * lib/gcc-defs.exp: Do not prefix linker script with "-Wl,". Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-09-30RISC-V: Add '-m[no]-csr-check' option in gcc.Jiawei3-0/+17
Add -m[no]-csr-check option in gcc part, when enable -mcsr-check option, it will add csr-check in .option section and pass this to assembler. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_file_start): New .option. * config/riscv/riscv.opt: New options. * doc/invoke.texi: New definations.
2022-09-30c++: streamline built-in trait addition processPatrick Palka8-477/+161
Adding a new built-in trait currently involves manual boilerplate consisting of defining an rid enumerator for the identifier as well as a corresponding cp_trait_kind enumerator and handling them in various switch statements, the exact set of which depends on whether the proposed trait yields (and thus is recognized as) a type or an expression. To streamline the process, this patch adds a central cp-trait.def file that tabulates the essential details about each built-in trait (whether it yields a type or an expression, its code, its spelling and its arity) and uses this file to automate away the manual boilerplate. It also migrates all the existing C++-specific built-in traits to use this approach. After this change, adding a new built-in trait just entails declaring it in cp-trait.def and defining its behavior in finish_trait_expr/type (and handling it in diagnose_trait_expr, if it's an expression-yielding trait). gcc/c-family/ChangeLog: * c-common.cc (c_common_reswords): Use cp/cp-trait.def to handle C++ traits. * c-common.h (enum rid): Likewise. gcc/cp/ChangeLog: * constraint.cc (diagnose_trait_expr): Likewise. * cp-objcp-common.cc (names_builtin_p): Likewise. * cp-tree.h (enum cp_trait_kind): Likewise. * cxx-pretty-print.cc (pp_cxx_trait): Likewise. * parser.cc (cp_keyword_starts_decl_specifier_p): Likewise. (cp_parser_primary_expression): Likewise. (cp_parser_trait): Likewise. (cp_parser_simple_type_specifier): Likewise. * cp-trait.def: New file.
2022-09-30testsuite: Colon is reserved on WindowsTorbjörn SVENSSON2-2/+2
The ':' is reserved in filenames on Windows. Without this patch, the test case failes with: .../ben-1_a.C:4:8: error: failed to write compiled module: Invalid argument .../ben-1_a.C:4:8: note: compiled module file is 'partitions/module:import.mod' gcc/testsuite: * g++.dg/modules/ben-1.map: Replace the colon with dash. * g++.dg/modules/ben-1_a.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-30libstdc++: Add missing <bits/stl_algobase.h> include to <bitset>Arsen Arsenović1-0/+2
libstdc++-v3/ChangeLog: * include/std/bitset: Include <bits/stl_algobase.h>.
2022-09-30rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888]Kewen Lin12-4/+194
As PR99888 and its related show, the current support for -fpatchable-function-entry on powerpc ELFv2 doesn't work well with global entry existence. For example, with one command line option -fpatchable-function-entry=3,2, it got below w/o this patch: .LPFE1: nop nop .type foo, @function foo: nop .LFB0: .cfi_startproc .LCF0: 0: addis 2,12,.TOC.-.LCF0@ha addi 2,2,.TOC.-.LCF0@l .localentry foo,.-foo , the assembly is unexpected since the patched nops have no effects when being entered from local entry. This patch is to update the nops patched before and after local entry, it looks like: .type foo, @function foo: .LFB0: .cfi_startproc .LCF0: 0: addis 2,12,.TOC.-.LCF0@ha addi 2,2,.TOC.-.LCF0@l nop nop .localentry foo,.-foo nop PR target/99888 PR target/105649 gcc/ChangeLog: * doc/invoke.texi (option -fpatchable-function-entry): Adjust the documentation for PowerPC ELFv2 ABI dual entry points. * config/rs6000/rs6000-internal.h (rs6000_print_patchable_function_entry): New function declaration. * config/rs6000/rs6000-logue.cc (rs6000_output_function_prologue): Support patchable-function-entry by emitting nops before and after local entry for the function that needs global entry. * config/rs6000/rs6000.cc (rs6000_print_patchable_function_entry): Skip the function that needs global entry till global entry has been emitted. * config/rs6000/rs6000.h (struct machine_function): New bool member global_entry_emitted. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr99888-1.c: New test. * gcc.target/powerpc/pr99888-2.c: New test. * gcc.target/powerpc/pr99888-3.c: New test. * gcc.target/powerpc/pr99888-4.c: New test. * gcc.target/powerpc/pr99888-5.c: New test. * gcc.target/powerpc/pr99888-6.c: New test. * c-c++-common/patchable_function_entry-default.c: Adjust for powerpc_elfv2 to avoid compilation error.
2022-09-30rs6000/test: Adjust pr104992.c with vect_int_mod [PR106516]Kewen Lin2-1/+10
As PR106516 shows, we can get unexpected gimple outputs for function thud on some target which supports modulus operation for vector int. This patch introduces one effective target vect_int_mod for it, then adjusts the test case with it. PR testsuite/106516 gcc/testsuite/ChangeLog: * gcc.dg/pr104992.c: Adjust with vect_int_mod. * lib/target-supports.exp (check_effective_target_vect_int_mod): New effective target.
2022-09-30testsuite: [arm] Relax expected register names in MVE testsChristophe Lyon2-58/+58
These two tests have hardcoded q0 as destination/source of load/store instructions, but this register is actually used only under -mfloat-abi=hard. When using -mfloat-abi=softfp, other registers (eg. q3) can be used to transfer function arguments from core registers to MVE registers, making the expected regexp fail. This small patch replaces q0 with q[0-7] to accept any 'q' register. In several places where we had q[0-9]+, replace it with q[0-7] as MVE only has q0-q7 registers. OK for trunk? gcc/testsuite/ChangeLog: * gcc.target/arm/mve/mve_load_memory_modes.c: Update expected registers. * gcc.target/arm/mve/mve_store_memory_modes.c: Likewise.
2022-09-30tree-optimization/107095 - fix typo in .MASK_STORE DSE handlingRichard Biener1-1/+1
We were using the size of the mask argument rather than the data argument for the ao_ref. PR tree-optimization/107095 * tree-ssa-dse.cc (initialize_ao_ref_for_dse): Use data arg for .MASK_STORE size.
2022-09-30Fortran: Update use_device_ptr for OpenMP 5.1 [PR105318]Tobias Burnus5-27/+215
OpenMP 5.1 added has_device_addr and relaxed the restrictions for use_device_ptr, including processing non-type(c_ptr) arguments as if has_device_addr was used. (There is a semantic difference.) For completeness, the likewise change was done for 'use_device_ptr', where non-type(c_ptr) arguments now use use_device_addr. Finally, a warning for 'device(omp_{initial,invalid}_device)' was silenced on the way as affecting the new testcase. PR fortran/105318 gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Update is_device_ptr restrictions for OpenMP 5.1 and map to has_device_addr where applicable; map use_device_ptr to use_device_addr where applicable. Silence integer-range warning for device(omp_{initial,invalid}_device). libgomp/ChangeLog: * testsuite/libgomp.fortran/is_device_ptr-2.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/is_device_ptr-1.f90: Remove dg-error. * gfortran.dg/gomp/is_device_ptr-2.f90: Likewise. * gfortran.dg/gomp/is_device_ptr-3.f90: Update tree-scan-dump.
2022-09-30Arrange to --disable-shared by default for VxWorksOlivier Hainque2-0/+22
This change makes sure that shared libraries for VxWorks are only built on explicit request, when configured with --enable-shared. As the support to build shared libs gets in very incrementally, this provides us with a robust way to guard the relevant pieces and reduce the risks of accidentally breaking a platform not yet ready for it. 2022-09-30 Olivier Hainque <hainque@adacore.com> * configure.ac (*vxworks*): If enable_shared is not set, set to "no" and add --disable-shared to target and host_configargs. * configure: Regenerate.
2022-09-29c++: reduce redundant TARGET_EXPRJason Merrill3-6/+17
An experiment led me to notice that in some cases we were ending up with TARGET_EXPR initialized by TARGET_EXPR, which isn't useful. The target_expr_needs_replace change won't make a difference in most cases, since cp_genericize_init will have already expanded VEC_INIT_EXPR by the time we consider it, but it is correct. gcc/cp/ChangeLog: * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: Collapse TARGET_EXPR within TARGET_EXPR. * constexpr.cc (cxx_eval_outermost_constant_expr): Avoid adding redundant TARGET_EXPR. * cp-tree.h (target_expr_needs_replace): VEC_INIT_EXPR doesn't.
2022-09-30Daily bump.GCC Administrator9-1/+695
2022-09-29c: C2x noreturn attributeJoseph Myers6-0/+183
C2x adds a standard [[noreturn]] attribute (which can also be spelt [[_Noreturn]] for use with <stdnoreturn.h>), so allowing non-returning functions to be declared in a manner compatible with C++; the _Noreturn function specifier remains available but is marked obsolescent. Implement this attribute. It's more restricted than GNU __attribute__ ((noreturn)) - that allows function pointers but using the standard attribute on a function pointer is a constraint violation. Thus, the attribute gets its own handler that checks for a FUNCTION_DECL before calling the handler for the GNU attribute. Tests for the attribute are based on those for C11 _Noreturn and for other C2x attributes. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c-family/ * c-lex.cc (c_common_has_attribute): Handle noreturn attribute for C. gcc/c/ * c-decl.cc (handle_std_noreturn_attribute): New function. (std_attribute_table): Add _Noreturn and noreturn. gcc/testsuite/ * gcc.dg/c2x-attr-noreturn-1.c, gcc.dg/c2x-attr-noreturn-2.c, gcc.dg/c2x-attr-noreturn-3.c: New tests. * gcc.dg/c2x-has-c-attribute-2.c: Also test __has_c_attribute for noreturn attribute.
2022-09-29Process unsigned overflow relations for plus and minus is range-ops.Andrew MacLeod3-8/+121
If a relation is available, calculate overflow and normal ranges. Then apply as appropriate. gcc/ * range-op.cc (plus_minus_ranges): New. (adjust_op1_for_overflow): New. (operator_plus::op1_range): Use new adjustment. (operator_plus::op2_range): Ditto. (operator_minus::op1_range): Ditto. * value-relation.h (relation_lt_le_gt_ge_p): New. gcc/testsuite/ * gcc.dg/tree-ssa/pr79095.c: Test evrp pass rather than vrp1.
2022-09-29Refine ranges using relations in GORI.Andrew MacLeod2-3/+146
This allows GORI to recognize when a relation passed in applies to the 2 operands of the current statement. Check to see if further range refinement is possible before proceeding. * gimple-range-gori.cc (gori_compute::refine_using_relation): New. (gori_compute::compute_operand1_range): Invoke refine_using_relation when applicable. (gori_compute::compute_operand2_range): Ditto. * gimple-range-gori.h (class gori_compute): Adjust prototypes.
2022-09-29Track value_relations in GORI.Andrew MacLeod4-25/+49
This allows GORI to recognize and pass relations along the calculation chain. This will allow relations between the LHS and the operand being calculated to be utilized in op1_range and op2_range. * gimple-range-gori.cc (ori_compute::compute_operand_range): Create a relation record and pass it along when possible. (gori_compute::compute_operand1_range): Pass relation along. (gori_compute::compute_operand2_range): Ditto. (gori_compute::compute_operand1_and_operand2_range): Ditto. * gimple-range-gori.h (class gori_compute): Adjust prototypes. * gimple-range-op.cc (gimple_range_op_handler::calc_op1): Pass relation to op1_range call. (gimple_range_op_handler::calc_op2): Pass relation to op2_range call. * gimple-range-op.h (class gimple_range_op_handler): Adjust prototypes.
2022-09-29Move class value_relation the header file.Andrew MacLeod2-55/+57
* value-relation.cc (class value_relation): Move to .h file. (value_relation::set_relation): Ditto. (value_relation::value_relation): ditto. * value-relation.h (class value_relation): Move from .cc file. (value_relation::set_relation): Ditto (value_relation::value_relation): Ditto.
2022-09-29Audit op1_range and op2_range for undefined LHS.Andrew MacLeod1-0/+29
If the LHS is undefined, GORI should cease looking. There are numerous places where this happens, and a few potential traps. * range-op.cc (operator_minus::op2_range): Check for undefined. (operator_mult::op1_range): Ditto. (operator_exact_divide::op1_range): Ditto. (operator_lshift::op1_range): Ditto. (operator_rshift::op1_range): Ditto. (operator_cast::op1_range): Ditto. (operator_bitwise_and::op1_range): Ditto. (operator_bitwise_or::op1_range): Ditto. (operator_trunc_mod::op1_range): Ditto. (operator_trunc_mod::op2_range): Ditto. (operator_bitwise_not::op1_range): Ditto. (pointer_or_operator::op1_range): Ditto. (range_op_handler::op1_range): Ditto. (range_op_handler::op2_range): Ditto.
2022-09-29Remove undefined behaviour from testscase.Andrew MacLeod1-1/+1
There was a patch posted to remove the undefined behaviour from this testcase, but it appear to never have been applied. gcc/teststuite/ PR tree-optimization/102892 * gcc.dg/pr102892-1.c: Remove undefined behaviour.
2022-09-29c++: implicit lookup of std::initializer_list [PR102576]Patrick Palka3-2/+17
Here the lookup for the implicit use of std::initializer_list fails because we do it using get_namespace_binding, which isn't import aware. Fix this by using lookup_qualified_name instead. PR c++/102576 gcc/cp/ChangeLog: * pt.cc (listify): Use lookup_qualified_name instead of get_namespace_binding. gcc/testsuite/ChangeLog: * g++.dg/modules/pr102576_a.H: New test. * g++.dg/modules/pr102576_b.C: New test.
2022-09-29c++: fix triviality of class with unsatisfied op=Jason Merrill2-2/+55
cxx20_pair is trivially copyable because it has a trivial copy constructor and only a deleted copy assignment operator; the non-triviality of the unsatisfied copy assignment overload is not considered. gcc/cp/ChangeLog: * class.cc (check_methods): Call constraints_satisfied_p. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/cond-triv3.C: New test.
2022-09-29libstdc++: [_GLIBCXX_INLINE_VERSION] Add gdb pretty print for _GLIBCXX_DEBUGFrançois Dumont1-0/+4
In _GLIBCXX_DEBUG mode containers are in std::__debug namespace but not template parameters. In _GLIBCXX_INLINE_VERSION mode most types are in std::__8 namespace but not std::__debug containers. We need to register specific type printers for this combination. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (add_one_template_type_printer): Register printer for types in std::__debug namespace with template parameters in std::__8 namespace.
2022-09-29Improve comments and INITFINI macro use in vxcrtsutff.cOlivier Hainque1-8/+16
This change augments the comment attached to the use of auto-host.h in vxcrtstuff.c to better describe the reason for including it and for the associated series of #undef directives. It also augments the comment on dso_handle and removes a redundant guard on HAVE_INITFINI_ARRAY_SUPPORT for the shared version of the objects, nested within a section guarded on USE_INITFINI_ARRAY. 2022-09-29 Olivier Hainque <hainque@adacore.com> libgcc/ * config/vxcrtstuff.c: Improve the comment attached to the use of auto-host.h and of __dso_handle. Remove redundant guard on HAVE_INITFINI_ARRAY_SUPPORT within a USE_INITFINI_ARRAY section.