aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
14 hoursc: Implement C2y N3481 constraint against lvalue conversion with incomplete typeHEADtrunkmasterJoseph Myers4-1/+88
C2y replaces undefined behavior for lvalue conversion of an lvalue with incomplete, non-array type with a constraint violation. Implement this in GCC, which means disallowing lvalue conversion of qualified or atomic void for C2y. (Unqualified, non-atomic void is excluded from the definition of "lvalue".) I'm not convinced that the resolution of C90 DR#106 (which said that certain cases with qualified void were valid) was really justified even based on the wording of C90; nevertheless, this patch takes the conservative approach of only disallowing qualified void here for C2y. The test for this change showed that attempting to access an _Atomic void object produced an ICE-after-error attempting the atomic load logic for such a type. require_complete_type returning error_mark_node prevents this ICE from occurring any more in C2y mode; to avoid it in older modes, a check of COMPLETE_TYPE_P is added to really_atomic_lvalue. I didn't find any existing bug report in Bugzilla for this issue. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-typeck.cc (really_atomic_lvalue): Return false for incomplete types. (convert_lvalue_to_rvalue): Call require_complete_type for qualified void for C2y. gcc/testsuite/ * gcc.dg/c11-atomic-6.c, gcc.dg/c23-incomplete-1.c, gcc.dg/c2y-incomplete-3.c: New tests.
14 hoursDaily bump.GCC Administrator6-1/+784
19 hours[ira] avoid resetting ira_reg_equiv for function invariantsAlexandre Oliva1-2/+4
An aarch64 toolchain built with --enable-default-pie fails gcc.target/aarch64/sme/nonlocal_goto_[123].c because the register allocator ends up resetting equivalences, so it concludes it needs to preserve a rematerializable function invariant across a call instead of rematerializing it. Restore the find_reg_equiv_invariant_const logic that was in place before commit 55a2c3226a3e90a6d65f19710bab1ac377054234 rewrote it and added a (spurious?) requirement for non-function-invariants to retain an equivalence when other PIC-related conditions didn't apply. That requirement seems either reversed or unnecessary. for gcc/ChangeLog * ira.cc (setup_reg_equiv): Retain function invariant equivalences.
20 hoursforwprop: change optimize_aggr_zeroprop and optimize_agr_copyprop to take ↵Andrew Pinski1-8/+6
stmt instead of gsi As mentioned, optimize_aggr_zeroprop and optimize_agr_copyprop don't change the stmt so they should take stmt instead of the iterator. Pushed as obvious after bootstrap/test on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-forwprop.cc (optimize_aggr_zeroprop): Take gimple* instead of iterator. (optimize_agr_copyprop): Likewise. (simplify_builtin_call): Update call to optimize_aggr_zeroprop. (pass_forwprop::execute): Update calls to optimize_aggr_zeroprop and optimize_agr_copyprop. Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
20 hoursforwprop: Don't loop on the stmt when optimize_aggr_zeroprop or ↵Andrew Pinski1-55/+36
optimize_agr_copyprop return true Since now optimize_aggr_zeroprop and optimize_agr_copyprop work by forward walk to prop the zero/aggregate and does not change the statement at hand, there is no reason to repeat the loop if they do anything. This will prevent problems like PR 121962 from happening again as we will never loop. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-forwprop.cc (optimize_aggr_zeroprop_1): Change return type to void. (optimize_aggr_zeroprop): Likewise. (optimize_agr_copyprop_1): Likewise. (optimize_agr_copyprop_arg): Likewise. (optimize_agr_copyprop): Likewise. (simplify_builtin_call): Handle update of the return type of optimize_aggr_zeroprop. (pass_forwprop::execute): Likewise and optimize_agr_copyprop. Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
21 hours[MicroBlaze][PR target/118280] Fix __atomic_test_and_setMichael Eager5-19/+149
Atomic support enhanced to fix existing atomic_compare_and_swapsi pattern to handle side effects; new patterns atomic_fetch_op and atomic_test_and_set added. As MicroBlaze has no QImode test/set instruction, use shift magic to implement atomic_test_and_set. PR target/118280 gcc/ * config/microblaze/iterators.md: New. * config/microblaze/microblaze-protos.h: Add microblaze_subword_address. * config/microblaze/microblaze.cc: Ditto. * config/microblaze/microblaze.md: constants: Add UNSPECV_CAS_BOOL, UNSPECV_CAS_MEM, UNSPECV_CAS_VAL, UNSPECV_ATOMIC_FETCH_OP type: add atomic * config/microblaze/sync.md: Add atomic_fetch_<atomic_optab>si atomic_test_and_set Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com> Signed-off-by: Michael Eager <eager@eagercon.com>
21 hoursImprove costing of speculative calls in ipa-fnsummaryJan Hubicka1-8/+24
This patch implements logic to estimate_edge_devirt_benefit to not account call statement sizes of speculative calls in case we know the call we be turned to direct call by inlining. I also noticed that estimate_edge_size_and_time fails to accont code size savings by devirtualization when not asked to compute hints (this is quite rare; only early inliner and inlining functions called once is affected) and compensated for that in estimate_calls_size_and_time gcc/ChangeLog: * ipa-fnsummary.cc (estimate_edge_devirt_benefit): Handle speculative edges correctly. (estimate_edge_size_and_time): Even when not collecting hints, devirtualization affects function size. (estimate_calls_size_and_time): Do not use tables when devirtualization is possible.
21 hoursImprove ipa-cp devirtualization costingJan Hubicka3-14/+39
This patch fixed devirtualization time benefit of ipa-cp which should be scaled by edge frequency but it is not. The cost model is still not correct for speculative calls, since it does not take into account the fact that code size will shrink if speculation is removed. I also made cgraph_edge::make_direct to not ICE when there are multiple speculations to same target. This can happen in combination of devirtualization and ICF in some rare cases. gcc/ChangeLog: * cgraph.cc (cgraph_edge::make_direct): Do not ICE when there are multiple speculations to comptaible targets (cgraph_edge::combined_sreal_frequency): New member function. * cgraph.h (cgraph_edge::combined_sreal_frequency): Declare. * ipa-cp.cc (devirtualization_time_bonus): Return sreal; consider profile. (estimate_local_effects): Likewise.
22 hoursFortran: Intrinsic functions in PDT specification exprs. [PR83746]Paul Thomas2-0/+59
2025-09-19 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/83746 * trans-array.cc (structure_alloc_comps): Add the pre and post blocks to 'fnblock' for all the evaluations of parameterized expressions in PDT component allocatation. gcc/testsuite/ PR fortran/83746 * gfortran.dg/pdt_48.f03: New test.
22 hoursPR modula2/121856: New wideset implementationGaius Mulley99-3492/+12504
The new wideset implementation uses an ARRAY OF BYTE (internally) to represent large sets. This replaces the huge struct of anonymous fields created by the old implementation and results in quicker declaration times for large set types. gcc/ChangeLog: PR modula2/121856 * doc/gm2.texi (Compiler options): New item -fwideset. gcc/m2/ChangeLog: PR modula2/121856 * Make-lang.in (GM2-LIBS-BOOT-DEFS): Add M2Diagnostic.def. Add Selective.def. (GM2-LIBS-BOOT-MODS): Add M2Diagnostic.mod. (GM2-LIBS-BOOT-C): Add Selective.c. (GM2-LIBS-DEFS): Add Selective.def. (GM2-LIBS-MODS): Add M2Diagnostic.mod. (MC-LIB-MODS): Add M2Diagnostic.mod. (m2/gm2-libs-boot/Selective.o): New rule. (BUILD-PGE-O): Add m2/pge-boot/GM2Diagnostic.o. Add m2/pge-boot/GM2Diagnostic.o. Add m2/pge-boot/GStringConvert.o. Add m2/pge-boot/Gdtoa.o. Add m2/pge-boot/Gldtoa.o. * Make-maintainer.in (PPG-LIB-DEFS): Add M2Diagnostic.def. Add StringConvert.def. (PPG-LIB-MODS): Add M2Diagnostic.mod. Add StringConvert.mod. (PGE-DEF): Add M2Diagnostic.def. (PGE-DEPS): Add GM2Diagnostic.cc. Add GM2Diagnostic.h. * gm2-compiler/FifoQueue.def (PutSetIntoFifoQueue): New procedure. (GetSetFromFifoQueue): New procedure function. * gm2-compiler/FifoQueue.mod (PutSetIntoFifoQueue): New procedure. (GetSetFromFifoQueue): New procedure function. * gm2-compiler/M2ALU.def (KillValue): New procedure. (PushSetTree): Rename parameter t to value. (ConstructSetConstant): Rewrite comment. * gm2-compiler/M2ALU.mod: Rewrite to use the new set type and introduce memory diagnostics. * gm2-compiler/M2Base.mod (InitBaseProcedures): Lookup M2WIDESET. * gm2-compiler/M2CaseList.mod (CheckCaseBoundsResolved): Change format specifier to allow the preceeding indefinite article to have a n concatenated providing the following string substitute begins with a vowel. (checkTypes): Ditto. * gm2-compiler/M2Check.mod (checkGenericUnboundedTyped): New procedure function. * gm2-compiler/M2Code.mod (OptimizationAnalysis): Replace with ... (ResourceAnalysis): ... this. * gm2-compiler/M2Comp.mod (PopulateResource): New procedure. (compile): Call PopulateResource. Call M2Diagnostic.Generate. * gm2-compiler/M2GCCDeclare.mod: Rewrite for new set type. * gm2-compiler/M2GenGCC.mod: Rewrite implementation for becomes, incl, excl, and, or, not, xor for the new set type. * gm2-compiler/M2MetaError.def: Extend comment documenting the v format specifier. * gm2-compiler/M2MetaError.mod (errorBlock): New field vowel. (initErrorBlock): Initialize field vowel. Reformat comments. (pop): Call checkVowel. (checkVowel): New procedure. (isVowel): New procedure function. (symDesc): Remove indefinite article. (op): Set vowel field in case clause. * gm2-compiler/M2Options.def (OptimizeSets): New global. (TimeReport): Ditto. (MemReport): Ditto. (SetMemReport): New procedure. (SetTimeReport): Ditto. (SetWideset): Ditto. (GetWideset): New procedure function. * gm2-compiler/M2Options.mod (SetOptimizing): Assign OptimizeSets depending upon the optimization level. (SetMemReport): New procedure. (SetTimeReport): Ditto. (SetWideset): Ditto. (GetWideset): New procedure function. (OptimizeSets): Initialize to FALSE. (TimeReport): Ditto. (MemReport): Ditto. * gm2-compiler/M2Quads.mod (M2Diagnostic): Import. (QuadsMemDiag): New global variable. (NewQuad): Bump QuadsMemDiag whenever a quad is allocated. (BuildAssignmentBoolean): New procedure. (doBuildAssignment): Ditto. Add v to the format specifier. (CheckCompatibleWithBecomes): Add v to the format specifier. (CheckProcTypeAndProcedure): Ditto. (BuildAddAdrFunction): Ditto. (BuildSubAdrFunction): Ditto. (BuildDifAdrFunction): Ditto. (BuildDesignatorArrayStaticDynamic): Ditto. (BuildDesignatorPointer): Ditto. (CheckVariableOrConstantOrProcedure): Ditto. (Init): Initialize QuadsMemDiag. * gm2-compiler/M2Range.mod (CodeTypeAssign): Add v to the format specifier. * gm2-compiler/M2Scaffold.mod (DeclareScaffoldFunctions): Generate more precise warning note. * gm2-compiler/M2SymInit.mod (PrintSymInit): Add record field warning. * gm2-compiler/M2System.mod (IsPseudoSystemFunctionConstExpression): Add TBitSize. * gm2-compiler/NameKey.mod: Add MemDiagnostic code commented out. * gm2-compiler/P1SymBuild.mod (StartBuildProcedure): Add v format specifier. * gm2-compiler/P2SymBuild.mod (BuildFieldRecord): Ditto. * gm2-compiler/P3Build.bnf (SetType): Reformat. * gm2-compiler/PathName.def (Copyright): Added. * gm2-compiler/PathName.mod: Remove blank line. * gm2-compiler/SymbolConversion.mod (gdbhook): New procedure. (BreakWhenSymBooked): Ditto. (CheckBook): Ditto. (Init): Rewrite. * gm2-compiler/SymbolTable.def (GetSetArray): New procedure. (PutSetArray): Ditto. (MakeSetArray): New procedure function. (PutSetInWord): New procedure. (GetSetInWord): New procedure function. (IsConstVar): Ditto. * gm2-compiler/SymbolTable.mod (SymSet): SetInWord new field. SetArray new field. Align new field. (SymMemDiag): New global variable. (Init): Initialize SymMemDiag. (IsConstVar): New procedure function. (IsVariableSSA): Replace InternalError with Return FALSE. (GetNthParamOrdered): Reimplement. (GetNthParamAnyClosest): Ditto. (GetOuterModuleScope): Ditto. (MakeSet): Ditto. (PutSetArray): New procedure. (GetSetArray): New procedure function. (MakeSetArray): Ditto. (PutSetInWord): New procedure. (GetSetInWord): New procedure function. * gm2-gcc/init.cc (_M2_M2Diagnostic_init): Define prototype. (init_FrontEndInit):Call _M2_M2Diagnostic_init. * gm2-gcc/m2block.cc (m2block_GetTotalConstants): New function. (m2block_GetGlobalTypes): Ditto. * gm2-gcc/m2block.def (GetTotalConstants): New procedure function. (GetGlobalTypes): New procedure function. * gm2-gcc/m2block.h (m2block_GetTotalConstants): New function prototype. (m2block_GetGlobalTypes): Ditto. * gm2-gcc/m2convert.cc (converting_ISO_generic): Reimplement. (m2convert_ToPIMByte): New function. * gm2-gcc/m2convert.def (ToLoc): New procedure function. (ToPIMByte): Ditto. * gm2-gcc/m2convert.h (m2convert_ToPIMByte): Ditto. * gm2-gcc/m2decl.h (m2decl_RememberVariables): Ditto. * gm2-gcc/m2expr.cc (m2expr_BuildLogicalShift): Reimplement. (m2expr_BuildLRotate): Ditto. (m2expr_BuildLRLn): Ditto. (m2expr_BuildLRRn): Ditto. (m2expr_BuildLogicalRotate): Ditto. (buildUnboundedArrayOf): Ditto. (BuildIfBitInSetLower): New function. (m2expr_BuildBinarySetDo): Reimplement. (m2expr_BuildIfInSet): Ditto. (m2expr_BuildIfNotInSet): New function. (m2expr_Build4LogicalOr): Reimplement. (m2expr_BuildSetNegate): Ditto. (m2expr_BuildLogicalOrAddress): Ditto. (m2expr_BuildLogicalOr): Ditto. (m2expr_BuildLogicalAnd): Ditto. (m2expr_BuildSymmetricDifference): Ditto. (m2expr_BuildLogicalDifference): Ditto. (boolean_enum_to_unsigned): Ditto. (m2expr_BuildIsSuperset): Ditto. (m2expr_BuildIsNotSuperset): Ditto. (m2expr_BuildIsSubset): Ditto. (m2expr_BuildIfBitInSetJump): Ditto. (m2expr_BuildIfNotConstInVar): Ditto. (m2expr_BuildIfVarInVar): Ditto. (m2expr_BuildIfNotVarInVar): Remove. (m2expr_BuildIfConstInVar): Remove. (m2expr_BuildForeachWordInSetDoIfExpr): Ditto. (m2expr_BuildBinaryForeachWordDo): Ditto. (m2expr_BuildIfInRangeGoto): Reimplement. (m2expr_BuildIfNotInRangeGoto): Ditto. (m2expr_SetAndNarrow): Ditto. (m2expr_GetBitsetZero): New function. (m2expr_GetRValue): Ditto. * gm2-gcc/m2expr.def (GetBitsetZero): New function. (BuildSetNegate): Ditto. (BuildLogicalOr): Reimplement. (BuildLogicalAnd): Ditto. (BuildSymmetricDifference): Ditto. (BuildLogicalDifference): Ditto. (BuildIfInSet): New procedure function. (BuildIfNotInSet): Ditto. (BuildEqualTo): Reimplement. (BuildNotEqualTo): Ditto. (BuildBinaryForeachWordDo): Remove. (BuildBinarySetDo): Ditto. (GetRValue): New procedure function. * gm2-gcc/m2expr.h (m2expr_BuildBinaryForeachWordDo): Remove. (m2expr_BuildForeachWordInSetDoIfExpr): Ditto. (m2expr_BuildIfNotVarInVar): Ditto. (m2expr_BuildIfVarInVar): Ditto. (m2expr_BuildIfNotConstInVar): Ditto. (m2expr_BuildIfConstInVar): Ditto. (m2expr_BuildLogicalDifference): Reimplement. (m2expr_BuildSymmetricDifference): Ditto. (m2expr_BuildLogicalAnd): Ditto. (m2expr_BuildLogicalOr): Ditto. (m2expr_BuildLogicalOrAddress): Ditto. (m2expr_BuildSetNegate): Ditto. (m2expr_GetBitsetZero): New function. (m2expr_GetRValue): Ditto. (m2expr_BuildIfInSet): Ditto. (m2expr_BuildIfNotInSet): Ditto. * gm2-gcc/m2options.h (M2Options_SetTimeReport): New function. (M2Options_SetMemReport): Ditto. (M2Options_SetWideset): Ditto. (M2Options_GetWideset): Ditto. * gm2-gcc/m2pp.cc (m2pp_shiftrotate_expr): New function. (m2pp_simple_expression): Ditto. * gm2-gcc/m2statement.cc (m2statement_BuildStartFunctionCode): Tidyup comments. (m2statement_BuildEndFunctionCode): Ditto. (m2statement_BuildPushFunctionContext): Ditto. (copy_array): Ditto. (CopyByField_Lower): Ditto. (m2statement_BuildGoto): Ditto. (m2statement_DeclareLabel): Ditto. (m2statement_BuildParam): Ditto. (nCount): Ditto. (m2statement_BuildProcedureCallTree): Ditto. (m2statement_BuildBuiltinCallTree): Ditto. (m2statement_BuildFunctValue): Ditto. (m2statement_BuildCall2): Ditto. (m2statement_BuildCall3): Ditto. (m2statement_BuildFunctionCallTree): Ditto. (m2statement_SetLastFunction): Ditto. (m2statement_SetParamList): Ditto. (m2statement_GetLastFunction): Ditto. (m2statement_GetParamList): Ditto. (m2statement_GetCurrentFunction): Ditto. (m2statement_GetParamTree): Ditto. (m2statement_BuildTryFinally): Ditto. (m2statement_BuildCleanUp): Ditto. (m2statement_BuildUnaryForeachWordDo): Remove. (m2statement_BuildExcludeVarConst): Ditto. (m2statement_BuildExcludeVarVar): Ditto. (m2statement_BuildIncludeVarConst): Ditto. (m2statement_BuildIncludeVarVar): Ditto. (m2statement_DoJump): Remove. (m2statement_IfExprJump): New function. (m2statement_IfBitInSetJump): Ditto. * gm2-gcc/m2statement.def (DoJump): Remove. (IfExprJump): New procedure function. (BuildUnaryForeachWordDo): Remove. (IfBitInSetJump): New procedure function. * gm2-gcc/m2statement.h (m2statement_BuildForeachWordDo): Remove. (m2statement_DoJump): Ditto. (m2statement_IfExprJump): New function. (m2statement_IfBitInSetJump): Ditto. * gm2-gcc/m2treelib.cc (m2treelib_do_jump_if_bit): Reimplement. (nCount): Replace with ... (m2treelib_nCount): ... this. (m2treelib_DoCall): Reimplement. (m2treelib_get_rvalue): Remove. * gm2-gcc/m2treelib.def (get_rvalue): Remove. (nCount): New procedure function. * gm2-gcc/m2treelib.h (m2treelib_get_rvalue): Remove. (m2treelib_nCount): New function. * gm2-gcc/m2type.cc (constructor_elements): Change type to vec. (m2type_BuildEndArrayType): Reformat. (build_m2_type_node_by_array): Ditto. (m2type_GetBooleanEnumList): New procedure function. (m2type_BuildEnumerator): Add const to char *. (m2type_BuildSetConstructorElement): Reimplement. (m2type_BuildEndSetConstructor): Ditto. (build_record_constructor): New function. (m2type_BuildEndRecordConstructor): Reimplement. (m2type_BuildRecordConstructorElement): Ditto. (m2type_BuildStartArrayConstructor): Reimplement. (m2type_BuildEndArrayConstructor): Remove blank lines. * gm2-gcc/m2type.def (BuildSetConstructorElement): Reimplement. (BuildEndArrayType): Reformat. (GetBooleanEnumList): New function. * gm2-gcc/m2type.h (m2type_BuildEnumerator): Add const to char *. (m2type_BuildSetConstructorElement): Reimplement. (m2type_GetBooleanEnumList): New procedure function. * gm2-lang.cc (OPT_fmem_report): New option. (OPT_ftime_report): Ditto. (OPT_fwideset): Ditto. * gm2-libs-coroutines/SYSTEM.def (ShiftVal): Remove. (ShiftLeft): Ditto. (ShiftRight): Ditto. (RotateVal): Ditto. (RotateLeft): Ditto. (RotateRight): Ditto. * gm2-libs-coroutines/SYSTEM.mod: Reimplement. * gm2-libs-iso/SYSTEM.def (ShiftVal): Remove. (ShiftLeft): Ditto. (ShiftRight): Ditto. (RotateVal): Ditto. (RotateLeft): Ditto. (RotateRight): Ditto. * gm2-libs-iso/SYSTEM.mod: Reimplement. * gm2-libs/SYSTEM.def (ShiftVal): Remove. (ShiftLeft): Ditto. (ShiftRight): Ditto. (RotateVal): Ditto. (RotateLeft): Ditto. (RotateRight): Ditto. * gm2-libs/SYSTEM.mod: Reimplement. * gm2-libs/SysStorage.def (DEALLOCATE): Improve comment. * gm2-libs/SysStorage.mod: Improve comment. * init/ppginit (M2Diagnostic): Add. (StringConvert): Add. * lang.opt (fmem-report): Add access to c.opt. (ftime-report): Ditto. (fwideset): New option. * pge-boot/main.cc (_M2_M2Diagnostic_init): New function. (_M2_M2Diagnostic_fini): Ditto. (_M2_StringConvert_init): Ditto. (_M2_StringConvert_fini): Ditto. (main): Call _M2_M2Diagnostic_init. Call _M2_StringConvert_init. Call _M2_M2Diagnostic_fini. Call _M2_StringConvert_fini. * tools-src/makeSystem: Add -gdb option. * gm2-libs/M2Diagnostic.def: New file. * gm2-libs/M2Diagnostic.mod: New file. * gm2-libs/M2WIDESET.def: New file. * gm2-libs/M2WIDESET.mod: New file. * mc-boot/GM2Diagnostic.cc: New file. * mc-boot/GM2Diagnostic.h: New file. * pge-boot/GM2Diagnostic.cc: New file. * pge-boot/GM2Diagnostic.h: New file. * pge-boot/GSelective.h: New file. * pge-boot/GStringConvert.cc: New file. libgm2/ChangeLog: * libm2pim/Makefile.am (M2MODS): Add M2Diagnostic.mod. Add M2WIDESET.mod. (M2DEFS): Add M2Diagnostic.def. Add M2WIDESET.def. * libm2pim/Makefile.in: Regenerate. gcc/testsuite/ChangeLog: * gm2/errors/fail/testbit2.mod: Rewrite. * gm2/iso/run/pass/shift4.mod: Rewrite adding more internal tests. * gm2/iso/run/pass/testsystem.mod (FindFirstElement): Add bounds check. * gm2/sets/run/pass/multisetrotate4.mod: Add more runtime error messages. * gm2/sets/run/pass/simplepacked.mod (testpset): Correct setname. * lib/gm2.exp (gm2_init_minx): Add -fno-wideset. * gm2/iso/run/pass/assigncons.mod: New test. * gm2/iso/run/pass/constructor3.mod: New test. * gm2/iso/run/pass/proc_test.mod: New test. * gm2/iso/run/pass/simplelarge2.mod: New test. * gm2/iso/run/pass/simplelarge3.mod: New test. * gm2/iso/run/pass/simplelarge4.mod: New test. * gm2/pimlib/wideset/run/pass/bitset.mod: New test. * gm2/pimlib/wideset/run/pass/bitset2.mod: New test. * gm2/pimlib/wideset/run/pass/colorset.mod: New test. * gm2/pimlib/wideset/run/pass/colorset2.mod: New test. * gm2/pimlib/wideset/run/pass/colorset3.mod: New test. * gm2/pimlib/wideset/run/pass/highbit.mod: New test. * gm2/pimlib/wideset/run/pass/highbit2.mod: New test. * gm2/sets/run/pass/multisetrotate5.mod: New test. * gm2/sets/run/pass/setcard.mod: New test. * gm2/sets/run/pass/setincl.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
23 hours[RISC-V][PR target/121983] Fix unprotected REGNO invocationJeff Law2-2/+24
So this was a naked REGNO usage, which of course blows up if RTL checking is enabled and something else sneaks in (SUBREG). Thankfully it never results in incorrect code, though I could theorize it could cause a bootstrap comparison failure in the "right" circumstances. Bootstrapped & regression tested on the Pioneer. Also regression tested on riscv64-elf and riscv32-elf. I'll push to the trunk once pre-commit CI is done. jeff PR target/121983 gcc/ * config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Make sure object is a REG before asking for its REGNO. Fix a trivial whitespace nit. gcc/testsuite/ * gcc.target/riscv/pr121983.c: New test.
24 hoursRISC-V: Improve slide patterns recognitionRaphael Moreira Zinsly11-21/+751
Improve shuffle_slide_patterns to better recognize permutations that can be constructed by a slideup or slidedown, covering more cases: Slideup one vector into the middle the other like {0, 4, 5, 3}. Slidedown one vector not ending in the last element like {5, 6, 2, 3}. Slidedown one vector from the beginning like {4, 5, 2, 3}. gcc/ChangeLog: * config/riscv/riscv-v.cc (shuffle_slide_patterns): Cover more permutations. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/shuffle-slide-run.h: New test. * gcc.target/riscv/rvv/autovec/shuffle-slidedown-run.c: Likewise. * gcc.target/riscv/rvv/autovec/shuffle-slideup-run.c: Likewise. * gcc.target/riscv/rvv/autovec/vls-vlmax/shuffle-slide.h: Likewise. * gcc.target/riscv/rvv/autovec/vls-vlmax/shuffle-slidedown-1.c: Likewise. * gcc.target/riscv/rvv/autovec/vls-vlmax/shuffle-slidedown-2.c: Likewise. * gcc.target/riscv/rvv/autovec/vls-vlmax/shuffle-slidedown-perm.h: Likewise. * gcc.target/riscv/rvv/autovec/vls-vlmax/shuffle-slideup-1.c: Likewise. * gcc.target/riscv/rvv/autovec/vls-vlmax/shuffle-slideup-2.c: Likewise. * gcc.target/riscv/rvv/autovec/vls-vlmax/shuffle-slideup-perm.h: Likewise.
25 hoursRISC-V: Only Save/Restore required registers for ILP32E/LP64EJim Lin3-8/+59
Previously the spec https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/70 has changed the save/restore routines to save/restore the registers which are really used for ILP32E/LP64 rather than always save/restore all of ra/s0/s1. I also found here that lacks the implementation for lp64e. If it's necessary I will file anothor patch for that. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_compute_frame_info): Remove the dedicated calculation for RVE. libgcc/ChangeLog: * config/riscv/save-restore.S: Only save/restore the registers which are really used for ILP32E/LP64. gcc/testsuite/ChangeLog: * gcc.target/riscv/save-restore-cfi-3.c: New test.
25 hours[RISC-V] Optimize clear-lowest-set-bit sequence when ctz is nearbyJeff Law6-1/+442
Daniel Barboza and I were looking at deepsjeng recently and spotted an oddity. In particular we had a sequence like this: addi a1,a0,-1 and a1,a0,a1 That idiom clears the lowest set bit in a0. In the initial code we looked at there was a subsequent ctz dest,a0. In other cases I could see an earlier ctz. And when I went digging further I even found the ctz between the addi/and. The key is the ctz uses the same input as the addi, but a different output. So the ctz doesn't participate in combine with the addi/and. Tackling this in gimple isn't really feasible as the resultant code is going to have a higher expression count. The bclr idiom looks like (and (rotate (-2) (count) (input)) where the count comes from a ctz. SO to make it work from a costing standpoint, we'd have to go find the ctz and use it. Tackling in gimple->rtl expansion looked potentially feasible, but sign and general type changes make that painful. So while I could see the add+and and could speculatively hope there was a nearby ctz it looked less than ideal from an implementation standpoint. It also tickled some undesirable behavior in the combiner. Tackling in combine isn't possible because the ctz doesn't feed the addi/and or vice-versa. Tackling with a peephole works sometimes, but is easily thwarted by the scheduler putting random code in the middle of the sequences we want to adjust. So in the end I just made a new RISC-V pass that runs after combine. It walks each block looking for the addi+and construct. When found it then looks a few instructions in either direction for a related ctz. When found it'll move things around as necessary and use ctz+bclr. It depends on DCE to eliminate the almost certainly dead addi+and insns. I haven't benchmarked this one on design, but it's definitely picking up the opportunities in deepsjeng and saves a few billion instructions. It has survived a riscv64-elf and riscv32-elf build. Bootstrap on the BPI is in flight, bootstrap on the Pioneer passes, but this code won't trigger this because the Pioneer doesn't have ctz or bclr instructions. Note while I would expect some of this pass to be usable on other targets, it does make some assumptions about RTL structure that hold on RISC-V. For example subword arithmetic has an explicit sign extension to word mode, bit position is QImode, etc. Comments? Other thoughts on how to resolve? gcc/ * config.gcc (riscv*); Add riscv-bclr-lowest-set-bit.o to extra_objs. * config/riscv/riscv-bclr-lowest-set-bit.cc: New file. * config/riscv/riscv-passes.def: Add new pass after combine. * config/riscv/riscv-protos.h (make_pass_bclr_lowest_set_bit): Add prototype. * config/riscv/t-riscv: Add rules to build riscv-bclr-lowest-set-bit.o. gcc/testsuite * gcc.target/riscv/bclr-lowest-set-bit-1.c: New test.
28 hoursRemove accidentially left if (0) blockRichard Biener1-14/+0
The following removes a block I added (and disabled again) when developing the PR121720 fix. * tree-ssa-pre.cc (compute_antic_aux): Remove dead code.
29 hoursada: Implement support for Is_Link_Once flag on entitiesEric Botcazou4-71/+101
gcc/ada/ChangeLog: * gcc-interface/gigi.h (create_var_decl): Add LINKONCE_FLAG boolean parameter. (create_subprog_decl): Likewise. * gcc-interface/decl.cc (gnat_to_gnu_entity): Adjust calls to create_var_decl and create_subprog_decl. (elaborate_expression_1): Likewise. * gcc-interface/trans.cc (gigi): Likewise. (build_raise_check): Likewise. (Subprogram_Body_to_gnu): Likewise. (create_temporary): Likewise. (Exception_Handler_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (gnat_to_gnu): Likewise. (use_alias_for_thunk_p): Return false for a one-only target. * gcc-interface/utils.cc (maybe_pad_type): Adjust call to create_var_decl. (create_var_decl): Add LINKONCE_FLAG boolean parameter. (create_subprog_decl): Likewise.
29 hoursada: Initial support for Extended Access typesMarc Poulhiès7-184/+691
This change introduces the support for the new GNAT specific Extended_Access aspect for access to unconstrained array type : type Ext_Access is access all Some_Array_Type with Extended_Access; This new kind of access type does not use the existing "fat" layout with a record of two pointers: one to the actual data, one to a record with the bounds of the array. Instead, it removes the second indirection and extends the record to contain the pointer to the actual data followed by the bounds. This mainly allows the following features: - have access to slice of array - easier interface when allocation is done in a foreign language gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (TYPE_EXTENDED_POINTER_P): New. (TYPE_IS_EXTENDED_POINTER_P): New. (TYPE_EXTENDED_UNCONSTRAINED_ARRAY): New. (SET_TYPE_EXTENDED_UNCONSTRAINED_ARRAY): New. (TYPE_DUMMY_EXT_POINTER_TO): New. (SET_TYPE_DUMMY_EXT_POINTER_TO): New. * gcc-interface/decl.cc (get_extended_unconstrained_array): New. (gnat_to_gnu_entity): Handle extended access type. (get_unpadded_extended_type): New. (gnat_to_gnu_component_type): Handle extended access type. (build_template_type): New. (gnat_to_gnu_field): Handle extended access type. (validate_size): Likewise. (set_rm_size): Likewise. (copy_and_substitute_in_layout): Likewise. (rm_size): Likewise. * gcc-interface/gigi.h (get_unpadded_extended_type): New. (build_template_type): New. (build_dummy_unc_pointer_types_ext): New. (finish_extended_pointer_type): New. (build_unc_object_type_from_ptr): Rename first parameter. * gcc-interface/misc.cc (gnat_print_type): Handle extended access type. * gcc-interface/trans.cc (Identifier_to_gnu): Likewise. (Attribute_to_gnu): Likewise. (gnat_to_gnu): Likewise. * gcc-interface/utils.cc (convert_to_fat_pointer): Assert if converting an extended pointer. (build_dummy_unc_pointer_types_ext): New. (finish_extended_pointer_type): New. (finish_record_type): Handle extended access type. (build_unc_object_type_from_ptr): Likewise. (convert_to_extended_pointer): New. (convert): Handle extended access type. (gnat_pushdecl): Likewise. (maybe_pad_type): Likewise. * gcc-interface/utils2.cc (build_unary_op): Likewise. (build_binary_op): Likewise. (build_allocator): Likewise. (gnat_save_expr): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise.
29 hoursada: Make error recovery for structural generic instantiation more robustEric Botcazou1-0/+4
This adds a guard for the case of a selected component whose prefix is an illegal structural generic instance. gcc/ada/ChangeLog: * sem_ch4.adb (Analyze_Selected_Component): Bail out if the prefix has Void_Type.
29 hoursada: Remove unnecessary declare blockPiotr Trojanek1-41/+38
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_ch4.adb (Analyze_User_Defined_Binary_Op): Remove declare block.
29 hoursada: Preliminary implementation of structural generic instantiationEric Botcazou26-131/+1658
It contains the changes to the parser required for the new syntax, as well as the mechanism to instantiate generics implicitly. The implementation is strictly structural, in the sense that if the implicit instantiation cannot be made structural for semantic dependence reasons, then it is rejected. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst (Structural Generic Instantiation): New entry * einfo.ads (Is_Link_Once): New flag defined in entities. * sinfo.ads (Is_Structural): New flag defined in instantiations. * gen_il-fields.ads (Opt_Field_Enum): Add Is_Link_Once and Is_Structural. * gen_il-gen-gen_entities.adb (Entity_Kind): Add Is_Link_Once semantic flag. * gen_il-gen-gen_nodes.adb (N_Generic_Instantiation): Move up Parent_Spec field and add Is_Structural semantic flag. * frontend.adb: Add with clause for Sem_Ch12. (Frontend): After analysis is complete and bodies are instantiated, call Sem_Ch12.Mark_Link_Once on the declarations of the main unit. * par.adb (P_Qualified_Simple_Name): Delete. (P_Qualified_Simple_Name_Resync): Likewise (P_Exception_Name): New function declaration. (P_Label_Name): Likewise. (P_Loop_Name): Likewise. (P_Generic_Unit_Name): Likewise. (P_Library_Unit_Name): Likewise. (P_Package_Name): Likewise. (P_Parent_Unit_Name): Likewise. (P_Subtype_Name): Likewise. (P_Subtype_Name_Resync): Likewise. * par-ch3.adb (P_Subtype_Mark_Resync): Replace call to P_Qualified_Simple_Name_Resync by P_Subtype_Name_Resync. (P_Identifier_Declarations): Replace call to P_Qualified_Simple_Name_Resync by P_Exception_Name. (P_Derived_Type_Def_Or_Private_Ext_Decl): Replace call to P_Qualified_Simple_Name by P_Subtype_Name. (P_Interface_Type_Definition): Replace calls to P_Qualified_Simple_Name by P_Subtype_Name. * par-ch4.adb (P_Reduction_Attribute_Reference): Move around and change name of parameter. (P_Name): Document new grammar rule and make a couple of tweaks. (P_Exception_Name): New function. (P_Label_Name): Likewise. (P_Loop_Name): Likewise. (P_Generic_Unit_Name): Likewise. (P_Library_Unit_Name): Likewise. (P_Package_Name): Likewise. (P_Parent_Unit_Name): Likewise. (P_Subtype_Name): Likewise. (P_Subtype_Name_Resync): Likewise. (P_Qualified_Simple_Name): Rename into... (P_Simple_Name): ...this. (P_Qualified_Simple_Name_Resync): Rename into... (P_Simple_Name_Resync): ...this. Accept left parenthesis and dot as name extensions. (P_Allocator): Replace call to P_Qualified_Simple_Name_Resync by P_Subtype_Name_Resync. * par-ch5.adb (P_Goto_Statement): Replace call to P_Qualified_Simple_Name by P_Label_Name. (Parse_Loop_Flow_Statement): Replace call to P_Qualified_Simple_Name by P_Loop_Name. * par-ch6.adb (P_Subprogram): Replace call to P_Qualified_Simple_Name by P_Generic_Unit_Name. * par-ch7.adb (P_Package): Replace calls to P_Qualified_Simple_Name by P_Package_Name and P_Generic_Unit_Name. * par-ch8.adb (P_Use_Package_Clause): Replace calls to P_Qualified_Simple_Name by P_Package_Name. * par-ch9.adb (P_Task): Replace call to P_Qualified_Simple_Name by P_Subtype_Name. (P_Protected): Likewise. * par-ch10.adb (P_Context_Clause): Replace call to P_Qualified_Simple_Name by P_Library_Unit_Name. (P_Subunit): Replace call to P_Qualified_Simple_Name by P_Parent_Unit_Name. * par-ch12.adb (P_Generic): Replace call to P_Qualified_Simple_Name by P_Generic_Unit_Name. (P_Formal_Derived_Type_Definition): Replace call to P_Qualified_Simple_Name by P_Subtype_Name. (P_Formal_Package_Declaration): Replace call to P_Qualified_Simple_Name by P_Generic_Unit_Name. * sem_ch4.adb: Add with and use clauses for Sem_Ch12. (Analyze_Call): Accept implicit instantiations with -gnatX0. (Analyze_Indexed_Component_Form): Likewise. * sem_ch8.adb (Analyze_Use_Package): Add guard before inserting a with clause automatically when there is a use clause. (Check_In_Previous_With_Clause): Retrieve original names. (Check_Library_Unit_Renaming): Deal with structural instances. (End_Use_Type): Minor tweak. * sem_ch10.adb (Analyze_With_Clause): Remove useless test and call Defining_Entity_Of_Instance. * sem_ch12.ads (Build_Structural_Instantiation): New function. (Mark_Link_Once): New procedure. * sem_ch12.adb: Add with and use clauses for Exp_Dbug. (Analyze_Associations): Add support for structural instantiations. (Analyze_Package_Instantiation): Likewise. (Analyze_Subprogram_Instantiation): Likewise. (Analyze_Structural_Associations): New procedure. (Need_Subprogram_Instance_Body): Return True for instantiation is in the auxiliary declarations of the main unit. (Build_Structural_Instantiation): New function. (Mark_Link_Once): New procedure. * sem_util.ads (Add_Local_Declaration): New procedure. (Defining_Entity_Of_Instance): New function. * sem_util.adb (Add_Local_Declaration): New procedure. (Defining_Entity_Of_Instance): New function. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
29 hoursada: Fix comment about operational aspectsRonan Desplanques1-1/+1
The comment this patch changes claimed that operational aspects are "view-specific". The following excerpt from ARM 13.1 (11/5) indicates that the set of view-specific aspects is in fact much more restricted: If a type-related aspect is defined for the partial view of a type, then it has the same definition for the full view of the type, except for certain Boolean-valued operational aspects where the language specifies that the partial view can have the value False even when the full view has the value True. On the other hand, a feature of operational aspects is that they can be specified on partial views, unlike representation aspects. That's stated by AARM 13.1 (9.c/1): Unlike representation items, operational items can be specified on partial views. So this patch changes the comment to be about that instead. gcc/ada/ChangeLog: * aspects.ads: Fix comment.
29 hoursada: Remove commentRonan Desplanques1-3/+1
The comment this patch removes was about representation aspects but it was placed above Operational_Aspect. The comment in itself was not very helpful either since operational aspects, for example, are also needed during expansion and code generation. gcc/ada/ChangeLog: * aspects.ads: Remove comment.
29 hoursada: Add procedure to write an extended access as a StringMarc Poulhiès4-2/+27
Add the Put_Image_Extended_Access_Pointer procedure for supporting Ext_Access'Image. gcc/ada/ChangeLog: * libgnat/s-putima.ads (Ext_Access_Pointer): New. (Put_Image_Extended_Access_Pointer): New. * libgnat/s-putima.adb (Ext_Acc_Instance): New. (Put_Image_Extended_Access_Pointer): New. * rtsfind.ads (RE_Id, RE_Unit_Table): Set value for RE_Put_Image_Extended_Access_Pointer. * exp_put_image.adb (Build_Elementary_Put_Image_Call): Handle extended access.
29 hoursada: Add C binding for Is_Extended_Access_TypeMarc Poulhiès2-0/+4
gcc/ada/ChangeLog: * fe.h (Is_Extended_Access_Type): Add C bindings. * sem_util.ads (Is_Extended_Access_Type): Add comment that any change to the function must take care of the C binding.
29 hoursada: Do not set Esize for Extended AccessesMarc Poulhiès1-9/+21
The size of an extended access is unknown at this stage, so leave Esize empty. gcc/ada/ChangeLog: * layout.adb (Layout_Type): Adjust comment and code extended accesses.
29 hoursada: Remove superfluous statementsRonan Desplanques1-2/+0
This patch removes two occurrences of the following pattern: Analyze_Component_Declaration (N); Mutate_Ekind (Defining_Identifier (N), E_Component); The second statement here has absolutely no effect, so its presence can be confusing to the reader. gcc/ada/ChangeLog: * sem_ch3.adb (Add_Tag): Remove superfluous statements.
29 hoursada: Compiler crashes on subunits with Streaming/Put_Image attribute referencesSteve Baird1-15/+40
When necessary, the compiler builds subprograms to implement the streaming attributes (or the Put_Image attribute) for a type. In some cases involving separate subunits, these compiler-generated subprograms were inserted at the wrong point in the tree, resulting in internal compiler errors. gcc/ada/ChangeLog: * exp_attr.adb (Interunit_Ref_OK): Treat a subunit like a body. (Build_And_Insert_Type_Attr_Subp): When climbing up the tree, go from an N_Subunit node to its stub (instead of to the subunit's N_Compilation_Unit node).
29 hoursada: Incorrect expansion of VADS Size attribute applied to an array typeGary Dismukes1-3/+3
The compiler fails, either with an Assert_Failure (for a compiler with assertions enabled) or by producing a bad value, when processing a VADS_Size attribute (or a Size attribute when pragma Use_VADS_Size is in force), in the case where the prefix denotes a composite type or subtype whose object size (Esise) is not known by the front end. The bug is due to Eval_Attribute attempting to fold a VADS-related size attribute even when Esize is not yet known for the type. gcc/ada/ChangeLog: * sem_attr.adb (Eval_Attribute): In the case of a VADS-specific size attribute, only fold to the object size when the Esize field is known.
29 hoursRemove DR_GROUP_STORE_COUNTRichard Biener2-20/+3
This was only used for non-SLP. * tree-vectorizer.h (_stmt_vec_info::store_count): Remove. (DR_GROUP_STORE_COUNT): Likewise. * tree-vect-stmts.cc (vect_transform_stmt): Remove non-SLP path.
31 hoursCleanup vect_get_num_copies APIRichard Biener3-32/+13
The following removes the dual non-SLP/SLP API in favor of only handling SLP. This also removes the possibility to override vectype of a SLP node with an inconsistent one while still using the SLP nodes number of lanes. This requires adjustment of a few places where such inconsistencies happened. * tree-vectorizer.h (vect_get_num_copies): Remove unused overload. Remove defaulted vectype argument and always use the vector type of the SLP node. * tree-vect-loop.cc (vect_reduction_update_partial_vector_usage): Adjust. (vectorizable_lane_reducing): Likewise. (vect_transform_reduction): Likewise. (vectorizable_nonlinear_induction): Likewise. * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Likewise.
31 hoursRemove SLP_TREE_NUMBER_OF_VEC_STMTSRichard Biener4-89/+63
The following removes the redundant SLP_TREE_NUMBER_OF_VEC_STMTS, replacing it with vect_get_num_copies. Previously it was already made sure that all setters adhere to that. * tree-vectorizer.h (_slp_tree::vec_stmts_size): Remove. (SLP_TREE_NUMBER_OF_VEC_STMTS): Likewise. * tree-vect-loop.cc (vectorizable_reduction): Adjust. (vect_transform_cycle_phi): Likewise. (vect_transform_lc_phi): Likewise. (vectorizable_recurr): Likewise. (vectorizable_induction): Likewise. (vectorizable_live_operation): Likewise. * tree-vect-slp.cc (_slp_tree::_slp_tree): Do not set SLP_TREE_NUMBER_OF_VEC_STMTS. (vect_slp_analyze_node_operations_1): Likewise. (vect_slp_analyze_node_operations): Likewise. (vect_prologue_cost_for_slp): Adjust. (vect_create_constant_vectors): Likewise. (vect_get_slp_vect_def): Likewise. (vect_transform_slp_perm_load_1): Likewise. (vectorizable_slp_permutation_1): Likewise. (vect_schedule_slp_node): Likewise. (vectorize_slp_instance_root_stmt): Likewise. * tree-vect-stmts.cc (vect_model_simple_cost): Likewise. (vectorizable_bswap): Likewise. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vectorizable_condition): Likewise. (vectorizable_early_exit): Likewise.
38 hoursDaily bump.GCC Administrator5-1/+275
40 hoursc: Add more C2Y testsJoseph Myers7-0/+121
Add further tests for things defined in C2Y that correspond to how GCC already behaves. Some of these are for previous undefined behavior where what is violated has become a constraint but previously was a "shall" outside Constraints. Others (c2y-anon-init-1.c and c2y-incomplete-2.c) reflect semantics that were intended all along but not correctly or sufficiently clearly stated in the standard. Tested for x86_64-pc-linux-gnu. * gcc.dg/c2y-anon-init-1.c, gcc.dg/c2y-incomplete-2.c: gcc.dg/c2y-linkage-1.c, gcc.dg/c2y-linkage-2.c, gcc.dg/c2y-linkage-3.c, gcc.dg/c2y-linkage-4.c, gcc.dg/c2y-static-assert-1.c: New tests.
41 hoursc++: tweak constexpr union diagnosticJason Merrill3-2/+19
It's now possible to see an active member of a union that has not actually been initialized, so let's clarify the diagnostic. gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_component_reference): Clarify diagnostic. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/constexpr-98122.C: Adjust diagnostic. * g++.dg/cpp26/constexpr-new6a.C: New test.
41 hoursc++: clobber class new-expressionsJason Merrill3-8/+5
Since Jakub's P2795R5 work removes the initial clobber from constructors, let's add a clobber for new of all non-empty classes. gcc/cp/ChangeLog: * init.cc (build_new_1): Clobber classes. gcc/testsuite/ChangeLog: * g++.dg/analyzer/pr97116.C: Adjust diagnostic. * g++.dg/warn/Warray-bounds-20.C: Likewise.
41 hoursc++: improve constexpr clobber handlingJason Merrill6-19/+105
r16-3022 changed placement new to clobber the object, and improved constexpr handling to do more with clobbers. But it occurred to me that in a lot of cases we don't need to introduce a constructor_elt to represent an uninitialized member of an uninitialized struct/array. gcc/cp/ChangeLog: * constexpr.cc (get_or_insert_ctor_field): -2 means don't insert. (cxx_eval_component_reference): Handle finding void_node. (cxx_eval_store_expression): Don't represent initial clobber unless we need to activate a union member. (cxx_eval_statement_list): Don't ask for a void prvalue. (cxx_eval_loop_expr): The expr is discarded-value. (cxx_eval_constant_expression): A loose clobber is non-constant. Handle getting void_node instead of a real result. (potential_constant_expression_1): A local temp is potentially-constant. * init.cc (build_new_1): Don't clobber empty types or in a template. (build_vec_init): Fix clobber handling. gcc/testsuite/ChangeLog: * g++.dg/init/pr25811.C: Tweak diagnostic. * g++.dg/warn/Warray-bounds-12.C: Likewise. * g++.dg/warn/Warray-bounds-13.C: Likewise. * g++.dg/cpp26/constexpr-new6.C: New test.
41 hoursc++: -Wmismatched-new-delete, -O0, new (nothrow)Jason Merrill2-2/+6
With new (nothrow) we need to check whether the allocation returned null, and the resulting COND_EXPR was confusing -Wmismatched-new-delete-2 at -O0. Let's help it out by appending the address if it's the same on both arms. gcc/cp/ChangeLog: * init.cc (build_new_1): Append alloc_node to checking COND_EXPR. gcc/testsuite/ChangeLog: * g++.dg/warn/Wmismatched-new-delete-2.C: Remove xfail.
42 hoursdiagnostics: add dump methods to client_data_hooks and logical_location_managerDavid Malcolm8-0/+49
gcc/ChangeLog: * diagnostics/client-data-hooks.h (client_data_hooks::dump): New. * diagnostics/context.cc (context::dump): Dump m_client_data_hooks. (client_data_hooks::dump): New. * diagnostics/logical-locations.h (logical_locations::manager::dump): New. * diagnostics/selftest-logical-locations.cc: Include "diagnostics/dumping.h". (test_manager::dump): New. * diagnostics/selftest-logical-locations.h (test_manager::dump): New decl. * libgdiagnostics.cc: Include "diagnostics/dumping.h". (impl_logical_location_manager::dump): New. * tree-logical-location.cc: Include "diagnostics/dumping.h". (tree_logical_location_manager::dump): New. * tree-logical-location.h (tree_logical_location_manager::dump): New decl. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
42 hoursdiagnostics/libcpp: convert enum location_aspect to enum classDavid Malcolm4-25/+26
Modernization; no functional change intended. gcc/ChangeLog: * diagnostics/paths-output.cc: Update for conversion of location_aspect to enum class. * diagnostics/source-printing.cc: Likewise. * input.cc: Likewise. * input.h: Likewise. libcpp/ChangeLog: * include/line-map.h (enum location_aspect): Convert to... (enum class location_aspect): ...this. * line-map.cc: Update for conversion of location_aspect to enum class. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
42 hoursdiagnostics: use diagnostic.h in fewer placesDavid Malcolm16-12/+10
No functional change intended. gcc/ChangeLog: * diagnostics/buffering.cc: Drop include of "diagnostic.h". * diagnostics/buffering.h: Likewise. * diagnostics/context.h (diagnostics::metadata): Add forward decl. * diagnostics/html-sink.cc: Drop include of "diagnostic.h". * diagnostics/lazy-paths.cc: Likewise. * diagnostics/macro-unwinding.cc: Likewise. * diagnostics/macro-unwinding.h (diagnostics:diagnostic_info): Add forward decl. * diagnostics/option-classifier.h: Include "diagnostics/option-id.h" and "diagnostics/kinds.h". (diagnostics:diagnostic_info): Add forward decl. * diagnostics/output-spec.cc: Drop include of "diagnostic.h". * diagnostics/paths-output.cc: Likewise. * diagnostics/paths.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Likewise. * diagnostics/selftest-paths.cc: Likewise. * diagnostics/source-printing-options.h: Include "rich-location.h". * diagnostics/text-sink.cc: Drop include of "diagnostic.h". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
44 hoursFix SRA issue with -ftrivial-auto-var-init= [PR121894]Qing Zhao2-1/+29
In tree-sra.cc, for the following stmt (initialization in source code): s = {}; for the above lhs "s", the field "grp_assignment_write" of the created struct access is 1; however, for the following stmt (compiler added initialization): s = .DEFERRED_INIT (size, init_type, &"s"[0]); for the above lhs "s", the field "grp_assignment_write" of the created struct access is 0; Since the field "grp_assignment_write" of the struct access for the corresponding LHS "s" is not set correctly when the RHS is .DEFERRED_INIT, SRA phase didn't do a correct transformation for call to .DEFERRED_INIT. To fix this issue, we should set the field "grp_assignment_write" correctly for .DEFERRED_INIT. PR tree-optimization/121894 gcc/ChangeLog: * tree-sra.cc (scan_function): Set grp_assignment_write to 1 when specially handle call to .DEFERRED_INIT. gcc/testsuite/ChangeLog: * g++.dg/opt/auto-init-sra-pr121894.C: New test.
44 hoursFortran: Implement PDT constructors with syntax variants [PR114815]Paul Thomas6-16/+99
2025-09-18 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/114815 * decl.cc (gfc_get_pdt_instance): Copy the contents of 'tb' and not the pointer. * primary.cc (gfc_match_rvalue): If there is only one actual argument list, use if for the type spec parameter values. If this fails try the default type specification values and use the actual arguments for the component values. * resolve.cc (build_init_assign): Don't initialize implicit PDT function results. gcc/testsuite/ PR fortran/114815 * gfortran.dg/pdt_3.f03: Add missing deallocation of 'matrix'. * gfortran.dg/pdt_17.f03: Change dg-error text. * gfortran.dg/pdt_47.f03: New test.
47 hoursRISC-V: Correct lmul estimationZhongyao Chen2-1/+35
The vectorizer's compute_estimated_lmul function could previously return a bad value when the estimated lmul was larger than RVV_M8. This is corrected to return RVV_M8, preventing a register spill. The patch includes a new regression test for PR target/121910, based on the x264 mc_chroma function. The test uses scan-tree-dump to confirm that the compiler chooses the expected vector mode (RVVM1QI) at -O3, verifying the fix. PR target/121910 gcc/ChangeLog: * config/riscv/riscv-vector-costs.cc (compute_estimated_lmul): Return RVV_M8 when estimated lmul is too large. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr121910.c: New file.
48 hoursopenmp: Fix up ICE in lower_omp_regimplify_operands_p [PR121977]Jakub Jelinek2-0/+19
The following testcase ICEs in functions called from lower_omp_regimplify_operands_p, because maybe_lookup_decl returns NULL for this (on the outer taskloop context) when regimplifying the taskloop pre body. If it isn't found in current context, we should look in outer ones. 2025-09-18 Jakub Jelinek <jakub@redhat.com> PR c++/121977 * omp-low.cc (lower_omp_regimplify_operands_p): If maybe_lookup_decl returns NULL, use maybe_lookup_decl_in_outer_ctx as fallback. * g++.dg/gomp/pr121977.C: New test.
2 daysAArch64: Add SME LUTv2 intrinsicsKarl Meakin13-4/+1398
Add intrinsic functions for the SME LUTv2 architecture extension (`svluti4_zt`, `svwrite_lane_zt` and `svwrite_zt`). gcc/ChangeLog: * config/aarch64/aarch64-sme.md (@aarch64_sme_write_zt<SVE_FULL:mode>): New insn. (aarch64_sme_lut_zt): Likewise. * config/aarch64/aarch64-sve-builtins-shapes.cc (parse_type): New type format "%T". (struct luti_lane_zt_base): New function shape. (SHAPE): Likewise. (struct write_zt_def): Likewise. (struct write_lane_zt_def): Likewise. * config/aarch64/aarch64-sve-builtins-shapes.h: New function shape. * config/aarch64/aarch64-sve-builtins-sme.cc (class svluti_zt_impl): New function expander. (class svwrite_zt_impl): Likewise. (class svwrite_lane_zt_impl): Likewise. (FUNCTION): Likewise * config/aarch64/aarch64-sve-builtins-sme.def (svwrite_zt): New function shape. (svwrite_lane_zt): Likewise. (svluti4_zt): Likewise. * config/aarch64/aarch64-sve-builtins-sme.h: New function base. * config/aarch64/aarch64-sve-builtins.h: Mention the arrays of function_group_info by name. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sme2/acle-asm/svluti4_zt_1.c: New test. * gcc.target/aarch64/sme2/acle-asm/svwrite_lane_zt_1.c: New test. * gcc.target/aarch64/sme2/acle-asm/svwrite_zt_1.c: New test. * gcc.target/aarch64/sve/acle/general-c/svluti4_zt_1.c: New test. * gcc.target/aarch64/sve/acle/general-c/svwrite_lane_zt_1.c: New test. * gcc.target/aarch64/sve/acle/general-c/svwrite_zt_1.c: New test.
2 daysAArch64: Add SME LUTv2 architecture extensionKarl Meakin4-1/+11
Add the SME LUTv2 architecture extension. Users can enable the extension by adding `+sme-lutv2` to `-march` or `-mcpu`, and test for its presence with the `__ARM_FEATURE_SME_LUTv2` macro. The intrinsics will be added in the next commit. gcc/ChangeLog: * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Conditonally define `__ARM_FEATURE_SME_LUTv2" macro. * config/aarch64/aarch64-option-extensions.def (AARCH64_OPT_EXTENSION("sme-lutv2")): New optional architecture extension. * config/aarch64/aarch64.h (TARGET_SME_LUTv2): New macro. * doc/invoke.texi: Document `+sme-lutv2` flag.
2 daysRISC-V: Add test case of unsigned scalar SAT_MUL form 5 for widen-mulPan Li9-0/+123
The form 5 of unsigned scalar SAT_MUL is covered in middle-expand alreay, add test case here to cover form 5. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat/sat_arith.h: Add test helper macros. * gcc.target/riscv/sat/sat_u_mul-6-u16-from-u128.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u32-from-u128.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u64-from-u128.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u8-from-u128.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u128.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u32-from-u128.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u64-from-u128.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u128.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2 daysMatch: Add form 5 of unsigned SAT_MUL for widen-mulPan Li2-0/+26
This patch would like to try to match the the unsigned SAT_MUL form 4, aka below: #define DEF_SAT_U_MUL_FMT_5(NT, WT) \ NT __attribute__((noinline)) \ sat_u_mul_##NT##_from_##WT##_fmt_5 (NT a, NT b) \ { \ WT x = (WT)a * (WT)b; \ NT hi = x >> (sizeof(NT) * 8); \ NT lo = (NT)x; \ return lo | -!!hi; \ } while WT is uint128_t, T is uint8_t, uint16_t, uint32_t or uint64_t. gcc/ChangeLog: * match.pd: Add pattern for SAT_MUL form 5. * tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children): Try match pattern for IOR. Signed-off-by: Pan Li <pan2.li@intel.com>
2 daysFix verification ICE after ipa-cpJan Hubicka1-1/+8
I managed to reproduce the ICE. The error is verification error about callgraph edge count being different from basic block count of the corresponding call stmt. This verification is only done for local profiles, since IPA profiles are scaled during inlining, cloning and other transformations. Ipa-cp has logic special casis self recursive functions and it adjust probability of the recursion to avoid non-sential IPA profiles. Normally this is not done for local profiles, however in case the IPA profile is broken enought the earlier logic will push clone profiles to be local which in turn causes the verifier error. This patch simply disables the update. Its main purpose is to keep IPA profile seemingly meaningful and the upate is never applied back to gimple code. Alternative would be to add machinery to adjust frequencies of call edges, but I do not think it is worth the effort at this moment. Bootstrapped/regtested x86_64-linux, comitted. gcc/ChangeLog: * ipa-cp.cc (update_counts_for_self_gen_clones): Do not update call frequency for local profiles.
2 daystree-optimization/87615 - VN predication is expensiveRichard Biener1-23/+45
The following restricts the number of locations we register a predicate as valid which avoids the expensive linear search for cases like if (a) A; if (a) B; if (a) C; ... where we register a != 0 as true for locations A, B, C ... in an unlimited way. The patch simply choses 8 as limit. The underlying issue for this case is the data structure which does not allow for easy "forgetting" or more optimal searching when locations become no longer relevant (the whole point of the location list is to represent where predicates are relevant). The patch also splits the search/copy loop into two to avoid copying stuff that we'll not need when finding an existing better entry or, new now, when we figure we run over the limit. PR tree-optimization/87615 * tree-ssa-sccvn.cc (vn_nary_op_insert_into): When inserting a new predicate or location into an existing predicate list make sure to not exceed 8 locations. Avoid copying things when we later eventually throw them away. (vn_nary_op_insert_pieces_predicated): Avoid expensive check when not checking. (dominated_by_p_w_unex): Apply the limit on a single successors predecessor count consistently.