- Jan 07, 2025
-
-
Piotr Trojanek authored
Code cleanup suggested by GNATcheck rule Constant_Overlays. gcc/ada/ChangeLog: * repinfo-input.adb (Decode_Name, Read_Name_With_Prefix): Use constant overlay with pragma Import.
-
Piotr Trojanek authored
A code cleanup in routine intended to be used from DGB, suggested by running GNATcheck rule Boolean_Negations. However, this code can be tuned to protect against more illegal uses. gcc/ada/ChangeLog: * exp_disp.adb (Write_DT): Add guards that prevent crashes on illegal node numbers.
-
Piotr Trojanek authored
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * diagnostics-pretty_emitter.adb (Get_Last_Line_Char): Fix whitespace. * sem_aggr.adb (Resolve_Array_Aggregate): Fix style.
-
Piotr Trojanek authored
Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_util.adb (Is_Null_Record_Definition): Remove check for Component_List being present after using it; replace check for component item being a component declaration with an assertion; fix style in comment.
-
Ronan Desplanques authored
This patch fixes two problems with how abort was deferred in finally parts. First, calls to runtime subprograms are now omitted when aborting is disallowed by active restrictions. Second, Abort_Undefer is now correctly called when the finally part propagates an exception. gcc/ada/ChangeLog: * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Fix abort deferral.
-
Steve Baird authored
In some cases, the RM 8.5.1(3.1) legality rule about uses of renamings of limited views of packages was implemented incorrectly, resulting in rejecting legal uses. gcc/ada/ChangeLog: * gen_il-fields.ads: add new Renames_Limited_View field. * gen_il-gen-gen_entities.adb: add Renames_Limited_View flag for packages. * einfo.ads: add comment documenting Renames_Limited_View flag. * sem_ch8.adb (Analyze_Package_Renaming): Set new Renames_Limited_View flag. Test new Renames_Limited_View flag instead of calling Has_Limited_With. If Has_Limited_With is True, that just means that somebody, sometime during this compilation needed to reference the limited view of the package; so that function returns True too often to be used here. (Find_Expanded_Name): Test new Renames_Limited_View flag instead of calling Has_Limited_With.
-
Piotr Trojanek authored
Code cleanup; behavior is unaffected. Flag Is_Inherited_Pragma is only set in GNAT, but is not actually used, neither by the compiler nor by any backend. gcc/ada/ChangeLog: * contracts.adb (Inherit_Pragma): Don't set flag Is_Inherited_Pragma. * gen_il-fields.ads (Opt_Field_Enum): Remove field identifier. * gen_il-gen-gen_nodes.adb (N_Pragma): Remove field from node. * sinfo.ads (Is_Inherited_Pragma): Remove field description. (N_Pragma): Remove field reference.
-
Piotr Trojanek authored
Code cleanup. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Attribute): Replace runtime conversion with existing constant.
-
Piotr Trojanek authored
Code cleanup; given that no attribute is both defined by Ada 83 and specific to GNAT, the semantics is unaffected. gcc/ada/ChangeLog: * sem_attr.adb (Analyze_Attribute): Simplify logic.
-
Piotr Trojanek authored
Use existing machinery for internal attributes to handle attributes related to Ada 2012 iterators. All these attributes exist exclusively as a mean to delay processing. Code cleanup. The only change in behavior is the wording of error emitted when one of the internal attributes appears in source code: from "illegal attribute" (which used to be emitted in the analysis) to "unrecognized attribute (which is emitted by the parser). gcc/ada/ChangeLog: * exp_attr.adb (Expand_N_Attribute_Reference): Remove explicit handling of attributes related to Ada 2012 iterators. * sem_attr.adb (Analyze_Attribute, Eval_Attribute): Likewise; move attribute Reduce according to alphabetic order. * snames.adb-tmpl (Get_Attribute_Id): Add support for new internal attributes. * snames.ads-tmpl: Recognize names of new internal attributes. (Attribute_Id): Recognize new internal attributes. (Internal_Attribute_Id): Likewise. (Is_Internal_Attribute_Name): Avoid duplication in comment.
-
Piotr Trojanek authored
Code cleanup related to work on expression functions for GNATprove (which require accessibility checks even when they are not expanded and thus have no explicit return statements). gcc/ada/ChangeLog: * accessibility.adb (First_Selector): Remove redundant and locally inconsistent parenthesis. (Check_Return_Construct_Accessibility): Remove qualifier from list operation. * sem_util.adb (Is_Prim_Of_Abst_Type_With_Nonstatic_CW_Pre_Post): Likewise.
-
Eric Botcazou authored
The problem is that we analyze references to an object before the actual subtype of the object is established, thus creating a type mismatch that is flagged by the code generator. gcc/ada/ChangeLog: * exp_ch7.ads (Store_After_Actions_In_Scope_Without_Analysis): New procedure declaration. * exp_ch7.adb (Store_New_Actions_In_Scope): New procedure. (Store_Actions_In_Scope): Call Store_New_Actions_In_Scope when the target list is empty. (Store_After_Actions_In_Scope_Without_Analysis): New procedure body. * exp_aggr.adb (Expand_Container_Aggregate): For a declaration that is wrapped in a transient scope, also defer the analysis of the new code until after the declaration is analyzed.
-
Eric Botcazou authored
There is no need to keep multiplying the result once it saturates to +Inf. gcc/ada/ChangeLog: * libgnat/s-powflt.ads (Maxpow_Exact): Minor comment fix. * libgnat/s-powlfl.ads (Maxpow_Exact): Likewise. * libgnat/s-powllf.ads (Maxpow_Exact): Likewise. * libgnat/s-valrea.adb (Large_Powfive) [1 parameter]: Exit the loop as soon as the result saturates to +Inf. (Large_Powfive) [2 parameters]: Likewise.
-
Alexandre Oliva authored
Adding -msmp to linker options in system-vxworks-ppc-rtp-smp.ads obviated vxworks-smp-ppc-link.spec. Drop it. gcc/ada/ChangeLog: * libgnat/system-vxworks-ppc-rtp-smp.ads: Drop --specs=vxworks-ppc-link.spec from Linker_Options. * vxworks-smp-ppc-link.spec: Delete.
-
Ronan Desplanques authored
This patch adds a new reserved word, "finally", and accompanying new syntax that's similar to the Java equivalent. gcc/ada/ChangeLog: * atree.adb (Parent_Or_List_Containing): New function. * atree.ads (Parent_Or_List_Containing): Likewise. * gen_il-fields.ads: Add new field. * gen_il-gen-gen_nodes.adb (Gen_Nodes): Extend handled sequence of statements node. * par-ch11.adb (P_Handled_Sequence_Of_Statements, P_Exception_Handler): Add new syntactic construct. * par-ch5.adb (P_Sequence_Of_Statements): Likewise. * par.adb: Likewise. * par-util.adb (Check_Future_Keyword): Warn that "finally" becomes a reserved word with extensions. * scans.adb (Initialize_Ada_Keywords): Add new reserved word. * snames.adb-tmpl: Likewise. * snames.ads-tmpl: Likewise. * scans.ads: Likewise. * sem_ch11.adb (Analyze_Handled_Statements): Adapt to new node field. * sem_ch5.adb (Analyze_Exit_Statement): Add legality check. (Analyze_Goto_Statement): Likewise. * sem_ch6.adb (Analyze_Return_Statement): Likewise. * sinfo-utils.adb (Lowest_Common_Ancestor, Destroy_Element): New subprograms. * sinfo-utils.ads (Lowest_Common_Ancestor): New function. * sinfo.ads: Add documentation for new field. * xsnamest.adb: Fix typo in comment. * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. * warnsw.adb: Add new option. * warnsw.ads: Likewise. * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Add abort deferral to finally part. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. * gcc-interface/trans.cc (Handled_Sequence_Of_Statements_to_gnu): Handle finally statements.
-
Eric Botcazou authored
The in-place expansion has been historically disabled for them, but there does not seem to be any good reason left for this. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Array_Aggregate): Do not exclude aggregates of bit-packed array types in assignments from in-place expansion.
-
Piotr Trojanek authored
Functions with aspect Side_Effects should not reference attribute Result in consequences of their aspect Exceptional_Cases. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Cases_In_Decl_Part): Reject references to attribute Result.
-
Piotr Trojanek authored
Previously checks for consequence expressions of Exceptional_Cases aspects were done in GNATprove backend. However, we can do them in the frontend, where they will apply to all subprograms, regardless of the SPARK_Mode aspect. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Cases_In_Decl_Part): Move check from GNATprove backend to GNAT frontend.
-
Piotr Trojanek authored
The comment about Subprogram_Variant was outdated after more types have been allowed by the corresponding SPARK RM rule; the comment about Exceptional_Cases was incorrect, after being copy-pasted. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Contract, Analyze_Variant): Fix comments.
-
Steve Baird authored
If a Put_Image aspect specification (introduced in Ada 2022) is given for a fixed point type Fx, then in some cases a call to Fx'Base'Image would incorrectly ignore the aspect specification and would instead return the pre-Ada2022 version of the image. However, a call to Fx'Image would do the right thing. gcc/ada/ChangeLog: * exp_put_image.adb (Image_Should_Call_Put_Image): Cope with the case where the attribute prefix for an Image attribute reference denotes an Itype constructed for a fixed point type. Calling Has_Aspect with such an Itype misses applicable aspect specifications; we need to look on the right list. This comes up if the prefix of the attribute reference is Some_Fixed_Point_Type'Base.
-
Gary Dismukes authored
The compiler wasn't accounting for default subtypes on generic formal types that reference other formal types of the same generic, leading to errors about invalid subtypes. Several other problems that could lead to blowups or incorrect errors were noticed through testing related cases and fixed along the way. gcc/ada/ChangeLog: * sem_ch12.adb (Analyze_One_Association): In the case of a formal type that has a Default_Subtype_Mark that does not have its Entity field set, this means the default refers to another formal type of the same generic formal part, so locate the matching subtype in the Result_Renamings and set Match's Entity to that subtype prior to the call to Instantiate_Type. (Validate_Formal_TypeDefault.Reference_Formal): Add test of Entity being Present, to prevent blowups on End_Label ids (which don't have Entity set). (Validate_Formal_Type_Default.Validate_Derived_Type_Default): Apply Base_Type to Formal. (Validate_Formal_Type_Default): Guard interface-related semantic checks with a test of Is_Tagged_Type.
-
Eric Botcazou authored
This uses the syntax of Ada 2012 if-expression in the output produced by the -gnatR3 switch for dynamic expressions. gcc/ada/ChangeLog: * repinfo.adb (List_GCC_Expression.Print_Expr) <Cond_Expr>: Do not output the final "end".
-
Johannes Kanig authored
When invoked by gnat2why, the Warning_Doc_Switch was unintenionally reset. gcc/ada/ChangeLog: * gnat1drv.adb: (SPARK_Library_Warning): preserve Warning_Doc_Switch
-
Eric Botcazou authored
There is no need to build a cleanup if exceptions cannot be propagated. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_Allocator_Expression): Do not build a cleanup if restriction No_Exception_Propagation is active. * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise.
-
Andre Vehreschild authored
gcc/fortran/ChangeLog: PR fortran/114612 * trans-array.cc (structure_alloc_comps): Ensure deep copy is also done for types having cycles. gcc/testsuite/ChangeLog: * gfortran.dg/alloc_comp_deep_copy_4.f03: New test.
-
Deng Jianbo authored
In LoongArch, currently uses instruction movgr2fr.{d|w} to move zero from fixed-point register to floating-pointer regsiter for initializing fp register to zero. When LSX or LASX is enabled, we can use instruction vxor.v which has lower latency than instruction movgr2fr.{d|w} to set fp register to zero directly. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_output_move): Optimize instructions for initializing fp regsiter to zero. gcc/testsuite/ChangeLog: * gcc.target/loongarch/mov-zero-1.c: New test. * gcc.target/loongarch/mov-zero-2.c: New test.
-
Gaius Mulley authored
This patch combines fixes for both PR-118010 (Wtypemismatch) and PR-118183 (unable to rebuild the bootstrap tools). PR-118010 required a new data type (COFF_T) to be exported from SYSTEM and used in all return types for libc.lseek. The patch also includes COFF_T implemented in mc and this data type has been propagated though the translated versions of pge and mc. Finally the patch adjusts the modula-2 declaration of location_t to reflect the new gcc 64 bit type. A new command line option -fm2-file-offset-bits= has been implemented to override the default 64 bit declaration of COFF_T. gcc/ChangeLog: PR modula2/118010 * doc/gm2.texi (Compiler options): New option -fm2-file-offset-bits=. gcc/m2/ChangeLog: PR modula2/118010 PR modula2/118183 * gm2-compiler/M2GCCDeclare.mod (Import): COffT, GetCOffTType. (DeclareDefaultSimpleTypes): Declare COFF_T. * gm2-compiler/M2GenGCC.mod (GetParamSize): Correct first parameter to BuildSize to use location rather than a token position. * gm2-compiler/M2Options.def (SetFileOffsetBits): New procedure. (GetFileOffsetBits): New procedure function. * gm2-compiler/M2Options.mod (SetFileOffsetBits): New procedure. (GetFileOffsetBits): New procedure function. (OffTBits): New variable. * gm2-compiler/M2System.def (COffT): New variable. * gm2-compiler/M2System.mod (MakeExtraSystemTypes): Declare COffT. * gm2-compiler/P1SymBuild.mod (EndBuildProcedure): Call PutProcedureDefined. * gm2-compiler/P2SymBuild.mod (Debug): Reimplement. * gm2-compiler/SymbolTable.mod (InitProcedureDeclaration): Initialize ProcedureTok. * gm2-gcc/gcctypes.def (location_t): Declare as CARDINAL64. * gm2-gcc/m2linemap.cc (m2linemap_GetLocationBinary): Add call to linemap_add indication a LC_LEAVE. * gm2-gcc/m2options.h (M2Options_SetFileOffsetBits): New procedure. (M2Options_GetFileOffsetBits): New procedure function. * gm2-gcc/m2type.cc (m2_offt_type_node): New variable. (m2type_GetCSizeTType): Reword comment. (m2type_GetCSSizeTType): Reword comment. (m2type_GetCOffTType): New function. (build_m2_offt_type_node): New function. (m2type_InitSystemTypes): Initialize m2_offt_type_node. * gm2-gcc/m2type.def (GetCSizeTType): Reword comment. (GetCOffTType): New procedure function. * gm2-gcc/m2type.h (m2type_GetCOffTType): New prototype. * gm2-lang.cc (gm2_langhook_handle_option): New clause OPT_fm2_file_offset_bits_. * gm2-libs-coroutines/SYSTEM.def: Add COFF_T to export list. * gm2-libs-iso/SYSTEM.def: Ditto. * gm2-libs-min/SYSTEM.def: Ditto. * gm2-libs/SYSTEM.def: Add COFF_T and CARDINAL64 to export list. * gm2-libs/libc.def (lseek): Change return type to COFF_T. * lang.opt (-fm2-file-offset-bits=): New option. * mc-boot-ch/Glibc.c (libc_lseek): Change result to use off_t. * mc-boot/GASCII.cc: Rebuilt. * mc-boot/GASCII.h: Ditto. * mc-boot/GArgs.cc: Ditto. * mc-boot/GArgs.h: Ditto. * mc-boot/GAssertion.cc: Ditto. * mc-boot/GAssertion.h: Ditto. * mc-boot/GBreak.cc: Ditto. * mc-boot/GBreak.h: Ditto. * mc-boot/GCOROUTINES.h: Ditto. * mc-boot/GCmdArgs.cc: Ditto. * mc-boot/GCmdArgs.h: Ditto. * mc-boot/GDebug.cc: Ditto. * mc-boot/GDebug.h: Ditto. * mc-boot/GDynamicStrings.cc: Ditto. * mc-boot/GDynamicStrings.h: Ditto. * mc-boot/GEnvironment.cc: Ditto. * mc-boot/GEnvironment.h: Ditto. * mc-boot/GFIO.cc: Ditto. * mc-boot/GFIO.h: Ditto. * mc-boot/GFormatStrings.cc: Ditto. * mc-boot/GFormatStrings.h: Ditto. * mc-boot/GFpuIO.cc: Ditto. * mc-boot/GFpuIO.h: Ditto. * mc-boot/GIO.cc: Ditto. * mc-boot/GIO.h: Ditto. * mc-boot/GIndexing.cc: Ditto. * mc-boot/GIndexing.h: Ditto. * mc-boot/GM2Dependent.cc: Ditto. * mc-boot/GM2Dependent.h: Ditto. * mc-boot/GM2EXCEPTION.cc: Ditto. * mc-boot/GM2EXCEPTION.h: Ditto. * mc-boot/GM2RTS.cc: Ditto. (M2RTS_Halt): Call libc_exit. (M2RTS_HaltC): Ditto. * mc-boot/GM2RTS.h: Rebuilt. * mc-boot/GMemUtils.cc: Ditto. * mc-boot/GMemUtils.h: Ditto. * mc-boot/GNumberIO.cc: Ditto. * mc-boot/GNumberIO.h: Ditto. * mc-boot/GPushBackInput.cc: Ditto. * mc-boot/GPushBackInput.h: Ditto. * mc-boot/GRTExceptions.cc: Ditto. * mc-boot/GRTExceptions.h: Ditto. * mc-boot/GRTco.h: Ditto. * mc-boot/GRTentity.h: Ditto. * mc-boot/GRTint.cc: Ditto. * mc-boot/GRTint.h: Ditto. * mc-boot/GSArgs.cc: Ditto. * mc-boot/GSArgs.h: Ditto. * mc-boot/GSFIO.cc: Ditto. * mc-boot/GSFIO.h: Ditto. * mc-boot/GSYSTEM.h: Ditto. * mc-boot/GSelective.h: Ditto. * mc-boot/GStdIO.cc: Ditto. * mc-boot/GStdIO.h: Ditto. * mc-boot/GStorage.cc: Ditto. * mc-boot/GStorage.h: Ditto. * mc-boot/GStrCase.cc: Ditto. * mc-boot/GStrCase.h: Ditto. * mc-boot/GStrIO.cc: Ditto. * mc-boot/GStrIO.h: Ditto. * mc-boot/GStrLib.cc: Ditto. * mc-boot/GStrLib.h: Ditto. * mc-boot/GStringConvert.cc: Ditto. * mc-boot/GStringConvert.h: Ditto. * mc-boot/GSysExceptions.h: Ditto. * mc-boot/GSysStorage.cc: Ditto. * mc-boot/GSysStorage.h: Ditto. * mc-boot/GTimeString.cc: Ditto. * mc-boot/GTimeString.h: Ditto. * mc-boot/GUnixArgs.h: Ditto. * mc-boot/Galists.cc: Ditto. * mc-boot/Galists.h: Ditto. * mc-boot/Gdecl.cc: Ditto. * mc-boot/Gdecl.h: Rebuilt. * mc-boot/Gdtoa.h: Ditto. * mc-boot/Gerrno.h: Ditto. * mc-boot/Gkeyc.cc: Ditto. * mc-boot/Gkeyc.h: Rebuilt. * mc-boot/Gldtoa.h: Ditto. * mc-boot/Glibc.h: Ditto. * mc-boot/Glibm.h: Ditto. * mc-boot/Glists.cc: Ditto. * mc-boot/Glists.h: Ditto. * mc-boot/GmcComment.cc: Ditto. * mc-boot/GmcComment.h: Ditto. * mc-boot/GmcComp.cc: Ditto. * mc-boot/GmcComp.h: Ditto. * mc-boot/GmcDebug.cc: Ditto. * mc-boot/GmcDebug.h: Ditto. * mc-boot/GmcError.cc: Ditto. * mc-boot/GmcError.h: Ditto. * mc-boot/GmcFileName.cc: Ditto. * mc-boot/GmcFileName.h: Ditto. * mc-boot/GmcLexBuf.cc: Ditto. * mc-boot/GmcLexBuf.h: Ditto. * mc-boot/GmcMetaError.cc: Ditto. * mc-boot/GmcMetaError.h: Ditto. * mc-boot/GmcOptions.cc: Ditto. * mc-boot/GmcOptions.h: Ditto. * mc-boot/GmcPreprocess.cc: Ditto. * mc-boot/GmcPreprocess.h: Ditto. * mc-boot/GmcPretty.cc: Ditto. * mc-boot/GmcPretty.h: Ditto. * mc-boot/GmcPrintf.cc: Ditto. * mc-boot/GmcPrintf.h: Ditto. * mc-boot/GmcQuiet.cc: Ditto. * mc-boot/GmcQuiet.h: Ditto. * mc-boot/GmcReserved.cc: Ditto. * mc-boot/GmcReserved.h: Ditto. * mc-boot/GmcSearch.cc: Ditto. * mc-boot/GmcSearch.h: Ditto. * mc-boot/GmcStack.cc: Ditto. * mc-boot/GmcStack.h: Ditto. * mc-boot/GmcStream.cc: Ditto. * mc-boot/GmcStream.h: Ditto. * mc-boot/Gmcflex.h: Ditto. * mc-boot/Gmcp1.cc: Ditto. * mc-boot/Gmcp1.h: Ditto. * mc-boot/Gmcp2.cc: Ditto. * mc-boot/Gmcp2.h: Ditto. * mc-boot/Gmcp3.cc: Ditto. * mc-boot/Gmcp3.h: Ditto. * mc-boot/Gmcp4.cc: Ditto. * mc-boot/Gmcp4.h: Ditto. * mc-boot/Gmcp5.cc: Ditto. * mc-boot/Gmcp5.h: Ditto. * mc-boot/GnameKey.cc: Ditto. * mc-boot/GnameKey.h: Ditto. * mc-boot/GsymbolKey.cc: Ditto. * mc-boot/GsymbolKey.h: Ditto. * mc-boot/Gtermios.h: Ditto. * mc-boot/Gtop.cc: Ditto. * mc-boot/Gvarargs.cc: Ditto. * mc-boot/Gvarargs.h: Ditto. * mc-boot/Gwlists.cc: Ditto. * mc-boot/Gwlists.h: Ditto. * mc-boot/Gwrapc.h: Ditto. * mc/decl.mod (cofft): New enum. (cardinal64): Ditto. (cofftN): New variable. (cardinal64N): Ditto. (isProcedure): Remove. (getSymName): Add clause for cofft and cardinal64. (makeBase): Ditto. (isOrdinal): Ditto. (getType): Ditto. (doGetExprType): Ditto. (getScope): Ditto. (doExprC): Ditto. (isSystem): Ditto. (doSystemC): Ditto. (doDependants): Ditto. (visitDependants): Ditto. (genKind): Ditto. (doSystemM2): Ditto. (doDupExpr): Ditto. (makeSystem): Initialize cofftN and cardinal64N. * mc/keyc.mod (useUIntMin): Remove. (useUIntMax): Ditto. * pge-boot/GIndexing.h: Rebuilt. * pge-boot/GSEnvironment.h: Ditto. * pge-boot/GScan.h: Ditto. * pge-boot/Glibc.h: Ditto. Signed-off-by:
Gaius Mulley <gaiusmod2@gmail.com>
-
Andre Vehreschild authored
Using cycles in derived/class types lead to the compiler doing a endless recursion in several locations, when the cycle was not immediate. An immediate cyclic dependency is present in, for example T T::comp. Cylcic dependencies of the form T T2::comp; T2 T::comp2; are now detected and the recursive bit in the derived type's attr is set. gcc/fortran/ChangeLog: PR fortran/116669 * class.cc (gfc_find_derived_vtab): Use attr to determine cyclic type dependendies. * expr.cc (gfc_has_default_initializer): Prevent endless recursion by storing already visited derived types. * resolve.cc (resolve_cyclic_derived_type): Determine if a type is used in its hierarchy in a cyclic way. (resolve_fl_derived0): Call resolve_cyclic_derived_type. (resolve_fl_derived): Ensure vtab is generated when cyclic derived types have allocatable components. * trans-array.cc (structure_alloc_comps): Prevent endless loop for derived type cycles. * trans-expr.cc (gfc_get_ultimate_alloc_ptr_comps_caf_token): Off topic, just prevent memory leaks. gcc/testsuite/ChangeLog: * gfortran.dg/class_array_15.f03: Freeing more memory. * gfortran.dg/recursive_alloc_comp_6.f90: New test.
-
Jennifer Schmitz authored
This patch removes the AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS tunable and use_new_vector_costs entry in aarch64-tuning-flags.def and makes the AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS paths in the backend the default. To that end, the function aarch64_use_new_vector_costs_p and its uses were removed. To prevent costing vec_to_scalar operations with 0, as described in https://gcc.gnu.org/pipermail/gcc-patches/2024-October/665481.html , we adjusted vectorizable_store such that the variable n_adjacent_stores also covers vec_to_scalar operations. This way vec_to_scalar operations are not costed individually, but as a group. As suggested by Richard Sandiford, the "known_ne" in the multilane-check was replaced by "maybe_ne" in order to treat nunits==1+1X as a vector rather than a scalar. Two tests were adjusted due to changes in codegen. In both cases, the old code performed loop unrolling once, but the new code does not: Example from gcc.target/aarch64/sve/strided_load_2.c (compiled with -O2 -ftree-vectorize -march=armv8.2-a+sve -mtune=generic -moverride=tune=none): f_int64_t_32: cbz w3, .L92 mov x4, 0 uxtw x3, w3 + cntd x5 + whilelo p7.d, xzr, x3 + mov z29.s, w5 mov z31.s, w2 - whilelo p6.d, xzr, x3 - mov x2, x3 - index z30.s, #0, #1 - uqdecd x2 - ptrue p5.b, all - whilelo p7.d, xzr, x2 + index z30.d, #0, #1 + ptrue p6.b, all .p2align 3,,7 .L94: - ld1d z27.d, p7/z, [x0, #1, mul vl] - ld1d z28.d, p6/z, [x0] - movprfx z29, z31 - mul z29.s, p5/m, z29.s, z30.s - incw x4 - uunpklo z0.d, z29.s - uunpkhi z29.d, z29.s - ld1d z25.d, p6/z, [x1, z0.d, lsl 3] - ld1d z26.d, p7/z, [x1, z29.d, lsl 3] - add z25.d, z28.d, z25.d + ld1d z27.d, p7/z, [x0, x4, lsl 3] + movprfx z28, z31 + mul z28.s, p6/m, z28.s, z30.s + ld1d z26.d, p7/z, [x1, z28.d, uxtw 3] add z26.d, z27.d, z26.d - st1d z26.d, p7, [x0, #1, mul vl] - whilelo p7.d, x4, x2 - st1d z25.d, p6, [x0] - incw z30.s - incb x0, all, mul #2 - whilelo p6.d, x4, x3 + st1d z26.d, p7, [x0, x4, lsl 3] + add z30.s, z30.s, z29.s + incd x4 + whilelo p7.d, x4, x3 b.any .L94 .L92: ret Example from gcc.target/aarch64/sve/strided_store_2.c (compiled with -O2 -ftree-vectorize -march=armv8.2-a+sve -mtune=generic -moverride=tune=none): f_int64_t_32: cbz w3, .L84 - addvl x5, x1, #1 mov x4, 0 uxtw x3, w3 - mov z31.s, w2 + cntd x5 whilelo p7.d, xzr, x3 - mov x2, x3 - index z30.s, #0, #1 - uqdecd x2 - ptrue p5.b, all - whilelo p6.d, xzr, x2 + mov z29.s, w5 + mov z31.s, w2 + index z30.d, #0, #1 + ptrue p6.b, all .p2align 3,,7 .L86: - ld1d z28.d, p7/z, [x1, x4, lsl 3] - ld1d z27.d, p6/z, [x5, x4, lsl 3] - movprfx z29, z30 - mul z29.s, p5/m, z29.s, z31.s - add z28.d, z28.d, #1 - uunpklo z26.d, z29.s - st1d z28.d, p7, [x0, z26.d, lsl 3] - incw x4 - uunpkhi z29.d, z29.s + ld1d z27.d, p7/z, [x1, x4, lsl 3] + movprfx z28, z30 + mul z28.s, p6/m, z28.s, z31.s add z27.d, z27.d, #1 - whilelo p6.d, x4, x2 - st1d z27.d, p7, [x0, z29.d, lsl 3] - incw z30.s + st1d z27.d, p7, [x0, z28.d, uxtw 3] + incd x4 + add z30.s, z30.s, z29.s whilelo p7.d, x4, x3 b.any .L86 .L84: ret The patch was bootstrapped and tested on aarch64-linux-gnu, no regression. OK for mainline? Signed-off-by:
Jennifer Schmitz <jschmitz@nvidia.com> gcc/ * tree-vect-stmts.cc (vectorizable_store): Extend the use of n_adjacent_stores to also cover vec_to_scalar operations. * config/aarch64/aarch64-tuning-flags.def: Remove use_new_vector_costs as tuning option. * config/aarch64/aarch64.cc (aarch64_use_new_vector_costs_p): Remove. (aarch64_vector_costs::add_stmt_cost): Remove use of aarch64_use_new_vector_costs_p. (aarch64_vector_costs::finish_cost): Remove use of aarch64_use_new_vector_costs_p. * config/aarch64/tuning_models/cortexx925.h: Remove AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS. * config/aarch64/tuning_models/fujitsu_monaka.h: Likewise. * config/aarch64/tuning_models/generic_armv8_a.h: Likewise. * config/aarch64/tuning_models/generic_armv9_a.h: Likewise. * config/aarch64/tuning_models/neoverse512tvb.h: Likewise. * config/aarch64/tuning_models/neoversen2.h: Likewise. * config/aarch64/tuning_models/neoversen3.h: Likewise. * config/aarch64/tuning_models/neoversev1.h: Likewise. * config/aarch64/tuning_models/neoversev2.h: Likewise. * config/aarch64/tuning_models/neoversev3.h: Likewise. * config/aarch64/tuning_models/neoversev3ae.h: Likewise. gcc/testsuite/ * gcc.target/aarch64/sve/strided_load_2.c: Adjust expected outcome. * gcc.target/aarch64/sve/strided_store_2.c: Likewise.
-
Sam James authored
gcc/testsuite/ChangeLog: PR ipa/98000 * g++.dg/ipa/pr98000.C: New test.
-
Sam James authored
PR117546 was fixed by Eric's r14-10693-gadab597af288d6 change, but the testcase here is sufficiently different to be worth including in torture/. gcc/testsuite/ChangeLog: PR ipa/117546 * gcc.dg/torture/pr117546.c: New test.
-
GCC Administrator authored
-
- Jan 06, 2025
-
-
Alexandre Oliva authored
A gimple block with __builtin_unreachable () can't have code after it, and gimple optimizers ensure there isn't any, even without optimization. But if the block requires stack adjustments, e.g. because of a call that passes arguments on the stack, expand will emit that after the barrier, and then rtl checkers rightfully complain. Arrange to discard adjustments after a barrier. Strub expanders seem to be necessary to bring about the exact conditions that require stack adjustments after the block that ends with a __builtin_unreachable call. for gcc/ChangeLog PR middle-end/118006 * cfgexpand.cc (expand_gimple_basic_block): Do not emit pending stack adjustments after a barrier. for gcc/testsuite/ChangeLog PR middle-end/118006 * gcc.target/i386/strub-pr118006.c: New.
-
Akram Ahmad authored
GIMPLE code which performs a narrowing truncation on the result of a vector concatenation currently results in an unnecessary XTN being emitted following a UZP1 to concate the operands. In cases such as this, UZP1 should instead use a smaller arrangement specifier to replace the XTN instruction. This is seen in cases such as in this GIMPLE example: int32x2_t foo (svint64_t a, svint64_t b) { vector(2) int vect__2.8; long int _1; long int _3; vector(2) long int _12; <bb 2> [local count: 1073741824]: _1 = svaddv_s64 ({ -1, 0, 0, 0, 0, 0, 0, 0, ... }, a_6(D)); _3 = svaddv_s64 ({ -1, 0, 0, 0, 0, 0, 0, 0, ... }, b_7(D)); _12 = {_1, _3}; vect__2.8_13 = (vector(2) int) _12; return vect__2.8_13; } Original assembly generated: bar: ptrue p3.b, all uaddv d0, p3, z0.d uaddv d1, p3, z1.d uzp1 v0.2d, v0.2d, v1.2d xtn v0.2s, v0.2d ret This patch therefore defines the *aarch64_trunc_concat<mode> insn which truncates the concatenation result, rather than concatenating the truncated operands (such as in *aarch64_narrow_trunc<mode>), resulting in the following optimised assembly being emitted: bar: ptrue p3.b, all uaddv d0, p3, z0.d uaddv d1, p3, z1.d uzp1 v0.2s, v0.2s, v1.2s ret This patch passes all regression tests on aarch64 with no new failures. A supporting test for this optimisation is also written and passes. OK for master? I do not have commit rights so I cannot push the patch myself. gcc/ChangeLog: * config/aarch64/aarch64-simd.md: (*aarch64_trunc_concat) new insn definition. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/truncated_concatenation_1.c: new test for the above example and other modes covered by insn definitions.
-
Stefan Schulze Frielinghaus authored
This is a follow-up to 6dec33834d1fd89f16e271dde9607c1de9554144 and pull requests #116957 and #119114. Cherry picked from LLVM commit 65a2eb0b1589590ae78cc1e5f05cd004b3b3bec5. libsanitizer/ChangeLog: PR sanitizer/117725 * sanitizer_common/sanitizer_common_interceptors.inc: Cherry picked from LLVM commit 65a2eb0b1589590ae78cc1e5f05cd004b3b3bec5.
-
Vitaly Buka authored
Fix type in a few related Min() calls. Follow up to #116957. Cherry picked from LLVM commit 6dec33834d1fd89f16e271dde9607c1de9554144 (removed memprof part). libsanitizer/ChangeLog: PR sanitizer/117725 * asan/asan_interceptors.cpp: Cherry picked from LLVM commit 6dec33834d1fd89f16e271dde9607c1de9554144. * sanitizer_common/sanitizer_common_interceptors.inc: Ditto. Co-authored-by:
Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
-
Stefan Schulze Frielinghaus authored
Since the sanitizer merge in commit r15-5164-gfa321004f3f628 of GCC which entails LLVM commit 61a6439f35b6de28ff4aff4450d6fca970292fd5, GCCs bootstrap is broken on s390 -m31. This is due to commit ec68dc1ca4d967b599f1202855917d5ec9cae52f which introduces stricter type checking which is why GCC bootstrap fails with ``` In file included from /gcc/src/libsanitizer/interception/interception.h:18, from /gcc/src/libsanitizer/interception/interception_type_test.cpp:14: /gcc/src/libsanitizer/interception/interception_type_test.cpp:30:61: error: static assertion failed 30 | COMPILER_CHECK((__sanitizer::is_same<::SSIZE_T, ::ssize_t>::value)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ /gcc/src/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:363:44: note: in definition of macro 'COMPILER_CHECK' 363 | #define COMPILER_CHECK(pred) static_assert(pred, "") | ^~~~ make[8]: *** [Makefile:469: interception_type_test.lo] Error 1 ``` The culprit seems to be that we don't check for equality of type sizes anymore but rather whether the types are indeed the same. On s390 -m31 we have that `sizeof(int)==sizeof(long)` holds which is why previously the checks succeeded. They fail now because ``` size_t => unsigned long ssize_t => long ptrdiff_t => int ::SSIZE_T => __sanitizer::sptr => int ::PTRDIFF_T => __sanitizer::sptr => int ``` This is fixed by mapping `SSIZE_T` to `long` in the end. ``` typedef long ssize; typedef sptr ssize; ``` Cherry picked from LLVM commit ce44640fe29550461120d22b0358e6cac4aed822. libsanitizer/ChangeLog: PR sanitizer/117725 * interception/interception.h: Cherry picked from LLVM commit ce44640fe29550461120d22b0358e6cac4aed822. * sanitizer_common/sanitizer_internal_defs.h: Ditto.
-
Stefan Schulze Frielinghaus authored
For some targets uptr is mapped to unsigned int and size_t to unsigned long and sizeof(int)==sizeof(long) holds. Still, these are distinct types and type checking may fail. Therefore, replace uptr by usize/SIZE_T wherever a size_t is expected. Part of #116957 Cherry picked from LLVM commit 9a156f6b2b0c892d8713ba907f07f027b24953d8 (removed memprof, msan, and nsan parts). libsanitizer/ChangeLog: PR sanitizer/117725 * asan/asan_interceptors.cpp: Cherry picked LLVM commit 9a156f6b2b0c892d8713ba907f07f027b24953d8. * asan/asan_interceptors.h: Ditto. * asan/asan_interceptors_memintrinsics.h: Ditto. * sanitizer_common/sanitizer_common_interceptors.inc: Ditto. * sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc: Ditto. * sanitizer_common/sanitizer_platform_limits_posix.h: Ditto. * tsan/tsan_interceptors_posix.cpp: Ditto.
-
Ian Lance Taylor authored
This is a backport of https://go.dev/cl/640237 from the main repo. Fixes PR go/118286 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/640435
-
Stafford Horne authored
In the OpenRISC build we get the following warning: ld: warning: __modsi3_s.o: missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker Fix this by adding a .note.GNU-stack to indicate the stack does not need to be executable for the lib1funcs. Note, this is also needed for the upcoming glibc 2.41. libgcc/ * config/or1k/lib1funcs.S: Add .note.GNU-stack section on linux.
-