]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
6 months agoada: Adjust pragma obsolescent message
Marc Poulhiès [Mon, 6 Jan 2025 09:59:10 +0000 (10:59 +0100)] 
ada: Adjust pragma obsolescent message

Do not mention an explicit version.

gcc/ada/ChangeLog:

* libgnat/a-calcon.ads: Adjust.
* libgnat/a-calend.ads: Adjust.

6 months agoada: Drop g-cpp* units not needed by the compiler
Alexandre Oliva [Wed, 11 Dec 2024 13:16:58 +0000 (10:16 -0300)] 
ada: Drop g-cpp* units not needed by the compiler

Having moved __gnat_convert_caught_object to g-cstyin.o, we can drop
other g-cpp* units that are now needed by programs that actually use
their APIs to get more information about C++ exceptions and type_info
objects.

gcc/ada/ChangeLog:

* gcc-interface/Make-lang.in (GNAT_ADA_OBJS, GNATBIND_OBJS):
Drop g-cpp, g-cppexc and g-cppstd.

6 months agoada: Do not create temporaries for initialization statements
Eric Botcazou [Tue, 10 Dec 2024 09:24:47 +0000 (10:24 +0100)] 
ada: Do not create temporaries for initialization statements

Assignment statements marked with the No_Ctrl_Actions or No_Finalize_Actions
flag are initialization statements and, therefore, no temporaries are needed
to hold the value of the right-hand side for them.

gcc/ada/ChangeLog:

* gcc-interface/trans.cc (Call_to_gnu): Always use the return slot
optimization if the parent node is an initialization statement.
(gnat_to_gnu) <N_Assignment_Statement>: Build an INIT_EXPR instead
of a MODIFY_EXPR if this is an initialization statement.

6 months agoada: Remove unused AST flag Address_Warning_Posted
Piotr Trojanek [Mon, 23 Dec 2024 09:49:11 +0000 (10:49 +0100)] 
ada: Remove unused AST flag Address_Warning_Posted

Flag Address_Warning_Posted was only read and never written, so it can be
safely removed.

gcc/ada/ChangeLog:

* gen_il-fields.ads (Opt_Field_Enum): Remove flag.
* gen_il-gen-gen_nodes.adb (N_Attribute_Definition_Clause): Remove
field.
* sem_ch13.adb (Validate_Address_Clauses): Remove read of the flag.
* sinfo.ads (Address_Warning_Posted): Remove flag description.

6 months agoada: Do not raise exceptions from Exp_Aggr.Packed_Array_Aggregate_Handled
Eric Botcazou [Fri, 20 Dec 2024 15:49:50 +0000 (16:49 +0100)] 
ada: Do not raise exceptions from Exp_Aggr.Packed_Array_Aggregate_Handled

An exception is now raised during bootstrap and this causes compatibility
issues with older compilers.

gcc/ada/ChangeLog:

* exp_aggr.adb (Packed_Array_Aggregate_Handled): Remove declaration
and handler for Not_Handled local exception. Check the return value
of Get_Component_Val instead.
(Get_Component_Val): Return No_Uint instead of raising Not_Handled.

6 months agoada: Cleanup preanalysis of static expressions (part 2)
Javier Miranda [Thu, 19 Dec 2024 10:41:59 +0000 (10:41 +0000)] 
ada: Cleanup preanalysis of static expressions (part 2)

According to RM 13.14(8/4), a static expression in an aspect specification
does not cause freezing; however, the frontend performs many calls to
Preanalyze_Spec_Expression made during the analysis of aspects. This
patch, suggested by Eric Botcazou, takes care of this additional code
cleanup which requires also replacing many occurrences of the global
variable In_Spec_Expression by calls to Preanalysis_Active.

gcc/ada/ChangeLog:

* exp_util.adb (Insert_Actions): Document behavior under strict
preanalysis.
* sem.ads (In_Strict_Preanalysis): New subprogram.
(Preanalysis_Active): Replace 'and' operator by 'and then'.
* sem.adb (In_Strict_Preanalysis): Ditto.
* sem_attr.adb (Check_Dereference): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active, and document it.
(Resolve_Attribute [Atribute_Access]): Ditto.
(Eval_Attribute): No evaluation under strict preanalysis.
(Validate_Static_Object_Name): No action under strict preanalysis.
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Replace
calls to Preanalyze_Spec_Expression by calls to Preanalyze_And_Resolve.
(Check_Aspect_At_Freeze_Point): Ditto.
(Resolve_Aspect_Expressions [Dynamic/Static/Predicate aspects]): Code
cleanup adjusting the code to emulate Preanalyze_And_Resolve, instead
of Preanalyze_Spec_Expression.
(Resolve_Aspect_Expressions [CPU/Interrupt_Priority/Priority/
Storage_Size aspects]): Replace calls to Preanalyze_Spec_Expression
by call to Preanalyze_And _Resolve.
* sem_ch3.adb (Analyze_Object_Declaration): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active.
(Find_Type_Of_Object): Add documentation.
* sem_ch4.adb (Analyze_Case_Expression): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active.
* sem_ch6.adb (Analyze_Expression_Function): Minor code reorganization
moving the code preanalyzing the expression after the new body has
been inserted in the tree to ensure that its Parent attribute is
available for preanalysis.
* sem_cat.adb (Validate_Static_Object_Name): No action under strict
preanalysis.
* sem_elab.adb (Check_For_Eliminated_Subprogram): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active.
* sem_eval.adb (Eval_Intrinsic_Call [Name_Enclosing_Entity]): Ditto.
* sem_elim.adb (Check_For_Eliminated_Subprogram): Ditto.
* sem_res.adb (Resolve_Entity_Name): Ditto.

6 months agoada: Fix constants overlayed by variables
Piotr Trojanek [Thu, 19 Dec 2024 23:13:57 +0000 (00:13 +0100)] 
ada: Fix constants overlayed by variables

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.

6 months agoada: Improve protection against wrong use from GDB
Piotr Trojanek [Thu, 19 Dec 2024 23:09:15 +0000 (00:09 +0100)] 
ada: Improve protection against wrong use from GDB

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.

6 months agoada: Fix violations of GNAT-specific GNATcheck rules
Piotr Trojanek [Thu, 19 Dec 2024 23:07:23 +0000 (00:07 +0100)] 
ada: Fix violations of GNAT-specific GNATcheck rules

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.

6 months agoada: Remove dead code in detection of null record definitions
Piotr Trojanek [Thu, 19 Dec 2024 14:32:56 +0000 (15:32 +0100)] 
ada: Remove dead code in detection of null record definitions

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.

6 months agoada: Fix abort deferral for finally parts
Ronan Desplanques [Thu, 19 Dec 2024 10:10:12 +0000 (11:10 +0100)] 
ada: Fix abort deferral for finally parts

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.

6 months agoada: Improved checking of uses of package renamings
Steve Baird [Tue, 17 Dec 2024 21:27:04 +0000 (13:27 -0800)] 
ada: Improved checking of uses of package renamings

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.

6 months agoada: Remove flag Is_Inherited_Pragma which is only set and never used
Piotr Trojanek [Tue, 30 Jan 2024 00:10:17 +0000 (01:10 +0100)] 
ada: Remove flag Is_Inherited_Pragma which is only set and never used

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.

6 months agoada: Avoid conversion from String to Name_Id at runtime
Piotr Trojanek [Tue, 26 Mar 2024 14:05:47 +0000 (15:05 +0100)] 
ada: Avoid conversion from String to Name_Id at runtime

Code cleanup.

gcc/ada/ChangeLog:

* sem_prag.adb (Analyze_Attribute): Replace runtime conversion
with existing constant.

6 months agoada: Untangle check for restriction No_Implementation_Attributes
Piotr Trojanek [Tue, 26 Mar 2024 15:52:08 +0000 (16:52 +0100)] 
ada: Untangle check for restriction No_Implementation_Attributes

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.

