aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-03-04PR modula2/114227 InstallTerminationProcedure does not work with -fisoGaius Mulley4-143/+159
This patch moves the initial/termination user procedure functionality in pim and iso versions of M2RTS into M2Dependent. This ensures that finalization/initialization procedures will always be invoked for both -fiso and -fpim. Prior to this patch M2Dependent called M2RTS for termination procedure cleanup and always invoked the pim M2RTS. gcc/m2/ChangeLog: PR modula2/114227 * gm2-libs-iso/M2RTS.mod (ProcedureChain): Remove. (ProcedureList): Remove. (ExecuteReverse): Remove. (ExecuteTerminationProcedures): Rewrite. (ExecuteInitialProcedures): Rewrite. (AppendProc): Remove. (InstallTerminationProcedure): Rewrite. (InstallInitialProcedure): Rewrite. (InitProcList): Remove. * gm2-libs/M2Dependent.def (InstallTerminationProcedure): New procedure. (ExecuteTerminationProcedures): New procedure. (InstallInitialProcedure): New procedure. (ExecuteInitialProcedures): New procedure. * gm2-libs/M2Dependent.mod (ProcedureChain): New type. (ProcedureList): New type. (ExecuteReverse): New procedure. (ExecuteTerminationProcedures): New procedure. (ExecuteInitialProcedures): New procedure. (AppendProc): New procedure. (InstallTerminationProcedure): New procedure. (InstallInitialProcedure): New procedure. (InitProcList): New procedure. * gm2-libs/M2RTS.mod (ProcedureChain): Remove. (ProcedureList): Remove. (ExecuteReverse): Remove. (ExecuteTerminationProcedures): Rewrite. (ExecuteInitialProcedures): Rewrite. (AppendProc): Remove. (InstallTerminationProcedure): Rewrite. (InstallInitialProcedure): Rewrite. (InitProcList): Remove. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-03-04bpf: add inline memset expansionDavid Faust4-0/+123
Similar to memmove and memcpy, the BPF backend cannot fall back on a library call to implement __builtin_memset, and should always expand calls to it inline if possible. This patch implements simple inline expansion of memset in the BPF backend in a verifier-friendly way. Similar to memcpy and memmove, the size must be an integer constant, as is also required by clang. gcc/ * config/bpf/bpf-protos.h (bpf_expand_setmem): New prototype. * config/bpf/bpf.cc (bpf_expand_setmem): New. * config/bpf/bpf.md (setmemdi): New define_expand. gcc/testsuite/ * gcc.target/bpf/memset-1.c: New test.
2024-03-04Update gcc sv.poJoseph Myers1-147/+149
* sv.po: Update.
2024-03-04combine: Fix recent WORD_REGISTER_OPERATIONS check [PR113010]Jakub Jelinek1-0/+2
On Mon, Mar 04, 2024 at 05:18:39PM +0100, Rainer Orth wrote: > unfortunately, the patch broke Solaris/SPARC bootstrap > (sparc-sun-solaris2.11): > > .../gcc/combine.cc: In function 'rtx_code simplify_comparison(rtx_code, rtx_def**, rtx_def**)': > .../gcc/combine.cc:12101:25: error: '*(unsigned int*)((char*)&inner_mode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))' may be used uninitialized [-Werror=maybe-uninitialized] > 12101 | scalar_int_mode mode, inner_mode, tmode; > | ^~~~~~~~~~ I don't see how it could ever work properly, inner_mode in that spot is just uninitialized. I think we shouldn't worry about paradoxical subregs of non-scalar_int_mode REGs/MEMs and for the scalar_int_mode ones should initialize inner_mode before we use it. Another option would be to use maybe_lt (GET_MODE_PRECISION (GET_MODE (SUBREG_REG (op0))), BITS_PER_WORD) and load_extend_op (GET_MODE (SUBREG_REG (op0))) == ZERO_EXTEND, or set machine_mode smode = GET_MODE (SUBREG_REG (op0)); and use it in those two spots. 2024-03-04 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/113010 * combine.cc (simplify_comparison): Guard the WORD_REGISTER_OPERATIONS check on scalar_int_mode of SUBREG_REG and initialize inner_mode.
2024-03-04arm: Fix a wrong attribute use and remove unused unspecs and iteratorsAndre Vieira3-10/+4
This patch fixes the erroneous use of a mode attribute without a mode iterator in the pattern and removes unused unspecs and iterators. gcc/ChangeLog: * config/arm/iterators.md (supf): Remove VMLALDAVXQ_U, VMLALDAVXQ_P_U, VMLALDAVAXQ_U cases. (VMLALDAVXQ): Remove iterator. (VMLALDAVXQ_P): Likewise. (VMLALDAVAXQ): Likewise. * config/arm/mve.md (mve_vstrwq_p_fv4sf): Replace use of <MVE_VPRED> mode iterator attribute with V4BI mode. * config/arm/unspecs.md (VMLALDAVXQ_U, VMLALDAVXQ_P_U, VMLALDAVAXQ_U): Remove unused unspecs.
2024-03-04arm: Annotate instructions with mve_safe_imp_xlane_predAndre Vieira3-0/+26
This patch annotates some MVE across lane instructions with a new attribute. We use this attribute to let the compiler know that these instructions can be safely implicitly predicated when tail predicating if their operands are guaranteed to have zeroed tail predicated lanes. These instructions were selected because having the value 0 in those lanes or 'tail-predicating' those lanes have the same effect. gcc/ChangeLog: * config/arm/arm.md (mve_safe_imp_xlane_pred): New attribute. * config/arm/iterators.md (mve_vmaxmin_safe_imp): New iterator attribute. * config/arm/mve.md (vaddvq_s, vaddvq_u, vaddlvq_s, vaddlvq_u, vaddvaq_s, vaddvaq_u, vmaxavq_s, vmaxvq_u, vmladavq_s, vmladavq_u, vmladavxq_s, vmlsdavq_s, vmlsdavxq_s, vaddlvaq_s, vaddlvaq_u, vmlaldavq_u, vmlaldavq_s, vmlaldavq_u, vmlaldavxq_s, vmlsldavq_s, vmlsldavxq_s, vrmlaldavhq_u, vrmlaldavhq_s, vrmlaldavhxq_s, vrmlsldavhq_s, vrmlsldavhxq_s, vrmlaldavhaq_s, vrmlaldavhaq_u, vrmlaldavhaxq_s, vrmlsldavhaq_s, vrmlsldavhaxq_s, vabavq_s, vabavq_u, vmladavaq_u, vmladavaq_s, vmladavaxq_s, vmlsdavaq_s, vmlsdavaxq_s, vmlaldavaq_s, vmlaldavaq_u, vmlaldavaxq_s, vmlsldavaq_s, vmlsldavaxq_s): Added mve_safe_imp_xlane_pred.
2024-03-04arm: Add define_attr to to create a mapping between MVE predicated and ↵Stam Markianos-Wright4-305/+625
unpredicated insns This patch adds an attribute to the mve md patterns to be able to identify predicable MVE instructions and what their predicated and unpredicated variants are. This attribute is used to encode the icode of the unpredicated variant of an instruction in its predicated variant. This will make it possible for us to transform VPT-predicated insns in the insn chain into their unpredicated equivalents when transforming the loop into a MVE Tail-Predicated Low Overhead Loop. For example: `mve_vldrbq_z_<supf><mode> -> mve_vldrbq_<supf><mode>`. gcc/ChangeLog: * config/arm/arm.md (mve_unpredicated_insn): New attribute. * config/arm/arm.h (MVE_VPT_PREDICATED_INSN_P): New define. (MVE_VPT_UNPREDICATED_INSN_P): Likewise. (MVE_VPT_PREDICABLE_INSN_P): Likewise. * config/arm/vec-common.md (mve_vshlq_<supf><mode>): Add attribute. * config/arm/mve.md (arm_vcx1q<a>_p_v16qi): Add attribute. (arm_vcx1q<a>v16qi): Likewise. (arm_vcx1qav16qi): Likewise. (arm_vcx1qv16qi): Likewise. (arm_vcx2q<a>_p_v16qi): Likewise. (arm_vcx2q<a>v16qi): Likewise. (arm_vcx2qav16qi): Likewise. (arm_vcx2qv16qi): Likewise. (arm_vcx3q<a>_p_v16qi): Likewise. (arm_vcx3q<a>v16qi): Likewise. (arm_vcx3qav16qi): Likewise. (arm_vcx3qv16qi): Likewise. (@mve_<mve_insn>q_<supf><mode>): Likewise. (@mve_<mve_insn>q_int_<supf><mode>): Likewise. (@mve_<mve_insn>q_<supf>v4si): Likewise. (@mve_<mve_insn>q_n_<supf><mode>): Likewise. (@mve_<mve_insn>q_r_<supf><mode>): Likewise. (@mve_<mve_insn>q_f<mode>): Likewise. (@mve_<mve_insn>q_m_<supf><mode>): Likewise. (@mve_<mve_insn>q_m_n_<supf><mode>): Likewise. (@mve_<mve_insn>q_m_r_<supf><mode>): Likewise. (@mve_<mve_insn>q_m_f<mode>): Likewise. (@mve_<mve_insn>q_int_m_<supf><mode>): Likewise. (@mve_<mve_insn>q_p_<supf>v4si): Likewise. (@mve_<mve_insn>q_p_<supf><mode>): Likewise. (@mve_<mve_insn>q<mve_rot>_<supf><mode>): Likewise. (@mve_<mve_insn>q<mve_rot>_f<mode>): Likewise. (@mve_<mve_insn>q<mve_rot>_m_<supf><mode>): Likewise. (@mve_<mve_insn>q<mve_rot>_m_f<mode>): Likewise. (mve_v<absneg_str>q_f<mode>): Likewise. (mve_<mve_addsubmul>q<mode>): Likewise. (mve_<mve_addsubmul>q_f<mode>): Likewise. (mve_vadciq_<supf>v4si): Likewise. (mve_vadciq_m_<supf>v4si): Likewise. (mve_vadcq_<supf>v4si): Likewise. (mve_vadcq_m_<supf>v4si): Likewise. (mve_vandq_<supf><mode>): Likewise. (mve_vandq_f<mode>): Likewise. (mve_vandq_m_<supf><mode>): Likewise. (mve_vandq_m_f<mode>): Likewise. (mve_vandq_s<mode>): Likewise. (mve_vandq_u<mode>): Likewise. (mve_vbicq_<supf><mode>): Likewise. (mve_vbicq_f<mode>): Likewise. (mve_vbicq_m_<supf><mode>): Likewise. (mve_vbicq_m_f<mode>): Likewise. (mve_vbicq_m_n_<supf><mode>): Likewise. (mve_vbicq_n_<supf><mode>): Likewise. (mve_vbicq_s<mode>): Likewise. (mve_vbicq_u<mode>): Likewise. (@mve_vclzq_s<mode>): Likewise. (mve_vclzq_u<mode>): Likewise. (@mve_vcmp_<mve_cmp_op>q_<mode>): Likewise. (@mve_vcmp_<mve_cmp_op>q_n_<mode>): Likewise. (@mve_vcmp_<mve_cmp_op>q_f<mode>): Likewise. (@mve_vcmp_<mve_cmp_op>q_n_f<mode>): Likewise. (@mve_vcmp_<mve_cmp_op1>q_m_f<mode>): Likewise. (@mve_vcmp_<mve_cmp_op1>q_m_n_<supf><mode>): Likewise. (@mve_vcmp_<mve_cmp_op1>q_m_<supf><mode>): Likewise. (@mve_vcmp_<mve_cmp_op1>q_m_n_f<mode>): Likewise. (mve_vctp<MVE_vctp>q<MVE_vpred>): Likewise. (mve_vctp<MVE_vctp>q_m<MVE_vpred>): Likewise. (mve_vcvtaq_<supf><mode>): Likewise. (mve_vcvtaq_m_<supf><mode>): Likewise. (mve_vcvtbq_f16_f32v8hf): Likewise. (mve_vcvtbq_f32_f16v4sf): Likewise. (mve_vcvtbq_m_f16_f32v8hf): Likewise. (mve_vcvtbq_m_f32_f16v4sf): Likewise. (mve_vcvtmq_<supf><mode>): Likewise. (mve_vcvtmq_m_<supf><mode>): Likewise. (mve_vcvtnq_<supf><mode>): Likewise. (mve_vcvtnq_m_<supf><mode>): Likewise. (mve_vcvtpq_<supf><mode>): Likewise. (mve_vcvtpq_m_<supf><mode>): Likewise. (mve_vcvtq_from_f_<supf><mode>): Likewise. (mve_vcvtq_m_from_f_<supf><mode>): Likewise. (mve_vcvtq_m_n_from_f_<supf><mode>): Likewise. (mve_vcvtq_m_n_to_f_<supf><mode>): Likewise. (mve_vcvtq_m_to_f_<supf><mode>): Likewise. (mve_vcvtq_n_from_f_<supf><mode>): Likewise. (mve_vcvtq_n_to_f_<supf><mode>): Likewise. (mve_vcvtq_to_f_<supf><mode>): Likewise. (mve_vcvttq_f16_f32v8hf): Likewise. (mve_vcvttq_f32_f16v4sf): Likewise. (mve_vcvttq_m_f16_f32v8hf): Likewise. (mve_vcvttq_m_f32_f16v4sf): Likewise. (mve_vdwdupq_m_wb_u<mode>_insn): Likewise. (mve_vdwdupq_wb_u<mode>_insn): Likewise. (mve_veorq_s><mode>): Likewise. (mve_veorq_u><mode>): Likewise. (mve_veorq_f<mode>): Likewise. (mve_vidupq_m_wb_u<mode>_insn): Likewise. (mve_vidupq_u<mode>_insn): Likewise. (mve_viwdupq_m_wb_u<mode>_insn): Likewise. (mve_viwdupq_wb_u<mode>_insn): Likewise. (mve_vldrbq_<supf><mode>): Likewise. (mve_vldrbq_gather_offset_<supf><mode>): Likewise. (mve_vldrbq_gather_offset_z_<supf><mode>): Likewise. (mve_vldrbq_z_<supf><mode>): Likewise. (mve_vldrdq_gather_base_<supf>v2di): Likewise. (mve_vldrdq_gather_base_wb_<supf>v2di_insn): Likewise. (mve_vldrdq_gather_base_wb_z_<supf>v2di_insn): Likewise. (mve_vldrdq_gather_base_z_<supf>v2di): Likewise. (mve_vldrdq_gather_offset_<supf>v2di): Likewise. (mve_vldrdq_gather_offset_z_<supf>v2di): Likewise. (mve_vldrdq_gather_shifted_offset_<supf>v2di): Likewise. (mve_vldrdq_gather_shifted_offset_z_<supf>v2di): Likewise. (mve_vldrhq_<supf><mode>): Likewise. (mve_vldrhq_fv8hf): Likewise. (mve_vldrhq_gather_offset_<supf><mode>): Likewise. (mve_vldrhq_gather_offset_fv8hf): Likewise. (mve_vldrhq_gather_offset_z_<supf><mode>): Likewise. (mve_vldrhq_gather_offset_z_fv8hf): Likewise. (mve_vldrhq_gather_shifted_offset_<supf><mode>): Likewise. (mve_vldrhq_gather_shifted_offset_fv8hf): Likewise. (mve_vldrhq_gather_shifted_offset_z_<supf><mode>): Likewise. (mve_vldrhq_gather_shifted_offset_z_fv8hf): Likewise. (mve_vldrhq_z_<supf><mode>): Likewise. (mve_vldrhq_z_fv8hf): Likewise. (mve_vldrwq_<supf>v4si): Likewise. (mve_vldrwq_fv4sf): Likewise. (mve_vldrwq_gather_base_<supf>v4si): Likewise. (mve_vldrwq_gather_base_fv4sf): Likewise. (mve_vldrwq_gather_base_wb_<supf>v4si_insn): Likewise. (mve_vldrwq_gather_base_wb_fv4sf_insn): Likewise. (mve_vldrwq_gather_base_wb_z_<supf>v4si_insn): Likewise. (mve_vldrwq_gather_base_wb_z_fv4sf_insn): Likewise. (mve_vldrwq_gather_base_z_<supf>v4si): Likewise. (mve_vldrwq_gather_base_z_fv4sf): Likewise. (mve_vldrwq_gather_offset_<supf>v4si): Likewise. (mve_vldrwq_gather_offset_fv4sf): Likewise. (mve_vldrwq_gather_offset_z_<supf>v4si): Likewise. (mve_vldrwq_gather_offset_z_fv4sf): Likewise. (mve_vldrwq_gather_shifted_offset_<supf>v4si): Likewise. (mve_vldrwq_gather_shifted_offset_fv4sf): Likewise. (mve_vldrwq_gather_shifted_offset_z_<supf>v4si): Likewise. (mve_vldrwq_gather_shifted_offset_z_fv4sf): Likewise. (mve_vldrwq_z_<supf>v4si): Likewise. (mve_vldrwq_z_fv4sf): Likewise. (mve_vmvnq_s<mode>): Likewise. (mve_vmvnq_u<mode>): Likewise. (mve_vornq_<supf><mode>): Likewise. (mve_vornq_f<mode>): Likewise. (mve_vornq_m_<supf><mode>): Likewise. (mve_vornq_m_f<mode>): Likewise. (mve_vornq_s<mode>): Likewise. (mve_vornq_u<mode>): Likewise. (mve_vorrq_<supf><mode>): Likewise. (mve_vorrq_f<mode>): Likewise. (mve_vorrq_m_<supf><mode>): Likewise. (mve_vorrq_m_f<mode>): Likewise. (mve_vorrq_m_n_<supf><mode>): Likewise. (mve_vorrq_n_<supf><mode>): Likewise. (mve_vorrq_s<mode>): Likewise. (mve_vorrq_s<mode>): Likewise. (mve_vsbciq_<supf>v4si): Likewise. (mve_vsbciq_m_<supf>v4si): Likewise. (mve_vsbcq_<supf>v4si): Likewise. (mve_vsbcq_m_<supf>v4si): Likewise. (mve_vshlcq_<supf><mode>): Likewise. (mve_vshlcq_m_<supf><mode>): Likewise. (mve_vshrq_m_n_<supf><mode>): Likewise. (mve_vshrq_n_<supf><mode>): Likewise. (mve_vstrbq_<supf><mode>): Likewise. (mve_vstrbq_p_<supf><mode>): Likewise. (mve_vstrbq_scatter_offset_<supf><mode>_insn): Likewise. (mve_vstrbq_scatter_offset_p_<supf><mode>_insn): Likewise. (mve_vstrdq_scatter_base_<supf>v2di): Likewise. (mve_vstrdq_scatter_base_p_<supf>v2di): Likewise. (mve_vstrdq_scatter_base_wb_<supf>v2di): Likewise. (mve_vstrdq_scatter_base_wb_p_<supf>v2di): Likewise. (mve_vstrdq_scatter_offset_<supf>v2di_insn): Likewise. (mve_vstrdq_scatter_offset_p_<supf>v2di_insn): Likewise. (mve_vstrdq_scatter_shifted_offset_<supf>v2di_insn): Likewise. (mve_vstrdq_scatter_shifted_offset_p_<supf>v2di_insn): Likewise. (mve_vstrhq_<supf><mode>): Likewise. (mve_vstrhq_fv8hf): Likewise. (mve_vstrhq_p_<supf><mode>): Likewise. (mve_vstrhq_p_fv8hf): Likewise. (mve_vstrhq_scatter_offset_<supf><mode>_insn): Likewise. (mve_vstrhq_scatter_offset_fv8hf_insn): Likewise. (mve_vstrhq_scatter_offset_p_<supf><mode>_insn): Likewise. (mve_vstrhq_scatter_offset_p_fv8hf_insn): Likewise. (mve_vstrhq_scatter_shifted_offset_<supf><mode>_insn): Likewise. (mve_vstrhq_scatter_shifted_offset_fv8hf_insn): Likewise. (mve_vstrhq_scatter_shifted_offset_p_<supf><mode>_insn): Likewise. (mve_vstrhq_scatter_shifted_offset_p_fv8hf_insn): Likewise. (mve_vstrwq_<supf>v4si): Likewise. (mve_vstrwq_fv4sf): Likewise. (mve_vstrwq_p_<supf>v4si): Likewise. (mve_vstrwq_p_fv4sf): Likewise. (mve_vstrwq_scatter_base_<supf>v4si): Likewise. (mve_vstrwq_scatter_base_fv4sf): Likewise. (mve_vstrwq_scatter_base_p_<supf>v4si): Likewise. (mve_vstrwq_scatter_base_p_fv4sf): Likewise. (mve_vstrwq_scatter_base_wb_<supf>v4si): Likewise. (mve_vstrwq_scatter_base_wb_fv4sf): Likewise. (mve_vstrwq_scatter_base_wb_p_<supf>v4si): Likewise. (mve_vstrwq_scatter_base_wb_p_fv4sf): Likewise. (mve_vstrwq_scatter_offset_<supf>v4si_insn): Likewise. (mve_vstrwq_scatter_offset_fv4sf_insn): Likewise. (mve_vstrwq_scatter_offset_p_<supf>v4si_insn): Likewise. (mve_vstrwq_scatter_offset_p_fv4sf_insn): Likewise. (mve_vstrwq_scatter_shifted_offset_<supf>v4si_insn): Likewise. (mve_vstrwq_scatter_shifted_offset_fv4sf_insn): Likewise. (mve_vstrwq_scatter_shifted_offset_p_<supf>v4si_insn): Likewise. (mve_vstrwq_scatter_shifted_offset_p_fv4sf_insn): Likewise.
2024-03-04doc: update [[gnu::no_dangling]]Marek Polacek1-1/+2
...to offer a more realistic example. gcc/ChangeLog: * doc/extend.texi: Update [[gnu::no_dangling]].
2024-03-04vect: Fix integer overflow calculating maskAndrew Stubbs2-8/+8
The masks and bitvectors were broken when nunits==32 on hosts where int is 32-bit. gcc/ChangeLog: * dojump.cc (do_compare_and_jump): Use full-width integers for shifts. * expr.cc (store_constructor): Likewise. (do_store_flag): Likewise.
2024-03-04Regenerate opt.urlsMark Wielaard8-182/+206
There were several commits that didn't regenerate the opt.urls files. Fixes: 438ef143679e ("rs6000: Neuter option -mpower{8,9}-vector") Fixes: 50c549ef3db6 ("gccrs: enable -Winfinite-recursion warnings by default") Fixes: 25bb8a40abd9 ("Move docs for -Wuse-after-free and -Wuseless-cast") Fixes: 48448055fb70 ("AVR: Support .rodata in Flash for AVR64* and AVR128*") Fixes: 42503cc257fb ("AVR: Document option -mskip-bug") Fixes: 7de5bb642c12 ("i386: [APX] Document inline asm behavior and new switch") Fixes: 49a14ee488b8 ("Add -mevex512 into invoke.texi") Fixes: 4666cbde5e6d ("Sort warning options in c-family/c.opt.") Fixes: cda383616183 ("AVR: target/114100 - Better indirect accesses for reduced Tiny") gcc/c-family/ChangeLog: * c.opt.urls: Regenerate. gcc/ChangeLog: * common.opt.urls: Regenerate. * config/avr/avr.opt.urls: Likewise. * config/i386/i386.opt.urls: Likewise. * config/pru/pru.opt.urls: Likewise. * config/riscv/riscv.opt.urls: Likewise. * config/rs6000/rs6000.opt.urls: Likewise. gcc/rust/ChangeLog: * lang.opt.urls: Regenerate.
2024-03-04Fix 201001011-1.c on H8Jan Dubiec1-0/+3
Excerpt from gcc.sum: [...] PASS: gcc.c-torture/execute/20101011-1.c -O0 (test for excess errors) FAIL: gcc.c-torture/execute/20101011-1.c -O0 execution test PASS: gcc.c-torture/execute/20101011-1.c -O1 (test for excess errors) FAIL: gcc.c-torture/execute/20101011-1.c -O1 execution test [ ... ] This is because H8 MCUs do not throw a "divide by zero" exception. gcc/testsuite * gcc.c-torture/execute/20101011-1.c: Do not test on H8 series.
2024-03-04tree-optimization/114197 - unexpected if-conversion for vectorizationRichard Biener2-4/+34
The following avoids lowering a volatile bitfiled access and in case the if-converted and original loops end up in different outer loops because of simplifcations enabled scrap the result since that is not how the vectorizer expects the loops to be laid out. PR tree-optimization/114197 * tree-if-conv.cc (bitfields_to_lower_p): Do not lower if there are volatile bitfield accesses. (pass_if_conversion::execute): Throw away result if the if-converted and original loops are not nested as expected. * gcc.dg/torture/pr114197.c: New testcase.
2024-03-04tree-optimization/114164 - unsupported SIMD clone call, unsupported VEC_CONDRichard Biener1-0/+10
The following avoids creating unsupported VEC_COND_EXPRs as part of SIMD clone call mask argument setup during vectorization which results in inefficient decomposing of the operation during vector lowering. PR tree-optimization/114164 * tree-vect-stmts.cc (vectorizable_simd_clone_call): Fail if the code generated for mask argument setup is not supported.
2024-03-04Ensure TupleStructPattern and TuplePattern have itemsOwen Avery6-54/+26
Note that instances of both classes which have been moved from will have (items == nullptr). gcc/rust/ChangeLog: * ast/rust-pattern.h (class TupleStructPattern): Assert that items != nullptr. (class TuplePattern): Likewise. (TupleStructPattern::has_items): Remove. (TuplePattern::has_tuple_pattern_items): Likewise. * parse/rust-parse-impl.h (Parser::parse_ident_leading_pattern): Prevent construction of TupleStructPattern with (items == nullptr). (Parser::parse_pattern_no_alt): Likewise. * ast/rust-ast-collector.cc (TokenCollector::visit): Remove usage of TupleStructPattern::has_items. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/pattern-struct.rs: Fix test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-03-04Add curly brackets, formatted clangjjasmine1-5/+12
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
2024-03-04Add error emitting when we can't resolve id exprjjasmine1-1/+4
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
2024-03-04tree-optimization/114203 - wrong CLZ niter computationRichard Biener2-4/+24
For precision less than int we apply the adjustment to make it defined at zero after the adjustment to make it compute CLZ rather than CTZ. That's wrong. PR tree-optimization/114203 * tree-ssa-loop-niter.cc (build_cltz_expr): Apply CTZ->CLZ adjustment before making the result defined at zero. * gcc.dg/torture/pr114203.c: New testcase.
2024-03-04tree-optimization/114192 - scalar reduction kept live with early break vectRichard Biener1-14/+26
The following fixes a missing replacement of the reduction value used in the epilog, causing the scalar reduction to be kept live across the early break exit path. PR tree-optimization/114192 * tree-vect-loop.cc (vect_create_epilog_for_reduction): Use the appropriate def for the live out stmt in case of an alternate exit.
2024-03-04bitint: Fix tree node sharing bug [PR114209]Jakub Jelinek2-2/+20
We ICE on the following testcase due to invalid tree sharing. The second hunk fixes that, the first one is from me looking around at other spots which might need end up with invalid tree sharing too. 2024-03-04 Jakub Jelinek <jakub@redhat.com> PR middle-end/114209 * gimple-lower-bitint.cc (bitint_large_huge::limb_access): Call unshare_expr when creating a MEM_REF from MEM_REF. (bitint_large_huge::lower_stmt): Call unshare_expr. * gcc.dg/bitint-97.c: New test.
2024-03-04testsuite: Make pr104992.c irrelated to target vector feature [PR113418]Xi Ruoyao2-16/+2
The vect_int_mod target selector is evaluated with the options in DEFAULT_VECTCFLAGS in effect, but these options are not automatically passed to tests out of the vect directories. So this test fails on targets where integer vector modulo operation is supported but requiring an option to enable, for example LoongArch. In this test case, the only expected optimization not happened in original is in corge because it needs forward propogation. So we can scan the forwprop2 dump (where the vector operation is not expanded to scalars yet) instead of optimized, then we don't need to consider vect_int_mod or not. gcc/testsuite/ChangeLog: PR testsuite/113418 * gcc.dg/pr104992.c (dg-options): Use -fdump-tree-forwprop2 instead of -fdump-tree-optimized. (dg-final): Scan forwprop2 dump instead of optimized, and remove the use of vect_int_mod. * lib/target-supports.exp (check_effective_target_vect_int_mod): Remove because it's not used anymore.
2024-03-04i386: Fix ICEs with SUBREGs from vector etc. constants to XFmode [PR114184]Jakub Jelinek2-0/+36
The Intel extended format has the various weird number categories, pseudo denormals, pseudo infinities, pseudo NaNs and unnormals. Those are not representable in the GCC real_value and so neither GIMPLE nor RTX VIEW_CONVERT_EXPR/SUBREG folding folds those into constants. As can be seen on the following testcase, because it isn't folded (since GCC 12, before that we were folding it) we can end up with a SUBREG of a CONST_VECTOR or similar constant, which isn't valid general_operand, so we ICE during vregs pass trying to recognize the move instruction. Initially I thought it is a middle-end bug, the movxf instruction has general_operand predicate, but the middle-end certainly never tests that predicate, seems moves are special optabs. And looking at other mov optabs, e.g. for vector modes the i386 patterns use nonimmediate_operand predicate on the input, yet ix86_expand_vector_move deals with CONSTANT_P and SUBREG of CONSTANT_P arguments which if the predicate was checked couldn't ever make it through. The following patch handles this case similarly to the ix86_expand_vector_move's SUBREG of CONSTANT_P case, does it just for XFmode because I believe that is the only mode that needs it from the scalar ones, others should just be folded. 2024-03-04 Jakub Jelinek <jakub@redhat.com> PR target/114184 * config/i386/i386-expand.cc (ix86_expand_move): If XFmode op1 is SUBREG of CONSTANT_P, force the SUBREG_REG into memory or register. * gcc.target/i386/pr114184.c: New test.
2024-03-04PR target/114187: Fix ?Fmode SUBREG simplification in simplify_subreg.Roger Sayle2-1/+14
This patch fixes PR target/114187 a typo/missed-optimization in simplify-rtx that's exposed by (my) changes to x86_64's parameter passing. The context is that construction of double word (TImode) values now uses the idiom: (ior:TI (ashift:TI (zero_extend:TI (reg:DI x)) (const_int 64 [0x40])) (zero_extend:TI (reg:DI y))) Extracting the DImode highpart and lowpart halves of this complex expression is supported by simplications in simplify_subreg. The problem is when the doubleword TImode value represents two DFmode fields, there isn't a direct simplification to extract the highpart or lowpart SUBREGs, but instead GCC uses two steps, extract the DImode {high,low} part and then cast the result back to a floating point mode, DFmode. The (buggy) code to do this is: /* If the outer mode is not integral, try taking a subreg with the equivalent integer outer mode and then bitcasting the result. Other simplifications rely on integer to integer subregs and we'd potentially miss out on optimizations otherwise. */ if (known_gt (GET_MODE_SIZE (innermode), GET_MODE_SIZE (outermode)) && SCALAR_INT_MODE_P (innermode) && !SCALAR_INT_MODE_P (outermode) && int_mode_for_size (GET_MODE_BITSIZE (outermode), 0).exists (&int_outermode)) { rtx tem = simplify_subreg (int_outermode, op, innermode, byte); if (tem) return simplify_gen_subreg (outermode, tem, int_outermode, byte); } The issue/mistake is that the second call, to simplify_subreg, shouldn't use "byte" as the final argument; the offset has already been handled by the first call, to simplify_subreg, and this second call is just a type conversion from an integer mode to floating point (from DImode to DFmode). Interestingly, this mistake was already spotted by Richard Sandiford when the optimization was originally contributed in January 2023. https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610920.html >> Richard Sandiford writes: >> Also, the final line should pass 0 rather than byte. Unfortunately a miscommunication/misunderstanding in a later thread https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612898.html resulted in this correction being undone. Using lowpart_subreg should avoid/reduce confusion in future. 2024-03-03 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR target/114187 * simplify-rtx.cc (simplify_context::simplify_subreg): Call lowpart_subreg to perform type conversion, to avoid confusion over the offset to use in the call to simplify_reg_subreg. gcc/testsuite/ChangeLog PR target/114187 * g++.target/i386/pr114187.C: New test case.
2024-03-04Daily bump.GCC Administrator4-1/+94
2024-03-03d: Merge upstream dmd, druntime f8bae04558, phobos ba2ade9decIain Buclaw30-570/+644
D front-end changes: - Import dmd v2.108.1-beta-1. D runtime changes: - Import druntime v2.108.1-beta-1. Phobos changes: - Import phobos v2.108.1-beta-1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd f8bae04558. * dmd/VERSION: Bump version to v2.108.0-beta.1. * d-builtins.cc (build_frontend_type): Update for new front-end interface. * d-codegen.cc (build_assert_call): Likewise. * d-convert.cc (d_array_convert): Likewise. * decl.cc (get_vtable_decl): Likewise. * expr.cc (ExprVisitor::visit (EqualExp *)): Likewise. (ExprVisitor::visit (VarExp *)): Likewise. (ExprVisitor::visit (ArrayLiteralExp *)): Likewise. (ExprVisitor::visit (AssocArrayLiteralExp)): Likewise. * intrinsics.cc (build_shuffle_mask_type): Likewise. (maybe_warn_intrinsic_mismatch): Likewise. * runtime.cc (get_libcall_type): Likewise. * typeinfo.cc (TypeInfoVisitor::layout_string): Likewise. (TypeInfoVisitor::visit(TypeInfoTupleDeclaration *)): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 02d6d07a69. * src/MERGE: Merge upstream phobos a2ade9dec.
2024-03-03[PATCH] combine: Don't simplify paradoxical SUBREG on ↵Greg McGary2-2/+22
WORD_REGISTER_OPERATIONS [PR113010] The sign-bit-copies of a sign-extending load cannot be known until runtime on WORD_REGISTER_OPERATIONS targets, except in the case of a zero-extending MEM load. See the fix for PR112758. gcc/ PR rtl-optimization/113010 * combine.cc (simplify_comparison): Simplify a SUBREG on WORD_REGISTER_OPERATIONS targets only if it is a zero-extending MEM load. gcc/testsuite * gcc.c-torture/execute/pr113010.c: New test.
2024-03-03AVR: Use more C++ ish coding style.Georg-Johann Lay5-295/+202
gcc/ * config/avr/avr.cc: Resolve ATTRIBUTE_UNUSED. Use bool in place of int for boolean logic (if possible). Move declarations to definitions (if possible). * config/avr/avr.md: Use C++ comments. Fix some indentation glitches. * config/avr/avr-dimode.md: Same. * config/avr/constraints.md: Same. * config/avr/predicates.md: Same.
2024-03-03alpha: Introduce UMUL_HIGHPART rtx_code [PR113720]Uros Bizjak1-34/+3
umuldi3_highpart expander does: if (REG_P (operands[2])) operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]); on register_operand predicate, which also allows SUBREG RTX. So, subregs were emitted without ZERO_EXTEND RTX. But nowadays we have UMUL_HIGHPART that allows us to fix this issue while also simplifying the instruction RTX. PR target/113720 gcc/ChangeLog: * config/alpha/alpha.md (umuldi3_highpart): Remove expander. (*umuldi3_highpart_reg): Rename to umuldi3_highpart and simplify insn RTX using UMUL_HIGHPART rtx_code. (*umuldi3_highpart_const): Remove.
2024-03-03AVR: ad target/114100 - Don't print unused frame pointer adjustments.Georg-Johann Lay2-16/+21
Without -mfuse-add, when fake reg+offset addressing is used, the output routines are saving some instructions when the base reg is unused after. This patch adds that optimization for the case when the base is the frame pointer and the frame pointer adjustments are split away from the move insn by -mfuse-add in .split2. Direct usage of reg_unused_after is not possible because that function looks at the destination of the current insn, which won't work for offsetting the frame pointer in printing PLUS code. It can use an extended version of _reg_unused_after though. gcc/ PR target/114100 * config/avr/avr-protos.h (_reg_unused_after): Remove proto. * config/avr/avr.cc (_reg_unused_after): Make static. And add 3rd argument to skip the current insn. (reg_unused_after): Adjust call of reg_unused_after. (avr_out_plus_1) [AVR_TINY && -mfuse-add >= 2]: Don't output unneeded frame pointer adjustments.
2024-03-03AVR: ad target/92792 - Remove insn attribute "cc" and its (dead) uses.Georg-Johann Lay3-51/+16
The backend has remains of cc0 condition code. Unfortunately, all that information is useless with CCmode, and their use was removed with the removal of NOTICE_UPDATE_CC in PR92729 with r12-226 and r12-327. gcc/ PR target/92729 * config/avr/avr.md (define_attr "cc"): Remove. * config/avr/avr-protos.h (avr_out_plus): Remove pcc argument from prototype. * config/avr/avr.cc (avr_out_plus_1): Remove pcc argument and its uses. Add insn argument. (avr_out_plus_symbol): Remove pcc argument and its uses. (avr_out_plus): Remove pcc argument and its uses. Adjust calls of avr_out_plus_symbol and avr_out_plus_1. (avr_out_round): Adjust call of avr_out_plus.
2024-03-03AVR: Fix a typo in avr.cc.Georg-Johann Lay1-2/+3
gcc/ * config/avr/avr.cc (avr_init_cumulative_args): Fix a typo from r14-9273.
2024-03-03SH: Fix 101737Oleg Endo1-1/+2
gcc/ChangeLog: PR target/101737 * config/sh/sh.cc (sh_is_nott_insn): Handle case where the input is not an insn, but e.g. a code label.
2024-03-03d: Fix gdc -O2 -mavx generates misaligned vmovdqa instruction [PR114171]Iain Buclaw2-0/+30
PR d/114171 gcc/d/ChangeLog: * d-codegen.cc (lower_struct_comparison): Keep alignment of original type in reinterpret cast for comparison. gcc/testsuite/ChangeLog: * gdc.dg/torture/pr114171.d: New test.
2024-03-03Daily bump.GCC Administrator2-1/+17
2024-03-02AVR: Use REG_<n> constants instead of magic numbers <n>.Georg-Johann Lay2-39/+52
There are some places where avr.cc uses magic numbers like 17 that are actually register numbers. This patch defines constants like REG_17 and uses them instead of the magic numbers when a register number is meant. gcc/ * config/avr/avr.md (REG_0, ... REG_36): New define_constants. * config/avr/avr.cc: Use them instead of magic numbers when it means a register number.
2024-03-02AVR: Adjust some comments.Georg-Johann Lay1-10/+18
gcc/ * config/avr/avr.cc: Adjust some comments.
2024-03-02AVR: target/114100 - Factor in -mtiny-stack in frame pointer adjustmentsGeorg-Johann Lay1-5/+8
gcc/ PR target/114100 * config/avr/avr.cc (avr_out_plus_1) [-mtiny-stack]: Only adjust the low part of the frame pointer with 8-bit stack pointer.
2024-03-02Daily bump.GCC Administrator5-1/+1630
2024-03-01c++/modules: depending local enums [PR104919, PR106009]Patrick Palka6-16/+45
For local enums defined in a non-template function or a function template instantiation it seems we neglect to make the function depend on the enum definition (which modules considers logically separate), which ultimately causes the enum definition to not be properly streamed before uses within the function definition are streamed. The code responsible for noting such dependencies is gcc/cp/module.cc @@ -8784,17 +8784,6 @@ trees_out::decl_node (tree decl, walk_kind ref) depset *dep = NULL; if (streaming_p ()) dep = dep_hash->find_dependency (decl); ! else if (TREE_CODE (ctx) != FUNCTION_DECL ! || TREE_CODE (decl) == TEMPLATE_DECL ! || (dep_hash->sneakoscope && DECL_IMPLICIT_TYPEDEF_P (decl)) ! || (DECL_LANG_SPECIFIC (decl) ! && DECL_MODULE_IMPORT_P (decl))) ! { ! auto kind = (TREE_CODE (decl) == NAMESPACE_DECL ! && !DECL_NAMESPACE_ALIAS (decl) ! ? depset::EK_NAMESPACE : depset::EK_DECL); ! dep = dep_hash->add_dependency (decl, kind); ! } if (!dep) { and the condition there notably excludes local TYPE_DECLs from a non-template-pattern function (when streaming a template pattern we'll see be dealing with the corresponding TEMPLATE_DECL of the local TYPE_DECL here, so we'll add the dependency). Local classes on the other hand seem to work properly, but perhaps by accident: with a local class we end up making the function depend on the injected-class-name of the local class rather than the local class as a whole because the injected-class-name satisfies the criteria (since its context is the local class, not the function). The 'sneakoscope' flag is set when walking a function declaration and its purpose seems to be to catch a local type that escapes the function via a deduced return type (so called voldemort types) and note a dependency on them. But there seems to be no reason to restrict this behavior to voldemort types, and indeed consistently noting the dependency for all local types fixes these PRs (almost). So this patch gets rid of this flag and enables the dependency tracking unconditionally. This was nearly enough to make things work, except we now ran into issues with the local TYPE_/CONST_DECL copies from the pre-gimplified version of a constexpr function body during streaming. Rather than making modules cope with this, it occurred to me that we don't need to make copies of local types when saving the pre-gimplified body (and when making further copies thereof); only VAR_DECLs etc need to be copied (so that we don't conflate local variables from different recursive calls to the same function during constexpr evaluation). So this patch adjusts copy_fn accordingly. PR c++/104919 PR c++/106009 gcc/cp/ChangeLog: * module.cc (depset::hash::sneakoscope): Remove. (trees_out::decl_node): Always add a dependency on a local type. (depset::hash::find_dependencies): Remove sneakoscope stuff. gcc/ChangeLog: * tree-inline.cc (remap_decl): Handle copy_decl returning the original decl. (remap_decls): Handle remap_decl returning the original decl. (copy_fn): Adjust copy_decl callback to skip TYPE_DECL and CONST_DECL. gcc/testsuite/ChangeLog: * g++.dg/modules/tdef-7.h: Remove outdated comment. * g++.dg/modules/tdef-7_b.C: Don't expect two TYPE_DECLs. * g++.dg/modules/enum-13_a.C: New test. * g++.dg/modules/enum-13_b.C: New test.
2024-03-02c++: Stream definitions for implicit instantiations [PR114170]Nathaniel Shead3-3/+26
An implicit instantiation has an initializer depending on whether DECL_INITIALIZED_P is set (like normal VAR_DECLs) which needs to be written to ensure that consumers of header modules properly emit definitions for these instantiations. This patch ensures that we correctly fallback to checking this flag when DECL_INITIAL is not set for a template instantiation. For variables with non-trivial dynamic initialization, DECL_INITIAL can be empty after 'split_nonconstant_init' but DECL_INITIALIZED_P is still set; we need to check the latter to determine if we need to go looking for a definition to emit (often in 'static_aggregates' here). This is the case in the linked testcase. However, for template specialisations (not instantiations?) we primarily care about DECL_INITIAL; if the variable has initialization depending on a template parameter then we'll need to emit that definition even though it doesn't yet have DECL_INITIALIZED_P set; this is the case in e.g. template <int N> int value = N; As a drive-by fix, also ensures that the count of initializers matches the actual number of initializers written. This doesn't seem to be necessary for correctness in the current testsuite, but feels wrong and makes debugging harder when initializers aren't properly written for other reasons. PR c++/114170 gcc/cp/ChangeLog: * module.cc (has_definition): Fall back to DECL_INITIALIZED_P when DECL_INITIAL is not set on a template. (module_state::write_inits): Only increment count when initializers are actually written. gcc/testsuite/ChangeLog: * g++.dg/modules/var-tpl-2_a.H: New test. * g++.dg/modules/var-tpl-2_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2024-03-02c++: Ensure DECL_CONTEXT is set for temporary vars [PR114005]Nathaniel Shead3-1/+16
Modules streaming requires DECL_CONTEXT to be set for anything streamed. This patch ensures that 'create_temporary_var' does set a DECL_CONTEXT for these variables (such as the backing storage for initializer_lists) even if not inside a function declaration. PR c++/114005 gcc/cp/ChangeLog: * init.cc (create_temporary_var): Use current_scope instead of current_function_decl. gcc/testsuite/ChangeLog: * g++.dg/modules/pr114005_a.C: New test. * g++.dg/modules/pr114005_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2024-03-01[14 regression] Fix insn types in risc-v portJeff Law8-21/+21
So one of the broad goals we've had over the last few months has been to ensure that every insn has a scheduling type and that every insn is associated with an insn reservation in the scheduler. This avoids some amazingly bad behavior in the scheduler. I won't go through the gory details. I was recently analyzing a code quality regression with dhrystone (ugh!) and one of the issues was poor scheduling which lengthened the lifetime of a pseudo and ultimately resulted in needing an additional callee saved register save/restore. This was ultimately tracked down incorrect types on a few patterns. So I did an audit of all the patterns that had types added/changed as part of this effort and found a variety of problems, primarily in the various move patterns and extension patterns. This is a regression relative to gcc-13. Naturally the change in types affects scheduling, which in turn changes the precise code we generate and causes some testsuite fallout. I considered updating the regexps since the change in the resulting output is pretty consistent. But of course the test would still be sensitive to things like load latency. So instead I just turned off the 2nd phase scheduler in the affected tests. Bootstrapped and regression tested on rv64gc-linux-gnu. gcc * config/riscv/riscv.md (zero_extendqi<SUPERQI:mode>2_internal): Fix type attribute. (extendsidi2_internal, movhf_hardfloat, movhf_softfloat): Likewise. (movdi_32bit, movdi_64bit, movsi_internal): Likewise. (movhi_internal, movqi_internal): Likewise. (movsf_softfloat, movsf_hardfloat): Likewise. (movdf_hardfloat_rv32, movdf_hardfloat_rv64): Likewise. (movdf_softfloat): Likewise. gcc/testsuite * gcc.target/riscv/rvv/autovec/vls/calling-convention-1.c: Turn off second phase scheduler. * gcc.target/riscv/rvv/autovec/vls/calling-convention-2.c: Likewise. * gcc.target/riscv/rvv/autovec/vls/calling-convention-3.c: Likewise. * gcc.target/riscv/rvv/autovec/vls/calling-convention-4.c: Likewise. * gcc.target/riscv/rvv/autovec/vls/calling-convention-5.c: Likewise. * gcc.target/riscv/rvv/autovec/vls/calling-convention-6.c: Likewise. * gcc.target/riscv/rvv/autovec/vls/calling-convention-7.c: Likewise.
2024-03-01c++/modules: complete_vars ICE with non-exported constexpr varPatrick Palka3-0/+18
Here after stream-in of the non-exported constexpr global 'A a' we call maybe_register_incomplete_var, which we'd expect to be a no-op here but it manages to take its second branch and pushes {a, NULL_TREE} onto incomplete_vars. Later after defining B we ICE from complete_vars due to this pushed NULL_TREE class context. Judging by the two commits that introduced/modified this part of maybe_register_incomplete_var, r196852 and r214333, it seems this second branch is only concerned with constexpr static data members (whose initializer may contain a pointer-to-member for a not-yet-complete class) So this patch restricts this branch accordingly so it's not inadvertently taken during stream-in. gcc/cp/ChangeLog: * decl.cc (maybe_register_incomplete_var): Restrict second branch to static data members from a not-yet-complete class. gcc/testsuite/ChangeLog: * g++.dg/modules/cexpr-4_a.C: New test. * g++.dg/modules/cexpr-4_b.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-03-01c++: implement [[gnu::no_dangling]] [PR110358]Marek Polacek13-6/+401
Since -Wdangling-reference has false positives that can't be prevented, we should offer an easy way to suppress the warning. Currently, that is only possible by using a #pragma, either around the enclosing class or around the call site. But #pragma GCC diagnostic tend to be onerous. A better solution would be to have an attribute. To that end, this patch adds a new attribute, [[gnu::no_dangling]]. This attribute takes an optional bool argument to support cases like: template <typename T> struct [[gnu::no_dangling(std::is_reference_v<T>)]] S { // ... }; PR c++/110358 PR c++/109642 gcc/cp/ChangeLog: * call.cc (no_dangling_p): New. (reference_like_class_p): Use it. (do_warn_dangling_reference): Use it. Don't warn when the function or its enclosing class has attribute gnu::no_dangling. * tree.cc (cxx_gnu_attributes): Add gnu::no_dangling. (handle_no_dangling_attribute): New. gcc/ChangeLog: * doc/extend.texi: Document gnu::no_dangling. * doc/invoke.texi: Mention that gnu::no_dangling disables -Wdangling-reference. gcc/testsuite/ChangeLog: * g++.dg/ext/attr-no-dangling1.C: New test. * g++.dg/ext/attr-no-dangling2.C: New test. * g++.dg/ext/attr-no-dangling3.C: New test. * g++.dg/ext/attr-no-dangling4.C: New test. * g++.dg/ext/attr-no-dangling5.C: New test. * g++.dg/ext/attr-no-dangling6.C: New test. * g++.dg/ext/attr-no-dangling7.C: New test. * g++.dg/ext/attr-no-dangling8.C: New test. * g++.dg/ext/attr-no-dangling9.C: New test.
2024-03-01testsuite: ctf: make array in ctf-file-scope-1 fixed lengthDavid Faust1-1/+1
The array member of struct SFOO in the ctf-file-scope-1 caused the test to fail for the BPF target, since BPF does not support dynamic stack allocation. The array does not need to variable length for the sake of the test, so make it fixed length instead to allow the test to run successfully for the bpf-unknown-none target. gcc/testsuite/ * gcc.dg/debug/ctf/ctf-file-scope-1.c (SFOO): Make array member fixed-length.
2024-03-01Fortran: improve checks of NULL without MOLD as actual argument [PR104819]Harald Anlauf5-8/+79
gcc/fortran/ChangeLog: PR fortran/104819 * check.cc (gfc_check_null): Handle nested NULL()s. (is_c_interoperable): Check for MOLD argument of NULL() as part of the interoperability check. * interface.cc (gfc_compare_actual_formal): Extend checks for NULL() actual arguments for presence of MOLD argument when required by Interp J3/22-146. gcc/testsuite/ChangeLog: PR fortran/104819 * gfortran.dg/assumed_rank_9.f90: Adjust testcase use of NULL(). * gfortran.dg/pr101329.f90: Adjust testcase to conform to interp. * gfortran.dg/null_actual_4.f90: New test.
2024-03-01c++: auto(x) partial substitution [PR110025, PR114138]Patrick Palka6-2/+142
In r12-6773-g09845ad7569bac we gave CTAD placeholders a level of 0 and ensured we never replaced them via tsubst. It turns out that autos representing an explicit cast need the same treatment and for the same reason: such autos appear in an expression context and so their level gets easily messed up after partial substitution, leading to premature replacement via an incidental tsubst instead of via do_auto_deduction. This patch fixes this by extending the r12-6773 approach to auto(x). PR c++/110025 PR c++/114138 gcc/cp/ChangeLog: * cp-tree.h (make_cast_auto): Declare. * parser.cc (cp_parser_functional_cast): If the type is an auto, replace it with a level-less one via make_cast_auto. * pt.cc (find_parameter_packs_r): Don't treat level-less auto as a type parameter pack. (tsubst) <case TEMPLATE_TYPE_PARM>: Generalize CTAD placeholder auto handling to all level-less autos. (make_cast_auto): Define. (do_auto_deduction): Handle replacement of a level-less auto. gcc/testsuite/ChangeLog: * g++.dg/cpp23/auto-fncast16.C: New test. * g++.dg/cpp23/auto-fncast17.C: New test. * g++.dg/cpp23/auto-fncast18.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-03-01AVR: Overhaul help screenGeorg-Johann Lay1-18/+18
gcc/ * config/avr/avr.opt: Overhaul help screen.
2024-03-01c++: Fix up decltype of non-dependent structured binding decl in template ↵Jakub Jelinek3-1/+75
[PR92687] finish_decltype_type uses DECL_HAS_VALUE_EXPR_P (expr) check for DECL_DECOMPOSITION_P (expr) to determine if it is array/struct/vector/complex etc. subobject proxy case vs. structured binding using std::tuple_{size,element}. For non-templates or when templates are already instantiated, that works correctly, finalized DECL_DECOMPOSITION_P non-base vars indeed have DECL_VALUE_EXPR in the former case and don't have it in the latter. It works fine for dependent structured bindings as well, cp_finish_decomp in that case creates DECLTYPE_TYPE tree and defers the handling until instantiation. As the testcase shows, this doesn't work for the non-dependent structured binding case in templates, because DECL_HAS_VALUE_EXPR_P is set in that case always; cp_finish_decomp ends with: if (processing_template_decl) { for (unsigned int i = 0; i < count; i++) if (!DECL_HAS_VALUE_EXPR_P (v[i])) { tree a = build_nt (ARRAY_REF, decl, size_int (i), NULL_TREE, NULL_TREE); SET_DECL_VALUE_EXPR (v[i], a); DECL_HAS_VALUE_EXPR_P (v[i]) = 1; } } and those artificial ARRAY_REFs are used in various places during instantiation to find out what base the DECL_DECOMPOSITION_P VAR_DECLs have and their positions. The following patch fixes that by changing lookup_decomp_type, such that it doesn't ICE when called on a DECL_DECOMPOSITION_P var which isn't in a hash table, but returns NULL_TREE in that case, and for processing_template_decl asserts DECL_HAS_VALUE_EXPR_P is non-NULL and just calls lookup_decomp_type. If it returns non-NULL, it is a structured binding using tuple and its result is returned, otherwise it falls through to returning unlowered_expr_type (expr) because it is an array, structure etc. subobject proxy. For !processing_template_decl it keeps doing what it did before, DECL_HAS_VALUE_EXPR_P meaning it is an array/structure etc. subobject proxy, otherwise the tuple case. 2024-03-01 Jakub Jelinek <jakub@redhat.com> PR c++/92687 * decl.cc (lookup_decomp_type): Return NULL_TREE if decomp_type_table doesn't have entry for V. * semantics.cc (finish_decltype_type): If ptds.saved, assert DECL_HAS_VALUE_EXPR_P is true and decide on tuple vs. non-tuple based on if lookup_decomp_type is NULL or not. * g++.dg/cpp1z/decomp59.C: New test.
2024-03-01OpenMP/C++: Fix (first)private clause with member variables [PR110347]Jakub Jelinek2-101/+13
OpenMP permits '(first)private' for C++ member variables, which GCC handles by tagging those by DECL_OMP_PRIVATIZED_MEMBER, adding a temporary VAR_DECL and DECL_VALUE_EXPR pointing to the 'this->member_var' in the C++ front end. The idea is that in omp-low.cc, the DECL_VALUE_EXPR is used before the region (for 'firstprivate'; ignored for 'private') while in the region, the DECL itself is used. In gimplify, the value expansion is suppressed and deferred if the lang_hooks.decls.omp_disregard_value_expr (decl, shared) returns true - which is never the case if 'shared' is true. In OpenMP 4.5, only 'map' and 'use_device_ptr' was permitted for the 'target' directive. And when OpenMP 5.0's 'private'/'firstprivate' clauses was added, the the update that now 'shared' argument could be false was missed. The respective check has now been added. 2024-03-01 Jakub Jelinek <jakub@redhat.com> Tobias Burnus <tburnus@baylibre.com> PR c++/110347 gcc/ChangeLog: * gimplify.cc (omp_notice_variable): Fix 'shared' arg to lang_hooks.decls.omp_disregard_value_expr for (first)private in target regions. libgomp/ChangeLog: * testsuite/libgomp.c++/target-lambda-3.C: Moved from gcc/testsuite/g++.dg/gomp/ and fixed is-mapped handling. * testsuite/libgomp.c++/target-lambda-1.C: Modify to also also work without offloading. * testsuite/libgomp.c++/firstprivate-1.C: New test. * testsuite/libgomp.c++/firstprivate-2.C: New test. * testsuite/libgomp.c++/private-1.C: New test. * testsuite/libgomp.c++/private-2.C: New test. * testsuite/libgomp.c++/target-lambda-4.C: New test. * testsuite/libgomp.c++/use_device_ptr-1.C: New test. gcc/testsuite/ChangeLog: * g++.dg/gomp/target-lambda-1.C: Moved to become a run-time test under testsuite/libgomp.c++. Co-authored-by: Tobias Burnus <tburnus@baylibre.com>
2024-03-01format-args: Add documentation for future expansion of functionArthur Cohen1-21/+5
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Add documentation regarding future tasks.