6 months agoada: Handle attributes related to Ada 2012 iterators as internal
Piotr Trojanek [Tue, 26 Mar 2024 15:23:41 +0000 (16:23 +0100)] 
ada: Handle attributes related to Ada 2012 iterators as internal

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.

6 months agoada: Remove unnecessary qualifiers for First/Next list operations
Piotr Trojanek [Thu, 2 Mar 2023 21:43:12 +0000 (22:43 +0100)] 
ada: Remove unnecessary qualifiers for First/Next list operations

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.

6 months agoada: Fix internal error on container aggregate for bounded vectors
Eric Botcazou [Wed, 18 Dec 2024 09:16:15 +0000 (10:16 +0100)] 
ada: Fix internal error on container aggregate for bounded vectors

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.

6 months agoada: Add guard to System.Val_Real.Large_Powfive against pathological input
Eric Botcazou [Tue, 17 Dec 2024 19:00:38 +0000 (20:00 +0100)] 
ada: Add guard to System.Val_Real.Large_Powfive against pathological input

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.

6 months agoada: Drop vxworks-smp-ppc-link.spec
Alexandre Oliva [Wed, 16 Aug 2023 01:07:27 +0000 (22:07 -0300)] 
ada: Drop vxworks-smp-ppc-link.spec

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.

6 months agoada: Add "finally" GNAT extension
Ronan Desplanques [Tue, 17 Dec 2024 09:43:56 +0000 (10:43 +0100)] 
ada: Add "finally" GNAT extension

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.

6 months agoada: Elide the copy for bit-packed aggregates in (safe) assignments
Eric Botcazou [Tue, 17 Dec 2024 10:20:03 +0000 (11:20 +0100)] 
ada: Elide the copy for bit-packed aggregates in (safe) assignments

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.

6 months agoada: Reject references to attribute Result in Exceptional_Cases
Piotr Trojanek [Mon, 16 Dec 2024 13:36:13 +0000 (14:36 +0100)] 
ada: Reject references to attribute Result in Exceptional_Cases

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.

6 months agoada: Move checks for consequences of Exceptional_Cases to GNAT
Piotr Trojanek [Mon, 16 Dec 2024 13:15:57 +0000 (14:15 +0100)] 
ada: Move checks for consequences of Exceptional_Cases to GNAT

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.

6 months agoada: Fix comments about Subprogram_Variant and Exceptional_Cases
Piotr Trojanek [Mon, 16 Dec 2024 12:52:43 +0000 (13:52 +0100)] 
ada: Fix comments about Subprogram_Variant and Exceptional_Cases

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.

6 months agoada: Put_Image spec incorrectly ignored for Fixed_Point_Type'Base'Image call.
Steve Baird [Fri, 13 Dec 2024 01:06:00 +0000 (17:06 -0800)] 
ada: Put_Image spec incorrectly ignored for Fixed_Point_Type'Base'Image call.

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.

6 months agoada: Error on instantiation with defaulted formal type referencing other formal type
Gary Dismukes [Fri, 13 Dec 2024 23:36:05 +0000 (23:36 +0000)] 
ada: Error on instantiation with defaulted formal type referencing other formal type

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.

6 months agoada: Use the syntax of Ada 2012 if-expression in -gnatR3 output
Eric Botcazou [Sun, 15 Dec 2024 15:37:57 +0000 (16:37 +0100)] 
ada: Use the syntax of Ada 2012 if-expression in -gnatR3 output

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".

6 months agoada: Preserve Warning_Doc_Switch in gnatprove invocation
Johannes Kanig [Tue, 3 Dec 2024 10:53:28 +0000 (19:53 +0900)] 
ada: Preserve Warning_Doc_Switch in gnatprove invocation

When invoked by gnat2why, the Warning_Doc_Switch was unintenionally
reset.

gcc/ada/ChangeLog:

* gnat1drv.adb: (SPARK_Library_Warning): preserve Warning_Doc_Switch

6 months agoada: Restrict previous change made to expansion of allocators
Eric Botcazou [Mon, 16 Dec 2024 07:59:26 +0000 (08:59 +0100)] 
ada: Restrict previous change made to expansion of allocators

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.

6 months agoFortran: Ensure deep copy of allocatable components in cylic types [PR114612]
Andre Vehreschild [Fri, 13 Dec 2024 11:07:01 +0000 (12:07 +0100)] 
Fortran: Ensure deep copy of allocatable components in cylic types [PR114612]

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.

6 months agoLoongArch: Optimize initializing fp resgister to zero
Deng Jianbo [Tue, 31 Dec 2024 11:33:23 +0000 (19:33 +0800)] 
LoongArch: Optimize initializing fp resgister to zero

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.

6 months ago[PR modula2/118010, modula2/118183] Unable to rebuild the bootstrap tools and Wtypemi...
Gaius Mulley [Tue, 7 Jan 2025 11:20:45 +0000 (11:20 +0000)] 
[PR modula2/118010, modula2/118183] Unable to rebuild the bootstrap tools and Wtypemismatch

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>
6 months agoFortran: Extend cylic type detection for deallocate [PR116669]
Andre Vehreschild [Mon, 9 Dec 2024 13:56:27 +0000 (14:56 +0100)] 
Fortran: Extend cylic type detection for deallocate [PR116669]

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.

6 months agoAArch64: Remove AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS
Jennifer Schmitz [Tue, 26 Nov 2024 08:43:48 +0000 (00:43 -0800)] 
AArch64: Remove AARCH64_EXTRA_TUNE_USE_NEW_VECTOR_COSTS

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.

6 months agotestsuite: add testcase for fixed PR98000
Sam James [Fri, 3 Jan 2025 16:59:37 +0000 (16:59 +0000)] 
testsuite: add testcase for fixed PR98000

gcc/testsuite/ChangeLog:
PR ipa/98000
* g++.dg/ipa/pr98000.C: New test.

6 months agotestsuite: add testcase for fixed PR117546
Sam James [Fri, 3 Jan 2025 16:56:01 +0000 (16:56 +0000)] 
testsuite: add testcase for fixed PR117546

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.

6 months agoDaily bump.
GCC Administrator [Tue, 7 Jan 2025 00:18:08 +0000 (00:18 +0000)] 
Daily bump.

6 months agoexpand: drop stack adjustments after barrier [PR118006]
Alexandre Oliva [Fri, 20 Dec 2024 21:02:08 +0000 (18:02 -0300)] 
expand: drop stack adjustments after barrier [PR118006]

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.

6 months agoaarch64: remove extra XTN in vector concatenation
Akram Ahmad [Mon, 6 Jan 2025 20:09:30 +0000 (20:09 +0000)] 
aarch64: remove extra XTN in vector concatenation

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.

6 months agoFix type in some Min() calls (#119248)
Stefan Schulze Frielinghaus [Mon, 6 Jan 2025 18:17:28 +0000 (19:17 +0100)] 
Fix type in some Min() calls (#119248)

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.

6 months agoFix few size types in memprof (#119114)
Vitaly Buka [Mon, 6 Jan 2025 18:17:09 +0000 (19:17 +0100)] 
Fix few size types in memprof (#119114)

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>
6 months agoAdd type __sanitizer::ssize (#116957)
Stefan Schulze Frielinghaus [Mon, 6 Jan 2025 18:17:09 +0000 (19:17 +0100)] 
Add type __sanitizer::ssize (#116957)

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.

6 months agoReplace uptr by usize/SIZE_T in interfaces
Stefan Schulze Frielinghaus [Mon, 6 Jan 2025 18:17:09 +0000 (19:17 +0100)] 
Replace uptr by usize/SIZE_T in interfaces

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.

6 months agocrypto/tls: fix Config.Time in tests using expired certificates
Ian Lance Taylor [Sat, 4 Jan 2025 23:54:58 +0000 (15:54 -0800)] 
crypto/tls: fix Config.Time in tests using expired certificates

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

6 months agoor1k: add .note.GNU-stack section on linux
Stafford Horne [Mon, 6 Jan 2025 12:12:40 +0000 (12:12 +0000)] 
or1k: add .note.GNU-stack section on linux

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.

6 months agoRespect -fprofile-prefix-map for getcwd in .gcno files
Fangrui Song [Wed, 1 Jan 2025 00:32:07 +0000 (16:32 -0800)] 
Respect -fprofile-prefix-map for getcwd in .gcno files

so that
`gcc -c a.cc --coverage -fprofile-prefix-map=$PWD=.`
does not emit $PWD in the generated a.gcno file.

gcc/ChangeLog:

PR gcov-profile/96092
* coverage.cc (coverage_init): Remap getpwd().

6 months agoSVE intrinsics: Fold svmul by -1 to svneg for unsigned types
Jennifer Schmitz [Thu, 7 Nov 2024 16:44:30 +0000 (08:44 -0800)] 
SVE intrinsics: Fold svmul by -1 to svneg for unsigned types

As follow-up to
https://gcc.gnu.org/pipermail/gcc-patches/2024-October/665472.html,
this patch implements folding of svmul by -1 to svneg for
unsigned SVE vector types. The key idea is to reuse the existing code that
does this fold for signed types and feed it as callback to a helper function
that adds the necessary type conversions.

For example, for the test case
svuint64_t foo (svuint64_t x, svbool_t pg)
{
  return svmul_n_u64_x (pg, x, -1);
}

the following gimple sequence is emitted (-O2 -mcpu=grace):
svuint64_t foo (svuint64_t x, svbool_t pg)
{
  svint64_t D.12921;
  svint64_t D.12920;
  svuint64_t D.12919;

  D.12920 = VIEW_CONVERT_EXPR<svint64_t>(x);
  D.12921 = svneg_s64_x (pg, D.12920);
  D.12919 = VIEW_CONVERT_EXPR<svuint64_t>(D.12921);
  goto <D.12922>;
  <D.12922>:
  return D.12919;
}

In general, the new helper gimple_folder::convert_and_fold
- takes a target type and a function pointer,
- converts the lhs and all non-boolean vector types to the target type,
- passes the converted lhs and arguments to the callback,
- receives the new gimple statement from the callback function,
- adds the necessary view converts to the gimple sequence,
- and returns the new call.

Because all arguments are converted to the same target types, the helper
function is only suitable for folding calls whose arguments are all of
the same type. If necessary, this could be extended to convert the
arguments to different types differentially.

The patch was bootstrapped and tested on aarch64-linux-gnu, no regression.
OK for mainline?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/ChangeLog:

* config/aarch64/aarch64-sve-builtins-base.cc
(svmul_impl::fold): Wrap code for folding to svneg in lambda
function and pass to gimple_folder::convert_and_fold to enable
the transform for unsigned types.
* config/aarch64/aarch64-sve-builtins.cc
(gimple_folder::convert_and_fold): New function that converts
operands to target type before calling callback function, adding the
necessary conversion statements.
(gimple_folder::redirect_call): Set fntype of redirected call.
(get_vector_type): Move from here to aarch64-sve-builtins.h.
* config/aarch64/aarch64-sve-builtins.h
(gimple_folder::convert_and_fold): Declare function.
(get_vector_type): Move here as inline function.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/acle/asm/mul_u8.c: Adjust expected outcome.
* gcc.target/aarch64/sve/acle/asm/mul_u16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mul_u32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/mul_u64.c: New test and adjust
expected outcome.

6 months agoAda: fix spurious relinking of gnatbind for cross compilers
Eric Botcazou [Mon, 6 Jan 2025 11:20:00 +0000 (12:20 +0100)] 
Ada: fix spurious relinking of gnatbind for cross compilers

The problem has been introduced by r15-1881.

gcc/ada
PR ada/118247
* gcc-interface/Make-lang.in (GNATTOOLS_CROSS_MV): Copy gnatbind
instead of moving it.

6 months agoipa-cp: Make dumping of bit masks representing -1 nicer
Martin Jambor [Mon, 6 Jan 2025 10:58:29 +0000 (11:58 +0100)] 
ipa-cp: Make dumping of bit masks representing -1 nicer

Dumps of the lattices representing bit-values and of propagation
results of bit-values can print a really long hexadecimal value when
the bit-value represents -1 (all bits set).  This patch simply detect
that situation and prints the string "-1" in that case, making the
dumps somewhat nicer.

gcc/ChangeLog:

2025-01-03  Martin Jambor  <mjambor@suse.cz>

* ipa-cp.cc (ipcp_print_widest_int): New function.
(ipcp_store_vr_results): Use it.
(ipcp_bits_lattice::print): Likewise.  Fix formatting.

6 months agotree-switch-conversion: don't apply switch size limit on jump tables
Mark Wielaard [Sun, 5 Jan 2025 17:00:36 +0000 (18:00 +0100)] 
tree-switch-conversion: don't apply switch size limit on jump tables

commit 56946c801a7c ("gimple: Add limit after which slower switchlower
algs are used [PR117091] [PR117352]") introduced a limit on the number
of cases of a switch. It also bails out on finding jump tables if the
switch is too large. This introduces a compile time regression during
bootstrap. A riscv bootstrap takes hours longer. Particularly
insn-attrtab.cc will take hours instead of minutes. Fix this by not
applying the switch size limit on jump tables.

An alternative would be to implement greedy switch clustering for jump
tables as is done for switch bitmap clustering.

gcc/ChangeLog:

PR tree-optimization/118032
* tree-switch-conversion.cc (jump_table_cluster::find_jump_tables):
Remove param_switch_lower_slow_alg_max_cases check.

6 months agoAArch64: Implement four and eight chunk VLA concats [PR118272]
Tamar Christina [Mon, 6 Jan 2025 09:24:36 +0000 (09:24 +0000)] 
AArch64: Implement four and eight chunk VLA concats [PR118272]

The following testcase

  #pragma GCC target ("+sve")
  extern char __attribute__ ((simd, const)) fn3 (int, short);
  void test_fn3 (float *a, float *b, double *c, int n)
  {
    for (int i = 0; i < n; ++i)
      a[i] = fn3 (b[i], c[i]);
  }

at -Ofast ICEs because my previous patch only added support for combining 2
partial SVE vectors into a bigger vector.  However There can also 4 and 8
piece subvectors.

This patch fixes this by implementing the missing expansions.

gcc/ChangeLog:

PR target/96342
PR target/118272
* config/aarch64/aarch64-sve.md (vec_init<mode><Vquad>,
vec_initvnx16qivnx2qi): New.
* config/aarch64/aarch64.cc (aarch64_sve_expand_vector_init_subvector):
Rewrite to support any arbitrary combinations.
* config/aarch64/iterators.md (SVE_NO2E): Update to use SVE_NO4E
(SVE_NO2E, Vquad): New.

gcc/testsuite/ChangeLog:

PR target/96342
PR target/118272
* gcc.target/aarch64/vect-simd-clone-3.c: New test.

6 months agoada: Fix small thinko in previous change to two-pass aggregate expansion
Eric Botcazou [Fri, 13 Dec 2024 19:50:44 +0000 (20:50 +0100)] 
ada: Fix small thinko in previous change to two-pass aggregate expansion

We need a type tailored to the base index type to compute the length.

gcc/ada/ChangeLog:

* exp_aggr.adb (Two_Pass_Aggregate_Expansion): Use the base type of
the index type to find the type used to compute the length.

6 months agoada: Streamline runtime support of finalization collections
Eric Botcazou [Fri, 13 Dec 2024 18:17:00 +0000 (19:17 +0100)] 
ada: Streamline runtime support of finalization collections

Finalization collections are declared as (limited) controlled types so that
they can be naturally attached to a finalization master, but the same result
can be achieved by means of (limited) finalizable types, which need not be
tagged and thus avoid dragging the runtime support of tagged types.

gcc/ada/ChangeLog:

* libgnat/s-finpri.ads: Remove clause for Ada.Finalization.
(Finalization_Collection): Change to limited private type with the
Finalizable aspect.
(Initialize): Remove "overriding" keyword.
(Finalize): Likewise.
* libgnat/s-finpri.adb (Initialize): Likewise.
(Finalize): Likewise.

6 months agoada: Fix predicate involving array indexing rejected in generic package
Eric Botcazou [Thu, 12 Dec 2024 22:08:30 +0000 (23:08 +0100)] 
ada: Fix predicate involving array indexing rejected in generic package

The indexing is rejected with the message:

  error: reference to current instance of type does not denote a type

when it is applied to a prefix which is the current instance of the type
to which the predicate is applied.

There is already a specific handling of component selection for this case
present in Find_Selected_Component, so this adds an equivalent specific
handling of indexing for this case to Analyze_Indexed_Component_Form.

gcc/ada/ChangeLog:

PR ada/117569
* sem_ch4.adb (Analyze_Indexed_Component_Form): Do not rewrite the
node as a type conversion if it is the current instance of a type
in a generic unit.
* sem_ch8.adb (Find_Selected_Component): Restrict the special case
of the current instance of a type to a generic unit.

6 months agoada: Fix incorrect RM reference in s-imagef.adb
Bob Duff [Fri, 13 Dec 2024 13:58:08 +0000 (08:58 -0500)] 
ada: Fix incorrect RM reference in s-imagef.adb

gcc/ada/ChangeLog:

* libgnat/s-imagef.adb (Set_Image_Integer):
Change "RM A.3.10" to be "RM A.10.9".

6 months agoada: Reduce footprint of C++ exception interoperation support
Alexandre Oliva [Tue, 10 Dec 2024 12:06:57 +0000 (09:06 -0300)] 
ada: Reduce footprint of C++ exception interoperation support

The initial C++ base-type exception interoperation support change
brought all of GNAT.CPP* along with raise-gcc, because of
[__gnat_]Convert_Caught_Object.  Move that private but pragma-exported
function to GNAT.CPP.Std.Type_Info, so that it can rely on the C++
virtual/dispatch calls that justified the introduction of the Ada
wrapper type, to avoid emulating virtual calls in C or bringing in a
dependency on the C++ compiler and runtime.

Drop the CharPtr package instantiation, that brought a huge amount of
unnecessary code, and use string and storage primitives instead, using
the strcmp builtin directly for the C string compares.

Move the conversion to Ada String in Name to the wrapper interface in
GNAT.CPP.Std, adjusting the private internal type to shave off a few
more bytes from the only unit that raise-gcc will still need.

Finally, disable heap finalization for Type_Info_Ptr, to avoid
dragging in all of the finalization code.  Thank to Eric Botcazou for
the suggestion.

gcc/ada/ChangeLog:

* libgnat/g-cppexc.adb (Convert_Caught_Object): Move...
* libgnat/g-cstyin.adb (Convert_Caught_Object):  ... here.
Use object call notation.
(strcmp): New.
(Char_Arr, CharPtr, Char_Pointer, To_chars_ptr): Drop.  Do not
import Interfaces.C.Pointers.
(To_Pointer): Convert from System.Address.
(Name_Starts_With_Asterisk): Rename local variable.
(Name_Past_Asterisk): Rewrite with System.Address and strcmp.
Import System.Storage_Elements.
(Equals): Use strcmp.
(Before): Fix logic error.  Use strcmp.
(Name): Move conversion to String...
* libgnat/g-cppstd.adb (Name): ... here.  Import
Interfaces.C.Strings.
* libgnat/g-cppstd.ads (Type_Info_Ptr): Disable heap
finalization.
* libgnat/g-cstyin.ads (Name): Change return type.

6 months agoada: Support new SPARK aspect Exit_Cases
Claire Dross [Mon, 2 Dec 2024 16:14:47 +0000 (17:14 +0100)] 
ada: Support new SPARK aspect Exit_Cases

The aspect Exit_Cases allows annotating a subprogram with a list of
cases specifying, for all input which satisfy a guard, how the
subprogram is allowed to terminate. For now, it can only be either
returning normally or propagating an exception. This contract is not
checked at runtime, it is only meant for static verification in SPARK.

gcc/ada/ChangeLog:

* aspects.ads: Add aspect Aspect_Exit_Cases.
* contracts.adb (Analyze_Entry_Or_Subprogram_Contract): Handle Exit_Cases.
(Expand_Subprogram_Contract): Idem.
* einfo-utils.adb (Get_Pragma): Allow Pragma_Exit_Cases.
* einfo-utils.ads (Get_Pragma): Idem.
* exp_prag.adb (Expand_Pragma_Exit_Cases): Ignore the pragma, currently we don't expand it.
* exp_prag.ads (Expand_Pragma_Exit_Cases): Idem.
* inline.adb (Remove_Aspects_And_Pragmas): Add Exit_Cases to the list.
(Remove_Items): Idem.
* par-prag.adb (Last_Arg_Is_Reason): Idem.
* sem_ch12.adb: Idem.
* sem_ch13.adb: Idem.
* sem_util.adb: Idem.
* sem_util.ads: Idem.
* sinfo.ads: Idem.
* snames.ads-tmpl: Add names Name_Exit_Cases, Name_Exception_Raised, and Name_Normal_Return
as well as pragma Pragma_Exit_Cases.
* sem_prag.adb (Analyze_Exit_Cases_In_Decl_Part): Make sure that a
pragma or aspect Exit_Cases is well formed.
(Analyze_Pragma): Make sure that a pragma or aspect Exit_Cases is at the right place.
* sem_prag.ads (Analyze_Exit_Cases_In_Decl_Part): Declaration.
* doc/gnat_rm/implementation_defined_pragmas.rst: Document the Exit_Cases pragma.
* doc/gnat_rm/implementation_defined_aspects.rst: Document the Exit_Cases aspect.
* gnat_rm.texi: Regenerate.

6 months agoada: Correct xref of operator expression function body
Bob Duff [Thu, 12 Dec 2024 14:13:16 +0000 (09:13 -0500)] 
ada: Correct xref of operator expression function body

For an expression function body that is an operator,
make sure the xref entry in the ALI file points one past the
double quote mark. For example, if the name is ">", point
to the greater-than symbol, not the double quote.
This was already the case for proper bodies.

gcc/ada/ChangeLog:

* sem_util.adb (Copy_Subprogram_Spec): When copying
an N_Defining_Operator_Symbol, create an
N_Defining_Operator_Symbol rather than an N_Defining_Identifier.
This will cause Lib.Xref to "skip the initial quote for
navigation purposes" (as per comments in Lib.Xref body).

6 months agoada: Small housekeeping work in Exp_Aggr
Eric Botcazou [Thu, 12 Dec 2024 12:00:14 +0000 (13:00 +0100)] 
ada: Small housekeeping work in Exp_Aggr

This moves a few declarations around and tweaks a few comments.

gcc/ada/ChangeLog:

* exp_aggr.adb (Case_Table_Type): Fix reference in comment.
(In_Place_Assign_OK): Move declaration around.
(Is_Build_In_Place_Aggregate_Return): Likewise and adjust.
(Expand_Array_Aggregate): Streamline for the sake of consistency.
(Aggr_Assignment_OK_For_Backend): Remove reference to Gigi/gcc.
(Backend_Processing_Possible): Likewise.
(Expand_Array_Aggregate): Add comment.

6 months agoada: cleanup documentation for shift and rotate
Bob Duff [Tue, 10 Dec 2024 13:56:45 +0000 (08:56 -0500)] 
ada: cleanup documentation for shift and rotate

Documentation updated.

gcc/ada/ChangeLog:

* sinfo.ads (Shift_Count_OK): Update comments.
(Is_Power_Of_2_For_Shift): Likewise.

6 months agoada: Fix memory leak when failing to initialize newly allocated memory
Eric Botcazou [Tue, 10 Dec 2024 18:43:14 +0000 (19:43 +0100)] 
ada: Fix memory leak when failing to initialize newly allocated memory

This makes the compiler generate cleanup code to deallocate the memory when
the evaluation of the expression of an allocator raises an exception, if the
expression is a call to a function that may raise, i.e. is not declared with
the No_Raise aspect/pragma.  This can also be disabled by means of -gnatdQ.

gcc/ada/ChangeLog:

* debug.adb (dQ): Document usage.
* exp_ch4.ads (Build_Cleanup_For_Allocator): New declaration.
* exp_ch4.adb (Build_Cleanup_For_Allocator): New procedure.
(Expand_Allocator_Expression): Build a cleanup to deallocate the
memory when the evaluation of the expression raises an exception.
* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Do not generate the
detachment if the deallocation is for the cleanup of an allocator.
* gen_il-fields.ads (Opt_Field_Enum): Add For_Allocator.
* gen_il-gen-gen_nodes.adb (N_Free_Statement): Likewise.
* sinfo.ads (For_Allocator): Document usage on N_Free_Statement.

6 months agoada: Fix assertion failure on 'Old in post-condition with -gnat2022
Eric Botcazou [Wed, 11 Dec 2024 12:06:07 +0000 (13:06 +0100)] 
ada: Fix assertion failure on 'Old in post-condition with -gnat2022

It comes from a small oversight in the updated implementation for Ada 2022.

gcc/ada/ChangeLog:

PR ada/117956
* sem_util.adb (Is_Known_On_Entry): Be prepared for constants coming
from a renaming declaration.

6 months agoada: Declare that the new argument may not be used
Tonu Naks [Tue, 10 Dec 2024 10:41:16 +0000 (10:41 +0000)] 
ada: Declare that the new argument may not be used

gcc/ada/ChangeLog:

* adaint.c (__gnat_locate_exec_on_path): modify function signature

6 months agoada: Fix crash on Depends contract with homonym functions
Piotr Trojanek [Tue, 10 Dec 2024 15:42:46 +0000 (16:42 +0100)] 
ada: Fix crash on Depends contract with homonym functions

When resolving names in flow contracts, we refine the ordinary analysis by
knowing that an overloaded name must refer to an abstract state and not a
function. However, when all overloadings refer to function, we shouldn't
crash, but instead let the error to be diagnosed later.

gcc/ada/ChangeLog:

* sem_prag.adb (Resolve_State): Continue ordinary processing.

6 months agoada: Crash in prefix notation with access to class-wide object
Javier Miranda [Tue, 10 Dec 2024 19:49:15 +0000 (19:49 +0000)] 
ada: Crash in prefix notation with access to class-wide object

The compiler crashes analyzing a prefix notation call when its
prefix is an access to a class-wide object, an actual parameter
is missing, and the sources are compiled with language extensions
(-gnatX) and full errors (-gnatf).

gcc/ada/ChangeLog:

* sem_ch4.adb (Try_Object_Operation): if no candidate interpretation
matches the context, redo the same analysis with Report_Error True
to report the error.

6 months agoada: Plug small loophole in previous change
Eric Botcazou [Tue, 10 Dec 2024 16:53:34 +0000 (17:53 +0100)] 
ada: Plug small loophole in previous change

The initial change only deals with the controlled record case for assignment
statements, but the controlled array case needs the same treatment.

gcc/ada/ChangeLog:

* exp_ch5.adb (Expand_Assign_Array): Bail out for controlled
components if the RHS is a function call and the assignment has
the No_Ctrl_Actions flag set.

6 months agoada: Fix printing boolean attributes in the SARIF report
Viljar Indus [Tue, 26 Nov 2024 12:10:46 +0000 (14:10 +0200)] 
ada: Fix printing boolean attributes in the SARIF report

Boolean attributes should have the value true or false
without any quotes.

gcc/ada/ChangeLog:

* diagnostics-json_utils.adb: Add new method
Write_Boolean_Attribute.
* diagnostics-json_utils.ads: Likewise.
* diagnostics-sarif_emitter.adb (Print_Invocations): print
the executionSuccesful property value without extra quotes.

6 months agoada: Remove level attribute from Rules in the SARIF report
Viljar Indus [Thu, 28 Nov 2024 10:44:37 +0000 (12:44 +0200)] 
ada: Remove level attribute from Rules in the SARIF report

A Rule object in the SARIF report does not have a level
attribute. Result objects are the elements in the SARIF
reprot that have a level attribute that ultimately determines
the level of each diagnostic object.

Rules can have a defaultConfiguration attribute which has a level
attribute that can be overridden in multiple ways. This can make
the overall report more complex than it needs to be. It is simpler
to remove the attribute from rules where it does not really matter
and add it back in under the defaultConfiguration when there is an
explicit need for it.

gcc/ada/ChangeLog:

* diagnostics-sarif_emitter.adb (Print_Rule): Remove printing
of the level attribute since it does not match the SARIF schema.

6 months agoada: Avoid null-exclusion checks for Node_Field_Table
Piotr Trojanek [Wed, 27 Sep 2023 10:19:53 +0000 (12:19 +0200)] 
ada: Avoid null-exclusion checks for Node_Field_Table

By generating the type of Node_Field_Table with a "not null" qualifier
we check the null exclusion of its elements only once, at the object
declaration.

Tiny performance improvement for the debug builds (because in production
builds checks are disabled anyway); semantics is unaffected.

gcc/ada/ChangeLog:

* gen_il-gen.adb (Put_Tables): Add "not null" to the generated code.
* rtsfind.adb (Cstring_Ptr): Same for table with predefined RE_Id
error messages.
* impunit.adb (Aunit_Record): Same for array of alternative unit names.

6 months agoada: Ada version used to compile runtime is constant
Piotr Trojanek [Sun, 14 Jan 2024 20:15:37 +0000 (21:15 +0100)] 
ada: Ada version used to compile runtime is constant

Code cleanup.

gcc/ada/ChangeLog:

* opt.ads (Ada_Version_Runtime): Now a constant, since it cannot
and should never be modified.

6 months agoada: null procedure cannot be used as compilation unit
Bob Duff [Mon, 9 Dec 2024 17:20:34 +0000 (12:20 -0500)] 
ada: null procedure cannot be used as compilation unit

This patch gives a syntax error if a null procedure is used as
a compilation unit. The error was already given during semantic
analysis; now it is given in the parser, which is more convenient
for other tools like gprbuild, because the -gnats switch now
gives the error.

Note that the old message "null procedure cannot be declared at library
level" was wrong; "library level" is not the same thing as "is a library
unit".

gcc/ada/ChangeLog:

* par-ch10.adb (P_Compilation_Unit): Give an error for "is null".
* sem_ch10.adb (Analyze_Subunit): Remove check for "is null"
as a subunit.
* sem_ch6.adb (Analyze_Subprogram_Declaration):
Remove check for "is null" as a library unit.

6 months agoada: Cleanup preanalysis of static expressions
Javier Miranda [Wed, 4 Dec 2024 17:49:01 +0000 (17:49 +0000)] 
ada: Cleanup preanalysis of static expressions

Complete previous patch; required to avoid regressions in GNATProve.

gcc/ada/ChangeLog:

* sem_ch6.adb (Analyze_Expression_Function): Set the parent of
the new node to be the parent of the original to get the proper
context, which is needed for complete error reporting and for
semantic analysis. Patch suggested by Eric Botcazou.

6 months agoada: C++ exception hierarchies: adjust for gnat-llvm
Alexandre Oliva [Mon, 9 Dec 2024 10:56:06 +0000 (07:56 -0300)] 
ada: C++ exception hierarchies: adjust for gnat-llvm

gnat-llvm doesn't support C++ imports, so arrange for the GNAT.CPP*
units to be omitted from gnat-llvm builds.

Drop G++ exception interoperability support from raise-gcc.c, so as to
not require the GNAT.CPP* units that define some of the required
symbols.

Co-Authored-By: Olivier Hainque <hainque@adacore.com>
gcc/ada/ChangeLog:

* Makefile.rtl (LLVM_BUILD): Define based on LLVM_CONFIG.
(GNATRTL_NONTASKING_OBJS): Make g-cpp, g-cppstd, and g-cstyin
conditional on -gcc or -arm EH, and on no LLVM_BUILD.
* raise-gcc.c (GXX_EH_INTEROP): Define as 0 on gnat-llvm or
CERT, and 1 otherwise.
(__gnat_get_cxx_dependent_exception) Omit on !GXX_EH_INTEROP.
(__gnat_maybe_get_cxx_dependent_exception): Likewise.
(__gnat_get_cxx_exception_type_info): Likewise.
(__gnat_obtain_caught_object): Likewise.
(is_handled_by): Omit eid parameter and G++ interop on
!GXX_EH_INTEROP.  Adjust callers.

6 months agoada: Elide copy for calls as default values of nonlimited by-reference components
Eric Botcazou [Mon, 9 Dec 2024 09:01:11 +0000 (10:01 +0100)] 
ada: Elide copy for calls as default values of nonlimited by-reference components

This prevents a temporary from being created on the primary stack to hold
the result of the function calls before it is copied to the object being
elaborated in the nonlimited by-reference case.

That's already not done in the nonlimited non-by-reference case and there is
no reason to do it in the former case either.  The main issue are the calls
to Remove_Side_Effects in Expand_Ctrl_Function_Call (controlled case only)
and in Expand_N_Assignment_Statement, which serve various purposes including
very technical ones beside removing side effects.

The change is therefore very conservative and only removes the copy in the
case of a naked function call for the time being.

gcc/ada/ChangeLog:

* einfo.ads (Returns_By_Ref): Fix description.
* exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Do not
adjust the component manually (if need be), set No_Finalize_Actions
instead of No_Ctrl_Actions for this purpose.  Do not adjust when
the expression is a naked function call.
* exp_ch5.adb (Make_Tag_Ctrl_Assignment): Document the quirks of
the function.  Assert that the LHS of the assignment does not have
side effects and replace calls to Duplicate_Subexpr_No_Checks with
calls to New_Copy_Tree.  Rename local variable Asn to New_N.
(Expand_N_Assignment_Statement): In the tagged or controlled record
case, do remove side effects from both operands on entry.  Remove
them in the controlled record case, except if the RHS is a function
call and the assignment has the No_Ctrl_Actions flag set.
* exp_ch6.adb (Expand_Ctrl_Function_Call): Bail out when the parent
node is an assignment statement with the No_Ctrl_Actions flag set.
* sem_util.adb (Statically_Different): Return True for a function
call that does not return its result by reference.
* sinfo.ads (No_Ctrl_Actions): Adjust description and add a note for
the code generator.
(No_Finalize_Actions): Likewise.

6 months agoada: Follow-on to Use inheritance in Gen_IL
Bob Duff [Mon, 9 Dec 2024 22:45:17 +0000 (17:45 -0500)] 
ada: Follow-on to Use inheritance in Gen_IL

Fix too-long line.

gcc/ada/ChangeLog:

* gen_il-gen.adb: Fix too-long line.

6 months agoada: Silence unused parameter warning on linux
Tonu Naks [Thu, 5 Dec 2024 11:34:24 +0000 (11:34 +0000)] 
ada: Silence unused parameter warning on linux

In __gnat_locate_exec_on_path (char *exec_name, int current_dir_on_windows)
the recently added second parameter is for windows only. On non-windows
platforms its usage is removed by the preprocessor and the compiler
reports unused parameter.

gcc/ada/ChangeLog:

* adaint.c: void parameter on non-windows platforms

6 months agoada: Use inheritance in Gen_IL
Bob Duff [Mon, 9 Dec 2024 13:47:05 +0000 (08:47 -0500)] 
ada: Use inheritance in Gen_IL

In Gen_IL, detect cases where fields could be inherited from
an abstract type instead of being defined in each of two or more
descendants of that type. Raise Illegal when that is the case,
except in specific cases called out as exceptions to this rule.

For every such case, either update the types declared in
Gen_Nodes and Gen_Entities to use inheritance, or add the case
to the list of exceptions where we do not want to use inheritance.

gcc/ada/ChangeLog:

* gen_il-internals.ads: Split Fields field into two fields
Imm_Fields and Fields.
* gen_il-gen.adb: Modify the field-inheritance
algorithm to inherit at each level of the type hierarchy,
rather than just inheriting into concrete types.
For example, if C is a concrete type derived from B,
which is in turn derived from A, we now set the Fields
of B to include those of A. (We had always set the Fields
of C to include those of A and B, and we still do that.)
(Compute_Fields_For_One_Type): Detect cases where a given
field is declared for all descendants of a given abstract
type, in which case we should consider declaring it in
the abstract type, and inheriting it in those descendants.
(Exception_To_Inheritance_Rule): These are the cases where
we could inherit, but we don't want to.
* gen_il-gen-gen_nodes.adb: Move fields up the type hierarchy,
so they are inherited instead of being defined separately.
* gen_il-gen-gen_entities.adb: Likewise.

6 months agoada: Fix incorrect incomplete type error
Viljar Indus [Thu, 5 Dec 2024 09:47:05 +0000 (11:47 +0200)] 
ada: Fix incorrect incomplete type error

In Ada 2005 even if the formal is using a tagged limited type
then the type should not be considered incomplete.

gcc/ada/ChangeLog:

* sem_ch6.adb (Analyze_Subprogram_Body_Helper):
Exchange_Limited_Views also in Ada 2005.

6 months agoada: Fix finalization issue introduced by previous change
Eric Botcazou [Fri, 6 Dec 2024 14:30:49 +0000 (15:30 +0100)] 
ada: Fix finalization issue introduced by previous change

When detecting calls to subprograms specified for aspects of a type, the
entity denoted by the aspects must go through Ultimate_Alias, since that
of the name of the calls did the same.

gcc/ada/ChangeLog:

* exp_ch6.adb (Expand_Call_Helper): Call Ultimate_Alias for the
detection of calls to subprograms specified for Constant_Indexing.
* exp_util.adb (Is_Indexed_Container): Likewise.
(Is_Iterated_Container): Likewise for Default_Iterator.

6 months agoada: Fix markup in user's guide
Ronan Desplanques [Fri, 6 Dec 2024 14:26:33 +0000 (15:26 +0100)] 
ada: Fix markup in user's guide

gcc/ada/ChangeLog:

* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix markup.
* gnat_ugn.texi: Regenerate.

6 months agoada: Remove workaround for RM_Size being unable to represent unknown size
Piotr Trojanek [Fri, 6 Dec 2024 08:33:28 +0000 (09:33 +0100)] 
ada: Remove workaround for RM_Size being unable to represent unknown size

When validating instances of Ada.Unchecked_Conversion, we explicitly detected
null arrays, because a size of 0 was used to indicate both an unknown size and
an actual size of 0. This limitation has been lifted, so we can remove
detection of null arrays.

Code cleanup; behavior is unaffected.

gcc/ada/ChangeLog:

* sem_ch13.adb (Validate_Unchecked_Conversions): Remove detection of
null arrays; remove tests for sizes being present, which are redundant
after calling Known_Static_RM_Size.

6 months agotree-ssa-dce: Punt on allocations with too large constant sizes [PR118224]
Jakub Jelinek [Mon, 6 Jan 2025 09:12:00 +0000 (10:12 +0100)] 
tree-ssa-dce: Punt on allocations with too large constant sizes [PR118224]

As suggested by Richi in the PR, the following patch will fail to DCE
allocation calls if they have constant size which is too large (over
PTRDIFF_MAX), or for the case of calloc, if either of the arguments
is too large (in that case in theory the call could succeed if the other
argument is variable zero but who cares) or if both are constant and
their product overflows or is above PTRDIFF_MAX.

This will make some pedantic conformance tests happy, though if one
hides the size one will still need to use -fno-malloc-dce or obfuscate even
the malloc etc. uses.  If the size is constant and too large, it isn't worth
trying to optimize it.

2025-01-06  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/118224
* tree-ssa-dce.cc (is_removable_allocation_p): Don't return true
for allocations with constant size argument larger than PTRDIFF_MAX
or for calloc with one of the arguments constant larger than
PTRDIFF_MAX or their product known constant above PTRDIFF_MAX.
Fix comment typos, furhter -> further and then -> than.
* lto-section-in.cc (lto_free_function_in_decl_state_for_node):
Fix comment typo, furhter -> further.

* gcc.dg/pr118224.c: New test.
* c-c++-common/ubsan/vla-1.c (bar): Use noipa attribute instead
of noinline, noclone.

6 months agoAda: fix documentation of pragma Unimplemented_Unit
Eric Botcazou [Mon, 6 Jan 2025 07:46:06 +0000 (08:46 +0100)] 
Ada: fix documentation of pragma Unimplemented_Unit

gcc/ada
PR ada/117936
* doc/gnat_rm/implementation_defined_pragmas.rst
(Unimplemented_Unit): Adjust the description of the error message.
* gnat_rm.texi: Regenerate.

6 months agoRISC-V: Move fortran testcase to gfortran.target
Kito Cheng [Mon, 23 Dec 2024 13:27:46 +0000 (21:27 +0800)] 
RISC-V: Move fortran testcase to gfortran.target

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/fortran/pr111395.f90: Move this file to...
* gfortran.target/riscv/rvv/pr111395.f90: ...here.
* gcc.target/riscv/rvv/fortran/pr111566.f90: Move this file to...
* gfortran.target/riscv/rvv/pr111566.f90: ...here.
* gcc.target/riscv/rvv/rvv-fortran.exp: Move this file to...
* gfortran.target/riscv/rvv/rvv.exp: ...here.

6 months agoDaily bump.
GCC Administrator [Mon, 6 Jan 2025 00:16:54 +0000 (00:16 +0000)] 
Daily bump.

6 months agod: Merge upstream dmd, druntime 66b93fc24a, phobos 0c28620c3
Iain Buclaw [Sun, 5 Jan 2025 13:40:13 +0000 (14:40 +0100)] 
d: Merge upstream dmd, druntime 66b93fc24a, phobos 0c28620c3

Synchronizing with the upstream release of v2.109.1.

D front-end changes:

- Import dmd v2.109.1.
- Copying from `const(void)[]' to `void[]' is now disallowed
  with `-fpreview=fiximmutableconv'.
- Import expressions are now treated as hex strings.
- Using boolean values other than 0 or 1 in `@safe' code is now
  deprecated.

D runtime changes:

- Import dmd v2.109.1.

Phobos changes:

- Import dmd v2.109.1.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 66b93fc24a.
* dmd/VERSION: Bump version to v2.109.1.
* d-builtins.cc (build_frontend_type): Update for new front-end
interface.
(matches_builtin_type): Likewise.
* d-codegen.cc (identity_compare_p): Likewise.
(call_side_effect_free_p): Likewise.
* d-convert.cc (convert_expr): Likewise.
(check_valist_conversion): Likewise.
* d-lang.cc (d_types_compatible_p): Likewise.
* d-target.cc (Target::isVectorTypeSupported): Likewise.
(Target::isReturnOnStack): Likewise.
(Target::preferPassByRef): Likewise.
* decl.cc (class DeclVisitor): Likewise.
* expr.cc (class ExprVisitor): Likewise.
* typeinfo.cc (class TypeInfoVisitor): Likewise.
* types.cc (class TypeVisitor): Likewise.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 66b93fc24a.
* src/MERGE: Merge upstream phobos 0c28620c3.
* src/Makefile.am (PHOBOS_DSOURCES): Add
std/internal/test/sumtype_example_overloads.d.
* src/Makefile.in: Regenerate.

6 months agod: Merge upstream dmd, druntime 07bc5b9b3c, phobos de1dea109
Iain Buclaw [Sun, 5 Jan 2025 13:24:49 +0000 (14:24 +0100)] 
d: Merge upstream dmd, druntime 07bc5b9b3c, phobos de1dea109

Synchronizing with the upstream release of v2.109.0.

D front-end changes:

        - Import dmd v2.109.0.

D runtime changes:

        - Import druntime v2.109.0.

Phobos changes:

        - Import phobos v2.109.0.

gcc/d/ChangeLog:

* decl.cc (DeclVisitor::finish_vtable): Update for new front-end
interface.
* dmd/MERGE: Merge upstream dmd 07bc5b9b3c.
* dmd/VERSION: Bump version to v2.109.0.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 07bc5b9b3c.
* src/MERGE: Merge upstream phobos de1dea109.

6 months agolibphobos: Merge upstream druntime c11e1d1708, phobos 303b9c9f7
Iain Buclaw [Sun, 5 Jan 2025 12:51:59 +0000 (13:51 +0100)] 
libphobos: Merge upstream druntime c11e1d1708, phobos 303b9c9f7

Synchronizing the library with the upstream release of v2.108.1.

D runtime changes:

        - Import druntime v2.108.1.
- Removed all `collectNoStack' functions and API from the
  garbage collector.
- The static method `core.thread.Thread.sleep' is now marked as
  `@trusted'.

Phobos changes:

        - Import phobos v2.108.1.
- Add `std.process.Config.preExecDelegate'.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime c11e1d1708.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add
core/sys/freebsd/mqueue.d.
(DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/sys/mount.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 303b9c9f7.
* testsuite/libphobos.exceptions/invalid_memory_operation.d: Adjust
test.

6 months agod: Merge upstream dmd c11e1d1708, druntime e60bfd11bd, phobos 8729740e3
Iain Buclaw [Sun, 29 Dec 2024 05:40:04 +0000 (06:40 +0100)] 
d: Merge upstream dmd c11e1d1708, druntime e60bfd11bd, phobos 8729740e3

Synchronizing the compiler with the upstream release of v2.108.1.

D front-end changes:

        - Import dmd v2.108.1.
- Add experimental support for language editions, enabled by
  adding the UDA `@__edition_latest_do_not_use' before module
  declarations.
- [Next Edition] Aliasing a member of a type instance is now an
  error.
- Added `__ctfeWrite' to write messages from CTFE.
- `-fdump-c++-spec' generates signatures for `extern(Windows)'
  and `extern(System)' functions.
- `foreach_reverse' on a delegate is now an error.
- ImportC has improved Unicode support.

D runtime changes:

        - Mark unsafe unittest @trusted.

Phobos changes:

        - Mark unsafe functions @trusted.

gcc/d/ChangeLog:

* Make-lang.in (D_FRONTEND_OBJS): Add d/attribsem.o,
d/common-charactertables.o, d/common-identifiertables.o.
* d-attribs.cc (apply_user_attributes): Update for new front-end
interface.
* d-builtins.cc (d_init_versions): Predefine CppRuntime_GNU.
* d-incpath.cc (add_globalpaths): Update for new front-end interface.
(add_filepaths): Likewise.
(add_import_paths): Likewise.
* d-lang.cc (d_post_options): Likewise.
* dmd/MERGE: Merge upstream dmd c11e1d1708.
* dmd/VERSION: Bump version to v2.108.1.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime e60bfd11bd.
* src/MERGE: Merge upstream phobos 8729740e3.

gcc/testsuite/ChangeLog:

* gdc.dg/torture/pr96435.d: Add dg-warning.

6 months agoAda: Fix build for dummy s-taprop
Estevan Castilho (Tevo) [Sat, 28 Dec 2024 20:37:37 +0000 (20:37 +0000)] 
Ada: Fix build for dummy s-taprop

gcc/ada
* libgnarl/s-taprop__dummy.adb: Remove use clause for
System.Parameters.
(Unlock): Remove Global_Lock formal parameter.
(Write_Lock): Likewise.

6 months agotestsuite, d: Fix failing pr110406.d test
Iain Buclaw [Sun, 5 Jan 2025 10:19:31 +0000 (11:19 +0100)] 
testsuite, d: Fix failing pr110406.d test

At some point during GCC 15 development, the compiler-generated code for
D ModuleInfo support now gets transformed into the following on x86:

    _12 = (uint) &__stop_minfo;
    _13 = (uint) &__start_minfo;
    _14 = (uint) &gdc.dso_slot;
    _15 = {1, _14, _13, _12};
    gdc.dso_initialized = 0;
    MEM <unsigned char[8]> [(void *)&D.1974 + 16B] = {};
    MEM <vector(4) uint> [(void *)&D.1974] = _15;
    _d_dso_registry (&D.1974);

This causes the scan-tree-dump-not test to fail. As ModuleInfo is not
what's being checked for in PR110406, remove its generation altogether.

gcc/testsuite/ChangeLog:

* gdc.dg/torture/pr110406.d: Add -fno-moduleinfo to dg-options.

6 months agoDaily bump.
GCC Administrator [Sun, 5 Jan 2025 00:16:24 +0000 (00:16 +0000)] 
Daily bump.

6 months agotestsuite: Replace MMIX-specific adjustments with TARGET_CALLEE_COPIES-adjustments
Hans-Peter Nilsson [Fri, 3 Jan 2025 17:34:14 +0000 (18:34 +0100)] 
testsuite: Replace MMIX-specific adjustments with TARGET_CALLEE_COPIES-adjustments

With the dump now emitting "privatized symbols" in the default
"%s.%lu" format also for MMIX, there's still a difference for MMIX.
This time it's because numbers have changed (copies introduced before
this point) because it has TARGET_CALLEE_COPIES yielding true.
Redundant copies may have been elided at this point, but the change
in name remains.

Since that's true for other targets too, an obvious change is to
generalize the tested patterns to include TARGET_CALLEE_COPIES-true
targets, as a brief inspection of the history of these tests shows
that the point of these tests lie not in whether copies have been done
but in the part of the pattern that match a constant.

Also fixed up a "." where there should have been a "\\.".

* gcc.dg/tree-ssa/vector-4.c: Replace MMIX adjustments with
TARGET_CALLEE_COPIES-agnostic adjustments.
* gcc.dg/tree-ssa/forwprop-36.c: Ditto.  Correct pattern to match a
literal ".".

6 months agoMMIX: Replace format for private symbol output by output-time adjustment
Hans-Peter Nilsson [Fri, 3 Jan 2025 17:25:36 +0000 (18:25 +0100)] 
MMIX: Replace format for private symbol output by output-time adjustment

All this started with belated MMIX regression patrol in observance of
the holidays, looking at gcc.dg/Wstringop-overflow-27.c as a
regression for target mmix.  That's because of a single message not
matched, where there is "note: destination object 'vla::22'" instead
of the expected "note: destination object 'vla'" due to
r11-5523-geafe8ee7af13c3 in which the message format and the match
changed.

That ::22 is because some identifiers that are SSA_NAME-versions and
other clones are "privatized" by ASM_FORMAT_PRIVATE_NAME and its
companion macro by default, ASM_PN_FORMAT; see the patch.  I found
that these "private names" were "unprivatized" for the purpose of
warnings and error messages *in code that only handles the default
format*, "%s.%lu".

I went ahead and wrote and tested a patch-set to hookize that
unprivatizing code, but found that it would only affect errors and
warnings; dumps still had the "target format".  While having bad
thoughts about being hit by yet another structural testism because of
the choice of outputting yet another target-specific format instead of
a canonical "versioned" format, I realized it *already was handling a
canonical format*: only the default "%s.%lu" is properly handled.

To wit, targets are better off with the default "%s.%lu" and adjusting
it (if needed, including not allowing "." or "$"), *at time of
assembly code output*.  IOW, outputs, both references and definitions,
pass a single label-output target code point: ASM_OUTPUT_LABELREF,
which is that time of output.  Some older testsuite adjustments need
to be unadjusted, but is another rabbit-hole, so I've kept that change
separate.  Other tests checking dumps, now started to pass for the
first time, some 20+.

* config/mmix/mmix.cc (mmix_asm_output_labelref): Replace '.'
with '::'.
* config/mmix/mmix.h (ASM_PN_FORMAT): Define to actual default.

6 months agoDaily bump.
GCC Administrator [Sat, 4 Jan 2025 00:17:49 +0000 (00:17 +0000)] 
Daily bump.

6 months agoOpenMP: Robustify C front end handling of attribute-syntax pragmas
Sandra Loosemore [Fri, 3 Jan 2025 17:35:03 +0000 (17:35 +0000)] 
OpenMP: Robustify C front end handling of attribute-syntax pragmas

Presently, the code to handle OpenMP attribute-syntax pragmas in the C
front end assumes nothing else is messing with redirecting
parser->tokens, and makes no provision for restoring it from anything
other than parser->tokens_buf when the buffer allocated for the pragma
is exhausted.  Adding support for metadirectives will change that,
since it also needs to buffer tokens for the metadirective
alternatives, and an attribute-syntax directive can appear inside a
metadirective.

This patch adds a more general save/restore mechanism attached to the
parser via a pointer to a new struct omp_attribute_pragma_state.

gcc/c/ChangeLog

* c-parser.cc (struct c_parser): Change in_omp_attribute_pragma
field to be of type struct omp_attribute_pragma_state.
(struct omp_attribute_pragma_state): New.
(c_parser_skip_until_found): Use the new way to restore state
on EOF.
(c_parser_skip_to_pragma_eol): Likewise.
(c_parser_handle_statement_omp_attributes): Create an
omp_attribute_pragma_state to hold the restore state.  Do not
store state in tok.flags.
(omp_maybe_parse_omp_decl): Likewise.

6 months agortlanal: Treat writes to sp as also writing to memory [PR117938]
Richard Sandiford [Fri, 3 Jan 2025 18:12:07 +0000 (18:12 +0000)] 
rtlanal: Treat writes to sp as also writing to memory [PR117938]

This PR was about a case in which late-combine moved a stack
deallocation across an earlier stack access.  This was possible
because the deallocation was missing the RTL-SSA equivalent of
a vop, which in turn was because rtl_properties didn't treat
the deallocation as writing to memory.  I think the bug was
ultimately there.

gcc/
PR rtl-optimization/117938
* rtlanal.cc (rtx_properties::try_to_add_dest): Treat writes
to the stack pointer as also writing to memory.

gcc/testsuite/
PR rtl-optimization/117938
* gcc.dg/torture/pr117938.c: New test.

6 months agoMention generating C prototypes in the C interop documentation.
Thomas Koenig [Fri, 3 Jan 2025 17:31:07 +0000 (18:31 +0100)] 
Mention generating C prototypes in the C interop documentation.

gcc/fortran/ChangeLog:

* gfortran.texi: New subsection "Generating C prototypes from
Fortran".

6 months agolibgomp: Regenerate configure after copyright year bump
Jakub Jelinek [Fri, 3 Jan 2025 17:06:19 +0000 (18:06 +0100)] 
libgomp: Regenerate configure after copyright year bump

2025-01-03  Jakub Jelinek  <jakub@redhat.com>

* configure: Regenerate.