]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
8 months agoDaily bump.
GCC Administrator [Fri, 6 Dec 2024 00:24:09 +0000 (00:24 +0000)] 
Daily bump.

8 months agoc++: Don't reject pointer to virtual method during constant evaluation [PR117615]
Simon Martin [Tue, 3 Dec 2024 13:30:43 +0000 (14:30 +0100)] 
c++: Don't reject pointer to virtual method during constant evaluation [PR117615]

We currently reject the following valid code:

=== cut here ===
struct Base {
    virtual void doit (int v) const {}
};
struct Derived : Base {
    void doit (int v) const {}
};
using fn_t = void (Base::*)(int) const;
struct Helper {
    fn_t mFn;
    constexpr Helper (auto && fn) : mFn(static_cast<fn_t>(fn)) {}
};
void foo () {
    constexpr Helper h (&Derived::doit);
}
=== cut here ===

The problem is that since r6-4014-gdcdbc004d531b4, &Derived::doit is
represented with an expression with type pointer to method and using an
INTEGER_CST (here 1), and that cxx_eval_constant_expression rejects any
such expression with a non-null INTEGER_CST.

This patch uses the same strategy as r12-4491-gf45610a45236e9 (fix for
PR c++/102786), and simply lets such expressions go through.

PR c++/117615

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_constant_expression): Don't reject
INTEGER_CSTs with type POINTER_TYPE to METHOD_TYPE.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-virtual22.C: New test.

(cherry picked from commit 72a2380a306a1c3883cb7e4f99253522bc265af0)

8 months agoAVR: target/64242 - Copy FP to a local reg in nonlocal_goto.
Georg-Johann Lay [Wed, 4 Dec 2024 19:56:50 +0000 (20:56 +0100)] 
AVR: target/64242 - Copy FP to a local reg in nonlocal_goto.

In nonlocal_goto sets, change hard_frame_pointer_rtx only after
emit_stack_restore() restored SP.  This is needed because SP
my be stored in some frame location.

gcc/
PR target/64242
* config/avr/avr.md (nonlocal_goto): Don't restore
hard_frame_pointer_rtx directly, but copy it to local
register, and only set hard_frame_pointer_rtx from it
after emit_stack_restore().

(cherry picked from commit f7b5527d1b48b33d8ab633c1e9dcb9883667492a)

8 months agoDaily bump.
GCC Administrator [Thu, 5 Dec 2024 00:25:32 +0000 (00:25 +0000)] 
Daily bump.

8 months ago[PATCH] PR modula2/117660: Errors referring to variables of type array could display...
Gaius Mulley [Wed, 4 Dec 2024 09:03:36 +0000 (09:03 +0000)] 
[PATCH] PR modula2/117660: Errors referring to variables of type array could display full declaration

This patch ensures that the tokens defining the full declaration of an
ARRAY type is stored in the symbol table and used during production of
error messages.

gcc/m2/ChangeLog:

PR modula2/117660
* gm2-compiler/P2Build.bnf (ArrayType): Update tok with the
composite token produced during array type declaration.
* gm2-compiler/P2SymBuild.mod (EndBuildArray): Create the
combinedtok and store it into the symbol table.
Also ensure combinedtok is pushed to the quad stack.
(BuildFieldArray): Preserve typetok.
* gm2-compiler/SymbolTable.def (PutArray): Rename parameters.
* gm2-compiler/SymbolTable.mod (PutArray): Rename parameters.

gcc/testsuite/ChangeLog:

PR modula2/117660
* gm2/iso/fail/arraymismatch.mod: New test.

(cherry picked from commit ab7abf1db09519a92f4a02af30ed6b834264c45e)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/117371: Add check for zero step in for loop
Gaius Mulley [Wed, 4 Dec 2024 08:01:13 +0000 (08:01 +0000)] 
[PATCH] PR modula2/117371: Add check for zero step in for loop

This patch is a follow on from PR modula2/117371 which could include
a check to enforce the ISO restriction on a zero for loop step.

gcc/m2/ChangeLog:

PR modula2/117371
* gm2-compiler/M2GenGCC.mod (PerformLastForIterator):
Add check for zero step value and issue an error message.

gcc/testsuite/ChangeLog:

PR modula2/117371
* gm2/iso/fail/forloopbyzero.mod: New test.

(cherry picked from commit e37641458e9e1be1a81ff7fab4f4ab8398147d80)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Wed, 4 Dec 2024 00:27:27 +0000 (00:27 +0000)] 
Daily bump.

8 months ago[PATCH] PR modula2/117371: type incompatibility between INTEGER and CARDINAL
Gaius Mulley [Wed, 4 Dec 2024 00:11:22 +0000 (00:11 +0000)] 
[PATCH] PR modula2/117371: type incompatibility between INTEGER and CARDINAL

This patch enforces a const expression increment in a FOR loop.
It also fixes missing error locations.  The FOR loop last iterator
value is now calculated during M2GenGCC after all types and constants have
been resolved.  This results in fewer quadruples (as there is no need to
build two paths for step > 0 and step < 0).

gcc/m2/ChangeLog:

PR modula2/117371
* gm2-compiler/M2Base.mod (MixMetaTypes): Add parameter TRUE to
MetaErrorDecl.
(IsUserType): Test against ZType.
(MixTypesDecl): Test for ZType.
* gm2-compiler/M2GenGCC.mod (ErrorMessageDecl): Add parameter TRUE to
MetaErrorDecl.
(CodeLastForIterator): New procedure.
(FoldLastForIterator): Ditto.
(PerformLastForIterator): Ditto.
(CodeStatement): Add case clause for LastForIteratorOp.
(ErrorMessageDecl): Add iserror parameter.
Call MetaErrorDecl with iserror parameter.
(checkIncorrectMeta): Call MetaErrorDecl with TRUE parameter.
(CheckBinaryExpressionTypes): Ditto.
(CheckElementSetTypes): Ditto.
* gm2-compiler/M2LexBuf.def (MakeVirtualTok): Update comment
detailing the fall back when UnknownTokenNo is encountered.
(MakeVirtual2Tok): Ditto.
* gm2-compiler/M2LexBuf.mod (MakeVirtualTok): Check against
UnknownTokenNo.
(MakeVirtual2Tok): Ditto.
* gm2-compiler/M2MetaError.def (MetaErrorDecl): Add error parameter.
* gm2-compiler/M2MetaError.mod (MetaErrorDecl): Add error
parameter.
Issue warning if error is FALSE.
* gm2-compiler/M2Quads.def (QuadOperator): Add LastForIteratorOp.
* gm2-compiler/M2Quads.mod (AddQuadInformation): New case clause
LastForIteratorOp.
(CheckAddTuple2Read): New procedure.
(BuildForLoopToRangeCheck): Remove.
(ForLoopLastIteratorVariable): Ditto.
(ForLoopLastIteratorConstant): Ditto.
(ForLoopLastIterator): Reimplement.
(BuildForToByDo): Remove ByType from call to ForLoopLastIterator.
(WriteQuad): New case clause LastForIteratorOp.
(WriteOperator): Ditto.
* gm2-compiler/M2Students.def
(CheckForVariableThatLooksLikeKeyword): Replace with ...
(CheckVariableAgainstKeyword): ... this.
* gm2-compiler/M2Students.mod
(CheckForVariableThatLooksLikeKeyword): Replace with ...
(CheckVariableAgainstKeyword): ... this.
* gm2-compiler/M2SymInit.mod (CheckLastForIterator): New
procedure.
(CheckReadBeforeInitQuad): New case clause to call
CheckLastForIterator.
* gm2-compiler/P2SymBuild.mod: Replace
CheckForVariableThatLooksLikeKeyword with CheckVariableAgainstKeyword.

gcc/testsuite/ChangeLog:

PR modula2/117371
* gm2/iso/fail/forloopbyvar.mod: New test.
* gm2/iso/fail/forloopbyvar4.mod: New test.
* gm2/iso/fail/forloopbyvar5.mod: New test.
* gm2/iso/pass/forloopbyvar3.mod: New test.

(cherry picked from commit f242f79b8afeec58477e99c44530bd503878c6d5)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Add dependencies for generated sources
Gaius Mulley [Tue, 3 Dec 2024 21:17:20 +0000 (21:17 +0000)] 
[PATCH] modula2: Add dependencies for generated sources

This patch adds rules and dependencies for the automatically
generated grammar sources.  Bootstrapped using make -j 160.

gcc/m2/ChangeLog:

* Make-lang.in (m2/gm2-compiler-boot/P0SyntaxCheck.c):
New rule.
(m2/gm2-compiler-boot/P0SyntaxCheck.o): Ditto.
(m2/gm2-compiler-boot/P1Build.c): Ditto.
(m2/gm2-compiler-boot/P1Build.o): Ditto.
(m2/gm2-compiler-boot/P2Build.c): Ditto.
(m2/gm2-compiler-boot/P2Build.o): Ditto.
(m2/gm2-compiler-boot/P3Build.c): Ditto.
(m2/gm2-compiler-boot/P3Build.o): Ditto.
(m2/gm2-compiler-boot/PCBuild.c): Ditto.
(m2/gm2-compiler-boot/PCBuild.o): Ditto.
(m2/gm2-compiler-boot/PHBuild.c): Ditto.
(m2/gm2-compiler-boot/PHBuild.o): Ditto.

(cherry picked from commit 3e6a7824033ffb88b8f99ad93b389f7d0eef22a4)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Reimplement parameter declaration and checking.
Gaius Mulley [Tue, 3 Dec 2024 21:16:25 +0000 (21:16 +0000)] 
[PATCH] modula2: Reimplement parameter declaration and checking.

This patch improves the parameter declaration by saving all parameter
kinds: proper procedure, definition module procedure and forward
procedures.  This allows error messages to reference any parameter
in the three kinds of procedures.  Variables and their declaration
are also stored.  The expression, assignment and parameter checking
has been improved to highlight any variable or parameter and
its declaration causing a conflict.

gcc/m2/ChangeLog:

* gm2-compiler/M2Base.def (MixTypes): Rename parameters.
(MixTypesDecl): New procedure function.
* gm2-compiler/M2Base.mod (BuildOrdFunctions): Add
DefProcedure parameter to PutFunction.
(BuildTruncFunctions): Ditto.
(BuildFloatFunctions): Ditto.
(BuildIntFunctions): Ditto.
(InitBaseFunctions): Ditto.
(MixTypesDecl): New procedure function.
(MixTypes): Reimplement.
* gm2-compiler/M2Check.mod (checkProcType): Replace
NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(checkProcedureProcType): Ditto.
* gm2-compiler/M2Error.def: Remove unnecessary export qualified list.
* gm2-compiler/M2GCCDeclare.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(DeclareProcedureToGccWholeProgram): Rename son to
Variable.
(DeclareProcedureToGccSeparateProgram): Ditto.
(PrintKind): New procedure.
(PrintProcedureParameters): Ditto.
(PrintProcedureReturnType): Ditto.
(PrintProcedure): Reimplement.
(PrintProcTypeParameters): New procedure.
(PrintProcType): Ditto.
(DeclareProcType): Rename Son to Parameter.
* gm2-compiler/M2GenGCC.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(ErrorMessageDecl): New procedure.
(checkIncorrectMeta): Replace call to MetaErrorT2 with
ErrorMessageDecl.
(ComparisonMixTypes): Add varleft and varright parameters.
Adjust all callers of ComparisonMixTypes.
* gm2-compiler/M2MetaError.def (MetaErrorDecl): New procedure.
* gm2-compiler/M2MetaError.mod (MetaErrorDecl): New procedure.
* gm2-compiler/M2Options.def (SetXCode): Add -fd flag description
to comment.
* gm2-compiler/M2Options.mod (SetXCode): Add -fd flag description
to comment.
* gm2-compiler/M2Quads.mod (CheckBreak): New procedure.
Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(FailParameter): Reimplement using GetVarDeclFullTok.
Generate message for formal parameter, actual parameter and
declaration of actual parameter.
(WarnParameter): Ditto.
(CheckBuildFunction): Reimplement error message using MetaErrorT1.
* gm2-compiler/M2Range.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
* gm2-compiler/M2Scaffold.mod (DeclareScaffoldFunctions): Call
PutProcedureDefined after every procedure declaration.
(DeclareArgEnvParams): Add ProperProcedure parameter to PutParam.
* gm2-compiler/M2Size.mod (MakeSize): Add DefProcedure parameter
to PutFunction.
* gm2-compiler/M2Swig.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
* gm2-compiler/M2SymInit.mod: Ditto.
* gm2-compiler/M2System.mod (InitSystem): Add DefProcedure
parameter to PutFunction.
* gm2-compiler/P1SymBuild.mod (StartBuildProcedure): Reimplement.
(EndBuildProcedure): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/P2Build.bnf (BuildProcedureDefinedByForward):
Remove.
(BuildProcedureDefinedByProper): Ditto.
(ForwardDeclaration): Remove BuildProcedureDefinedByForward.
(BuildNoReturnAttribute): Remove parameter.
* gm2-compiler/P2SymBuild.def (BuildNoReturnAttribute): Remove
parameter.
(BuildProcedureDefinedByForward): Remove.
(BuildProcedureDefinedByProper): Ditto.
* gm2-compiler/P2SymBuild.mod (Import): Remove
AreParametersDefinedInDefinition,
AreParametersDefinedInImplementation,
AreProcedureParametersDefined,
ParametersDefinedInDefinition,
ParametersDefinedInImplementation,
GetProcedureDeclaredDefinition,
GetProcedureDeclaredForward,
GetProcedureDeclaredProper,
GetParametersDefinedByForward,
GetParametersDefinedByProper and
PutProcedureNoReturn.
Add PutProcedureParametersDefined,
GetProcedureParametersDefined,
GetProcedureKindDesc,
GetProcedureDeclaredTok,
GetProcedureKind,
GetReturnTypeTok,
SetReturnOptional,
IsReturnOptional,
PutProcedureNoReturn and
PutProcedureDefined.
(Debug): New procedure.
(P2StartBuildDefModule): Space formatting.
(BuildVariable): Reimplement to record full declaration.
(StartBuildProcedure): Reimplement using token to determine
the kind of procedure.
(BuildProcedureHeading): Ditto.
(BuildFPSection): Ditto.
(BuildVarArgs): Ditto.
(BuildOptArg): Ditto.
(BuildProcedureDefinedByForward): Remove.
(BuildProcedureDefinedByProper): Ditto.
(BuildFormalParameterSection): Reimplement so that the
quad stack is unchanged.
(CheckFormalParameterSection): Ditto.
(RemoveFPParameters): New procedure.
(ParameterError): Reimplement.
(StartBuildFormalParameters): Add annotation.
(ParameterMismatch): Reimplement.
(EndBuildFormalParameters): Reimplement to check against
all procedure kinds.
(GetSourceDesc): Remove.
(GetCurSrcDesc): Ditto.
(GetDeclared): Ditto.
(ReturnTypeMismatch): Reimplement.
(BuildFunction): Ditto.
(BuildOptFunction): Ditto.
(CheckOptFunction): New procedure.
(BuildNoReturnAttribute): Remove parameter and obtain
procedure symbol from quad stack.
(CheckProcedureReturn): New procedure.
* gm2-compiler/P3SymBuild.mod (BuildOptArgInitializer):
Preserve ProcSym tok on the quad stack.
Add Assert.
* gm2-compiler/PCSymBuild.mod (fixupProcedureType): Replace
NoOfParam with NoOfParamAny.
* gm2-compiler/SymbolTable.def (GetNthParam): Add ProcedureKind
parameter.
(PutFunction): Ditto.
(PutOptFunction): Ditto.
(IsReturnOptional): Ditto.
(PutParam): Ditto.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(PutProcedureNoReturn): Ditto.
(IsProcedureNoReturn): Ditto.
(IsVarParam): Ditto.
(IsUnboundedParam): Ditto.
(NoOfParam): Ditto.
(ForeachLocalSymDo): Ditto.
(GetProcedureKind): Ditto.
(GetProcedureDeclaredTok): Ditto.
(PutProcedureDeclaredTok): Ditto.
(GetReturnTypeTok): Ditto.
(PutReturnTypeTok): Ditto.
(PutParametersDefinedByForward): New procedure.
(PutProcedureParametersDefined): Ditto.
(PutProcedureDefined): Ditto.
(GetParametersDefinedByProper): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureDefined): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(PutOptArgInit): Ditto.
(SetReturnOptional): Ditto.
(UsesOptArgAny): Ditto.
(GetProcedureKindDesc): Ditto.
(IsReturnOptionalAny): New procedure function.
(GetNthParamAny): Ditto.
(NoOfParamAny): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(AreParametersDefinedInImplementation): Remove.
(ParametersDefinedInImplementation): Ditto.
(AreParametersDefinedInDefinition): Ditto.
(AreProcedureParametersDefined): Ditto.
(ParametersDefinedInDefinition): Ditto.
(ProcedureParametersDefined): Ditto.
(PutParametersDefinedByProper): Ditto.
(PutProcedureDeclaredForward): Ditto.
(GetParametersDefinedByForward): Ditto.
(GetProcedureParametersDefined): Ditto.
(PushOffset): Ditto.
(PopSize): Ditto.
(PushParamSize): Ditto.
(PushSumOfLocalVarSize): Ditto.
(PushSumOfParamSize): Ditto.
(PopOffset): Ditto.
(PopSumOfParamSize): Ditto.
* gm2-compiler/SymbolTable.mod (MakeProcedure): Reimplement.
(PutProcedureNoReturn): Add ProcedureKind parameter.
(GetNthParam): Ditto.
(PutFunction): Ditto.
(PutOptFunction): Ditto.
(IsReturnOptional): Ditto.
(MakeVariableForParam): Ditto.
(PutParam): Ditto.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(AddParameter): Ditto.
(IsVarParam): Ditto.
(IsVarParamAny): Ditto.
(NoOfParam): Ditto.
(HasVarParameters): Ditto.
(IsUnboundedParam): Ditto.
(PutUseVarArgs): Ditto.
(UsesVarArgs): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(UsesOptArgAny): Ditto.
(PutOptArgInit): Ditto.
(IsProcedure): Ditto.
(IsPointer): Ditto.
(IsRecord): Ditto.
(IsArray): Ditto.
(IsEnumeration): Ditto.
(IsUnbounded): Ditto.
(IsSet): Ditto.
(IsSetPacked): Ditto.
(CheckUnbounded): Ditto.
(IsOAFamily): Ditto.
(IsModuleWithinProcedure): Ditto.
(GetDeclaredDef): Ditto.
(GetDeclaredMod): Ditto.
(GetDeclaredFor): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureKind): Ditto.
(PutProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredTok): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredTok): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetReturnTypeTok): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutReturnTypeTok): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureKindDesc): Ditto.
(IsProcedureVariable): Ditto.
(IsAModula2Type): Ditto.
(GetParam): Ditto.
(ProcedureParametersDefined): Ditto.
(AreParametersDefinedInImplementation): Remove.
(AreParametersDefinedInDefinition): Ditto.
(AreProcedureParametersDefined): Ditto.
(IsSizeSolved): Ditto.
(IsOffsetSolved): Ditto.
(IsValueSolved): Ditto.
(IsSumOfParamSizeSolved): Ditto.
(PushSize): Ditto.
(PushOffset): Ditto.
(PopSize): Ditto.
(PushValue): Ditto.
(PushParamSize): Ditto.
(PushSumOfLocalVarSize): Ditto.
(PushSumOfParamSize): Ditto.
(PushVarSize): Ditto.
(PopValue): Ditto.
(PopSize): Ditto.
(PopOffset): Ditto.
(PopSumOfParamSize): Ditto.
(PutParametersDefinedByForward): New procedure.
(PutProcedureParametersDefined): Ditto.
(PutProcedureDefined): Ditto.
(GetParametersDefinedByProper): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureDefined): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(PutOptArgInit): Ditto.
(SetReturnOptional): Ditto.
(UsesOptArgAny): Ditto.
(GetProcedureKindDesc): Ditto.
(PutParametersDefinedByProper): Ditto.
(GetParametersDefinedByProper): Ditto.
(IsReturnOptionalAny): New procedure function.
(IsProcedureAnyDefaultBoolean): Ditto.
(IsProcedureAnyBoolean): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(GetNthParamAny): Ditto.
(NoOfParamAny): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(GetProcedureKind): Ditto.
(IsVarParamAny): Ditto.
(IsUnboundedParamAny): Ditto.
(ForeachParamSymDo): New comment.
* gm2-libs-coroutines/SYSTEM.mod: Reformat.

gcc/testsuite/ChangeLog:

* gm2/iso/fail/badexpression3.mod: New test.
* gm2/iso/fail/badparam4.def: New test.
* gm2/iso/fail/badparam4.mod: New test.

(cherry picked from commit 95960cd473297cd0d2c9e75a1a424b870cee32f5)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoUpdate gcc zh_CN.po
Joseph Myers [Tue, 3 Dec 2024 18:28:09 +0000 (18:28 +0000)] 
Update gcc zh_CN.po

* zh_CN.po: Update.

8 months agomiddle-end:For multiplication try swapping operands when matching complex multiply...
Tamar Christina [Thu, 21 Nov 2024 15:10:24 +0000 (15:10 +0000)] 
middle-end:For multiplication try swapping operands when matching complex multiply [PR116463]

This commit fixes the failures of complex.exp=fast-math-complex-mls-*.c on the
GCC 14 branch and some of the ones on the master.

The current matching just looks for one order for multiplication and was relying
on canonicalization to always give the right order because of the TWO_OPERANDS.

However when it comes to the multiplication trying only one order is a bit
fragile as they can be flipped.

The failing tests on the branch are:

void fms180snd(_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
               _Complex TYPE c[restrict N]) {
  for (int i = 0; i < N; i++)
    c[i] -= a[i] * (b[i] * I * I);
}

void fms180fst(_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
               _Complex TYPE c[restrict N]) {
  for (int i = 0; i < N; i++)
    c[i] -= (a[i] * I * I) * b[i];
}

The issue is just a small difference in commutative operations.
we look for {R,R} * {R,I} but found {R,I} * {R,R}.

Since the DF analysis is cached, we should be able to swap operands and retry
for multiply cheaply.

There is a constraint being checked by vect_validate_multiplication for the data
flow of the operands feeding the multiplications.  So e.g.

between the nodes:

note:   node 0x4d1d210 (max_nunits=2, refcnt=3) vector(2) double
note:   op template: _27 = _10 * _25;
note:      stmt 0 _27 = _10 * _25;
note:      stmt 1 _29 = _11 * _25;
note:   node 0x4d1d060 (max_nunits=2, refcnt=2) vector(2) double
note:   op template: _26 = _11 * _24;
note:      stmt 0 _26 = _11 * _24;
note:      stmt 1 _28 = _10 * _24;

we require the lanes to come from the same source which
vect_validate_multiplication checks.  As such it doesn't make sense to flip them
individually because that would invalidate the earlier linear_loads_p checks
which have validated that the arguments all come from the same datarefs.

This patch thus flips the operands in unison to still maintain this invariant,
but also honor the commutative nature of multiplication.

gcc/ChangeLog:

PR tree-optimization/116463
* tree-vect-slp-patterns.cc (complex_mul_pattern::matches,
complex_fms_pattern::matches): Try swapping operands on multiply.

(cherry picked from commit a9473f9c6f2d755d2eb79dbd30877e64b4bc6fc8)

8 months ago[PATCH] modula2: M2MetaError.{def,mod} and P2SymBuild.mod further cleanup
Gaius Mulley [Tue, 3 Dec 2024 15:58:27 +0000 (15:58 +0000)] 
[PATCH] modula2: M2MetaError.{def,mod} and P2SymBuild.mod further cleanup

Further cleanups and improve the wording of an error message.

gcc/m2/ChangeLog:

* gm2-compiler/M2MetaError.mod (op): Corrected ordering.
* gm2-compiler/P2SymBuild.def: Remove comment.
* gm2-compiler/P2SymBuild.mod (GetComparison): Replace
the word less with fewer.

(cherry picked from commit 961c02313f7e7a918e06851964ba54ea2e342cfa)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Tidyup gm2-compiler/M2MetaError.mod
Gaius Mulley [Tue, 3 Dec 2024 14:39:03 +0000 (14:39 +0000)] 
[PATCH] modula2: Tidyup gm2-compiler/M2MetaError.mod

This patch is a tidyup for gm2-compiler/M2MetaError.mod.

gcc/m2/ChangeLog:

* gm2-compiler/M2MetaError.mod (op): Alphabetically order
each case label and comment.

(cherry picked from commit 7fa9fd47f161d6b8177439ae2b46a2048a5eaa24)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/115328 The FORWARD keyword is not implemented
Gaius Mulley [Tue, 3 Dec 2024 13:37:01 +0000 (13:37 +0000)] 
[PATCH] PR modula2/115328 The FORWARD keyword is not implemented

This patch implements the FORWARD keyword found in the ISO standard.
The patch checks incoming parameters against the prior declaration
found in definition/forward sections and will issue an error based
on virtual tokens highlighing the full parameter declaration.

gcc/m2/ChangeLog:

PR modula2/115328
* gm2-compiler/M2MetaError.def: Extend comment documentating
new format specifiers.
* gm2-compiler/M2MetaError.mod (GetTokProcedure): New declaration.
(doErrorScopeModule): New procedure.
(doErrorScopeForward): Ditto.
(doErrorScopeMod): Reimplement.
(doErrorScopeFor): New procedure.
(declarationMod): Ditto.
(doErrorScopeDefinition): Ditto.
(doErrorScopeDef): Reimplement.
(declaredDef): New procedure.
(declaredFor): Ditto.
(doErrorScopeProc): Ditto.
(declaredVar): Ditto.
(declaredType): Ditto.
(declaredFull): Ditto.
* gm2-compiler/M2Options.mod (SetAutoInit): Add missing
return type.
(GetDumpGimple): Remove duplicate implementation.
* gm2-compiler/M2Quads.def (DupFrame): New procedure.
* gm2-compiler/M2Quads.mod (DupFrame): New procedure.
* gm2-compiler/M2Reserved.def (ForwardTok): New variable.
* gm2-compiler/M2Reserved.mod (ForwardTok): Initialize variable.
* gm2-compiler/M2Scaffold.mod (DeclareArgEnvParams): Add
tokno parameter for call to PutParam.
* gm2-compiler/P0SymBuild.def (EndForward): New procedure.
* gm2-compiler/P0SymBuild.mod (EndForward): New procedure.
* gm2-compiler/P0SyntaxCheck.bnf (BlockAssert): New procedure.
(ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P1Build.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P1SymBuild.def (Export): Removed unnecessary
export.
(EndBuildForward): New procedure.
* gm2-compiler/P1SymBuild.mod (StartBuildProcedure): Reimplement.
(EndBuildProcedure): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/P2Build.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P2SymBuild.def (BuildProcedureDefinedByForward):
New procedure.
(BuildProcedureDefinedByProper): Ditto.
(CheckProcedure): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/P2SymBuild.mod (EndBuildProcedure): Reimplement.
(EndBuildForward): New procedure.
(BuildFPSection): Reimplement to allow forward declaration or
checking of parameters.
(BuildProcedureDefinedByProper): New procedure.
(BuildProcedureDefinedByForward): Ditto
(FailParameter): Remove.
(ParameterError): New procedure.
(ParameterMismatch): Ditto.
(EndBuildFormalParameters): Add parameter number check.
(GetComparison): New procedure function.
(GetSourceDesc): Ditto.
(GetCurSrcDesc): Ditto.
(GetDeclared): New procedure.
(ReturnTypeMismatch): Ditto.
(BuildFunction): Reimplement.
(CheckProcedure): New procedure.
(CheckFormalParameterSection): Reimplement using ParameterError.
* gm2-compiler/P3Build.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P3SymBuild.def (Export): Remove unnecessary export.
(EndBuildForward): New procedure.
* gm2-compiler/P3SymBuild.mod (EndBuildForward): New procedure.
* gm2-compiler/PCBuild.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/PCSymBuild.def (EndBuildForward): New procedure.
* gm2-compiler/PCSymBuild.mod (EndBuildForward): Ditto.
* gm2-compiler/PHBuild.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/SymbolTable.def (PutVarTok): New procedure.
(PutParam): Add typetok parameter.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(GetDeclaredFor): New procedure function.
(AreParametersDefinedInDefinition): Ditto.
(PutParametersDefinedByForward): New procedure.
(GetParametersDefinedByForward): New procedure function.
(PutParametersDefinedByProper): New procedure.
(GetParametersDefinedByProper): New procedure function.
(GetProcedureDeclaredForward): Ditto.
(PutProcedureDeclaredForward): New procedure.
(GetProcedureDeclaredProper): New procedure function.
(PutProcedureDeclaredProper): New procedure.
(GetProcedureDeclaredDefinition): New procedure function.
(PutProcedureDeclaredDefinition): New procedure.
(GetVarDeclTypeTok): Ditto.
(PutVarDeclTypeTok): New procedure.
(GetVarDeclTok): Ditto.
(PutVarDeclTok): New procedure.
(GetVarDeclFullTok): Ditto.
* gm2-compiler/SymbolTable.mod (ProcedureDecl): New record type.
(VarDecl): Ditto.
(SymProcedure): Add new field Declared.
(SymVar): Add new field Declared.
(PutVarTok): New procedure.
(PutParam): Add typetok parameter.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(GetDeclaredFor): New procedure function.
(AreParametersDefinedInDefinition): Ditto.
(PutParametersDefinedByForward): New procedure.
(GetParametersDefinedByForward): New procedure function.
(PutParametersDefinedByProper): New procedure.
(GetParametersDefinedByProper): New procedure function.
(GetProcedureDeclaredForward): Ditto.
(PutProcedureDeclaredForward): New procedure.
(GetProcedureDeclaredProper): New procedure function.
(PutProcedureDeclaredProper): New procedure.
(GetProcedureDeclaredDefinition): New procedure function.
(PutProcedureDeclaredDefinition): New procedure.
(GetVarDeclTypeTok): Ditto.
(PutVarDeclTypeTok): New procedure.
(GetVarDeclTok): Ditto.
(PutVarDeclTok): New procedure.
(GetVarDeclFullTok): Ditto.
(MakeProcedure): Initialize Declared field.
(MakeVar): Initialize Declared field.
* gm2-libs-log/FileSystem.def (FileNameChar): Add
missing return type.
* m2.flex: Add FORWARD keyword.

gcc/testsuite/ChangeLog:

PR modula2/115328
* gm2/iso/fail/badparam.def: New test.
* gm2/iso/fail/badparam.mod: New test.
* gm2/iso/fail/badparam2.def: New test.
* gm2/iso/fail/badparam2.mod: New test.
* gm2/iso/fail/badparam3.def: New test.
* gm2/iso/fail/badparam3.mod: New test.
* gm2/iso/fail/badparamarray.def: New test.
* gm2/iso/fail/badparamarray.mod: New test.
* gm2/iso/fail/simpledef1.def: New test.
* gm2/iso/fail/simpledef1.mod: New test.
* gm2/iso/fail/simpleforward.mod: New test.
* gm2/iso/fail/simpleforward2.mod: New test.
* gm2/iso/fail/simpleforward3.mod: New test.
* gm2/iso/fail/simpleforward4.mod: New test.
* gm2/iso/fail/simpleforward5.mod: New test.
* gm2/iso/fail/simpleforward7.mod: New test.
* gm2/iso/pass/simpleforward.mod: New test.
* gm2/iso/pass/simpleforward6.mod: New test.

(cherry picked from commit e751639e3d20efe97186faa7dca33e7761ba1e79)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Tue, 3 Dec 2024 00:26:40 +0000 (00:26 +0000)] 
Daily bump.

8 months agolibstdc++: Use constexpr instead of _GLIBCXX20_CONSTEXPR in <vector>
Jonathan Wakely [Wed, 18 Sep 2024 15:17:28 +0000 (16:17 +0100)] 
libstdc++: Use constexpr instead of _GLIBCXX20_CONSTEXPR in <vector>

For the operator<=> overload we can use the 'constexpr' keyword
directly, because we know the language dialect is at least C++20.

libstdc++-v3/ChangeLog:

* include/bits/stl_vector.h (operator<=>): Use constexpr
instead of _GLIBCXX20_CONSTEXPR macro.

(cherry picked from commit b6463161c3cd0b1f764697290d9569c7153b8a5b)

8 months agolibstdc++: avoid -Wsign-compare
Jason Merrill [Tue, 27 Aug 2024 17:17:20 +0000 (13:17 -0400)] 
libstdc++: avoid -Wsign-compare

-Wsign-compare complained about these comparisons between (unsigned) size_t
and (signed) streamsize, or between (unsigned) native_handle_type
and (signed) -1.  Fixed by adding casts to unify the types.

libstdc++-v3/ChangeLog:

* include/std/istream: Add cast to avoid -Wsign-compare.
* include/std/stacktrace: Likewise.

(cherry picked from commit 4246cf4f18053eeb47cb2a241fffa9a41573916e)

8 months agolibstdc++: fix testcase regexp
Jason Merrill [Tue, 27 Aug 2024 17:16:47 +0000 (13:16 -0400)] 
libstdc++: fix testcase regexp

The unescaped * broke the match.

libstdc++-v3/ChangeLog:

* testsuite/20_util/default_delete/void_neg.cc: Fix regexp quoting.

(cherry picked from commit 7bd2a2f9e3ef9f7de4c2f478241f7083cc54d7d3)

8 months agolibstdc++: avoid -Wzero-as-null-pointer-constant
Jason Merrill [Tue, 27 Aug 2024 17:15:52 +0000 (13:15 -0400)] 
libstdc++: avoid -Wzero-as-null-pointer-constant

libstdc++-v3/ChangeLog:

* include/std/coroutine (coroutine_handle): Use nullptr instead of
0 as initializer for _M_fr_ptr.

(cherry picked from commit 28f94bf91a536395347a2da5558f0ddf014e814f)

8 months agolibstdc++: remove extra semicolons
Jason Merrill [Tue, 27 Aug 2024 17:13:40 +0000 (13:13 -0400)] 
libstdc++: remove extra semicolons

The semicolons after each macro invocation here end up following the closing
brace of a function, leading to -Wextra-semi pedwarns.

libstdc++-v3/ChangeLog:

* include/decimal/decimal.h (_DEFINE_DECIMAL_BINARY_OP_WITH_INT):
Remove redundant semicolons.

(cherry picked from commit 7b500fa34ad88d5fdd4bf74eb2737b214749075b)

8 months agolibstdc++: Fix -Wunused-parameter warnings in Networking TS headers
Jonathan Wakely [Wed, 28 Aug 2024 11:21:56 +0000 (12:21 +0100)] 
libstdc++: Fix -Wunused-parameter warnings in Networking TS headers

libstdc++-v3/ChangeLog:

* include/experimental/io_context: Remove name of unused
parameter.
* include/experimental/socket: Add [[maybe_unused]] attribute.

(cherry picked from commit 51b0fef4e6ee01ed2509bd54a448d2564a89c518)

8 months agolibstdc++: Silence -Woverloaded-virtual warning in cxx11-ios_failure.cc
Jonathan Wakely [Wed, 18 Sep 2024 14:38:02 +0000 (15:38 +0100)] 
libstdc++: Silence -Woverloaded-virtual warning in cxx11-ios_failure.cc

libstdc++-v3/ChangeLog:

* src/c++11/cxx11-ios_failure.cc (__iosfail_type_info): Unhide
the three-arg overload of __do_upcast.

(cherry picked from commit d842eb5ee6cb4d8a2795730ac88c4c2960f94bf4)

8 months agolibstdc++: Silence -Wattributes warning in exception_ptr
Jonathan Wakely [Wed, 18 Sep 2024 14:41:05 +0000 (15:41 +0100)] 
libstdc++: Silence -Wattributes warning in exception_ptr

libstdc++-v3/ChangeLog:

* libsupc++/exception_ptr.h (__exception_ptr::_M_safe_bool_dummy):
Remove __attribute__((const)) from function returning void.

(cherry picked from commit 164c1b1f812da5d1e00fc10a415e80f7c508efcb)

8 months agolibstdc++: Remove unused typedef in <ranges>
Jonathan Wakely [Wed, 28 Aug 2024 10:49:08 +0000 (11:49 +0100)] 
libstdc++: Remove unused typedef in <ranges>

This local typedef should have been removed in r14-6199-g45630fbcf7875b.

libstdc++-v3/ChangeLog:

* include/std/ranges (to): Remove unused typedef.

(cherry picked from commit a59f1cc31cf6c7ed30a78cef134ea3ed5e139414)

8 months agolibstdc++: Improve comment for _Hashtable::_M_insert_unique_node
Jonathan Wakely [Thu, 7 Nov 2024 16:51:58 +0000 (16:51 +0000)] 
libstdc++: Improve comment for _Hashtable::_M_insert_unique_node

Clarify the effects if rehashing is needed. Document the __n_elt
parameter.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_M_insert_unique_node): Improve
comment.

(cherry picked from commit e97179bacd067ccd3ee765632e0c034df152ccb6)

8 months agolibstdc++: Fix get<0> constraint for lvalue ranges::subrange (LWG 3589)
Jonathan Wakely [Thu, 14 Nov 2024 17:31:43 +0000 (17:31 +0000)] 
libstdc++: Fix get<0> constraint for lvalue ranges::subrange (LWG 3589)

Approved at October 2021 plenary.

libstdc++-v3/ChangeLog:

* include/bits/ranges_util.h (subrange::begin): Fix constraint,
as per LWG 3589.
* testsuite/std/ranges/subrange/lwg3589.cc: New test.

(cherry picked from commit 4a3a0be34f723df192361e43bb48b9292dfe3a54)

8 months agolibstdc++: Check feature test macros in unordered containers
Jonathan Wakely [Fri, 1 Nov 2024 10:50:02 +0000 (10:50 +0000)] 
libstdc++: Check feature test macros in unordered containers

Replace some `__cplusplus > 201402L` preprocessor checks with more
expressive checks for the appropriate feature test macros.

libstdc++-v3/ChangeLog:

* include/bits/unordered_map.h: Check __glibcxx_node_extract and
__glibcxx_unordered_map_try_emplace instead of __cplusplus.
* include/bits/unordered_set.h: Check __glibcxx_node_extract
instead of __cplusplus.

(cherry picked from commit 1a5bdeb1128ecfa4ce233218d02ccbb88ce0d8a8)

8 months agolibstdc++: Use appropriate feature test macro for std::byte
Jonathan Wakely [Fri, 11 Oct 2024 12:29:06 +0000 (13:29 +0100)] 
libstdc++: Use appropriate feature test macro for std::byte

libstdc++-v3/ChangeLog:

* include/bits/cpp_type_traits.h (__is_byte<byte>): Guard with
__glibcxx_byte macro instead of checking __cplusplus.

(cherry picked from commit 00a87ee76f47d0fa5a10ef982101cb3c3b8e9c99)

8 months agolibstdc++: Make equal and is_permutation short-circuit (LWG 3560)
Jonathan Wakely [Thu, 14 Nov 2024 16:57:17 +0000 (16:57 +0000)] 
libstdc++: Make equal and is_permutation short-circuit (LWG 3560)

We already implement short-circuiting for random access iterators, but
we also need to do so for ranges::equal and ranges::is_permutation when
given sized ranges that are not random access ranges (e.g. std::list).

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__is_permutation_fn::operator()):
Short-circuit for sized ranges with different sizes, as per LWG
3560.
* include/bits/ranges_algobase.h (__equal_fn::operator()):
Likewise.
* include/bits/stl_algo.h (__is_permutation): Use if-constexpr
for random access iterator branches.
* include/bits/stl_algobase.h (__equal4): Likewise.
* testsuite/25_algorithms/equal/lwg3560.cc: New test.
* testsuite/25_algorithms/is_permutation/lwg3560.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
(cherry picked from commit 45cc42d6dc0642612e7076e95820438a1aab5479)

8 months agolibstdc++: Implement LWG 3798 for range adaptors [PR106676]
Jonathan Wakely [Sun, 13 Oct 2024 21:28:16 +0000 (22:28 +0100)] 
libstdc++: Implement LWG 3798 for range adaptors [PR106676]

LWG 3798 modified the iterator_category of the iterator types for
transform_view, join_with_view, zip_transform_view and
adjacent_transform_view, to allow the iterator's reference type to be an
rvalue reference.

libstdc++-v3/ChangeLog:

PR libstdc++/106676
* include/bits/iterator_concepts.h (__cpp17_fwd_iterator): Use
is_reference instead of is_value_reference.
rvalue references.
* include/std/ranges (transform_view:__iter_cat::_S_iter_cat):
Likewise.
(zip_transform_view::__iter_cat::_S_iter_cat): Likewise.
(adjacent_transform_view::__iter_cat::_S_iter_cat): Likewise.
(join_with_view::__iter_cat::_S_iter_cat): Likewise.
* testsuite/std/ranges/adaptors/transform.cc: Check
iterator_category when the transformation function returns an
rvalue reference type.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
(cherry picked from commit 7f65f94917866c6b18d9698eec6451c1bf21e0f9)

8 months agolibstdc++: Fix -Wsign-compare warning in std::string::resize_for_overwrite
Jonathan Wakely [Fri, 27 Sep 2024 14:51:56 +0000 (15:51 +0100)] 
libstdc++: Fix -Wsign-compare warning in std::string::resize_for_overwrite

libstdc++-v3/ChangeLog:

* include/bits/basic_string.tcc (resize_for_overwrite): Fix
-Wsign-compare warning.
* include/bits/cow_string.h (resize_for_overwrite): Likewise.

(cherry picked from commit 7040c207baa6b5d5f6065a47dd3559f3d3974a1b)

8 months agolibstdc++: Fix std::vector<bool>::emplace to forward parameter
Jonathan Wakely [Sat, 26 Oct 2024 20:24:58 +0000 (21:24 +0100)] 
libstdc++: Fix std::vector<bool>::emplace to forward parameter

If the parameter is not lvalue-convertible to bool then the current code
will fail to compile. The parameter should be forwarded to restore the
original value category.

libstdc++-v3/ChangeLog:

* include/bits/stl_bvector.h (emplace_back, emplace): Forward
parameter pack to preserve value category.
* testsuite/23_containers/vector/bool/emplace_rvalue.cc: New
test.

(cherry picked from commit f1c844be5202f4be446f165d9a7625eb7ec4c5b4)

8 months agolibstdc++: Fix typo in comment in hashtable.h
Jonathan Wakely [Tue, 5 Nov 2024 23:55:08 +0000 (23:55 +0000)] 
libstdc++: Fix typo in comment in hashtable.h

And tweak grammar in a couple of comments.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h: Fix spelling in comment.

(cherry picked from commit bcf40c70f8b0fbc54ec14adea31f274e1791b1ed)

8 months agolibstdc++: Minor comment improvements in <bits/hashtable.h>
Jonathan Wakely [Fri, 1 Nov 2024 12:46:26 +0000 (12:46 +0000)] 
libstdc++: Minor comment improvements in <bits/hashtable.h>

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h: Improve comments.

(cherry picked from commit db798ee38a3f81eff207e889c36c727bb370112c)

8 months agolibstdc++: Add missing parts of LWG 3480 for directory iterators [PR117560]
Jonathan Wakely [Thu, 14 Nov 2024 01:14:44 +0000 (01:14 +0000)] 
libstdc++: Add missing parts of LWG 3480 for directory iterators [PR117560]

It looks like I only read half the resolution of LWG 3480 and decided we
already supported it. As well as making the non-member overloads of end
take their parameters by value, we need some specializations of the
enable_borrowed_range and enable_view variable templates.

libstdc++-v3/ChangeLog:

PR libstdc++/117560
* include/bits/fs_dir.h (enable_borrowed_range, enable_view):
Define specializations for directory iterators, as per LWG 3480.
* testsuite/27_io/filesystem/iterators/lwg3480.cc: New test.

(cherry picked from commit eec6e8923586b9a54e37f32cef112d26d86e8f01)

8 months agolibstdc++: Fix calculation of system time in performance tests
Jonathan Wakely [Wed, 13 Nov 2024 16:47:04 +0000 (16:47 +0000)] 
libstdc++: Fix calculation of system time in performance tests

The system_time() function used the wrong element of the splits array.

Also add a comment about the units for time measurements.

libstdc++-v3/ChangeLog:

* testsuite/util/testsuite_performance.h (time_counter): Add
comment about times.
(time_counter::system_time): Use correct split value.

(cherry picked from commit 19d0720f68c2617f1b9b686d3884333b60ca75da)

8 months agolibstdc++: Use __is_single_threaded() in performance tests
Jonathan Wakely [Wed, 13 Nov 2024 16:37:24 +0000 (16:37 +0000)] 
libstdc++: Use __is_single_threaded() in performance tests

With recent glibc releases the __gthread_active_p() function is always
true, so we always append "-thread" onto performance benchmark names.

Use the __gnu_cxx::__is_single_threaded() function instead.

libstdc++-v3/ChangeLog:

* testsuite/util/testsuite_performance.h: Use
__gnu_cxx::__is_single_threaded instead of __gthread_active_p().

(cherry picked from commit 2b92007016ce8de3fc0a8c4508a789b822ea8e6b)

8 months agolibstdc++: Add missing constraint to operator+ for std::move_iterator
Jonathan Wakely [Thu, 14 Nov 2024 10:50:34 +0000 (10:50 +0000)] 
libstdc++: Add missing constraint to operator+ for std::move_iterator

This constraint was added by the One Ranges proposal (P0896R4) and
then fixed by LWG 3293, but it was missing from libstdc++.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (operator+): Add constraint to
move_iterator operator.
* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc:

(cherry picked from commit f91e34644e66b2eb7f4930f17a30da9f49e7d4d2)

8 months agolibstdc++: Fix allocator-extended move ctor for std::basic_stacktrace [PR117822]
Jonathan Wakely [Thu, 28 Nov 2024 10:24:00 +0000 (10:24 +0000)] 
libstdc++: Fix allocator-extended move ctor for std::basic_stacktrace [PR117822]

libstdc++-v3/ChangeLog:

PR libstdc++/117822
* include/std/stacktrace (stacktrace(stacktrace&&, const A&)):
Fix typo in qualified-id for is_always_equal trait.
* testsuite/19_diagnostics/stacktrace/stacktrace.cc: Test
allocator-extended constructors and allocator propagation.

(cherry picked from commit fe04901737112abb6b1a71fe645f727384dc986a)

8 months agolibstdc++: Fix std::basic_stracktrace to not assume allocators throw std::bad_alloc
Jonathan Wakely [Tue, 24 Sep 2024 11:44:09 +0000 (12:44 +0100)] 
libstdc++: Fix std::basic_stracktrace to not assume allocators throw std::bad_alloc

The standard allows allocators to throw any kind of exception, not only
something that can be caught as std::bad_alloc. std::basic_stracktrace
was assuming std::bad_alloc.

libstdc++-v3/ChangeLog:

* include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate):
Do not assume allocators only throw std::bad_alloc.

(cherry picked from commit c45844eb7dadcd48e3ce84444a45c270382f7ad1)

8 months ago[PATCH] PR modula2/116918 -fswig correct syntax fixup
Gaius Mulley [Mon, 2 Dec 2024 21:34:38 +0000 (21:34 +0000)] 
[PATCH] PR modula2/116918 -fswig correct syntax fixup

This patch adds a missing % escape in DoCheckUnbounded.

gcc/m2/ChangeLog:

PR modula2/116918
* gm2-compiler/M2Swig.mod (DoCheckUnbounded): Escape
the % character used in array_functions with %%.

(cherry picked from commit e2a701cd0419a1898a2a359711572a8bcf4f8eb3)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoFortran: passing inquiry ref of complex array to assumed rank dummy [PR117774]
Harald Anlauf [Mon, 25 Nov 2024 21:55:10 +0000 (22:55 +0100)] 
Fortran: passing inquiry ref of complex array to assumed rank dummy [PR117774]

PR fortran/117774

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): When passing an array
to an assumed-rank dummy, terminate search for array reference of
actual argument before an inquiry reference (e.g. INQUIRY_RE,
INQUIRY_IM) so that bounds update works properly.

gcc/testsuite/ChangeLog:

* gfortran.dg/assumed_rank_25.f90: New test.

(cherry picked from commit eff7e72815ada5c70c974d42f6a419e29a03eb27)

8 months ago[PATCH] PR modula2/116918 -fswig correct syntax
Gaius Mulley [Mon, 2 Dec 2024 20:25:25 +0000 (20:25 +0000)] 
[PATCH] PR modula2/116918 -fswig correct syntax

This patch fixes the syntax for the generated swig interface file.
The % characters in fprintf require escaping.

gcc/m2/ChangeLog:

PR modula2/116918
* gm2-compiler/M2Swig.mod (AnnotateProcedure): Capitalize
the generated comment, split comment into multiple lines and
terminate the comment with ".  */".
(DoCheckUnbounded): Escape the % character with %%.
(DoWriteFile): Ditto.

(cherry picked from commit fda30a3c8a7c6b06f02be40e3fd0740f893a1b4f)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Add noreturn attribute to m2/gm2-libs/M2RTS.mod
Gaius Mulley [Mon, 2 Dec 2024 18:03:31 +0000 (18:03 +0000)] 
[PATCH] modula2: Add noreturn attribute to m2/gm2-libs/M2RTS.mod

This patch removes a build warning by adding a noreturn attribute
to the M2RTS.mod:HaltC procedure.  Also add an infinite loop to
gm2-libs-min/M2RTS.mod.

gcc/m2/ChangeLog:

* Make-lang.in (m2/gm2-libs-boot/M2RTS.o): Remove
--suppress-noreturn.
* gm2-libs/M2RTS.mod (HaltC): Add noreturn attribute.
* gm2-libs-min/M2RTS.mod (HALT): Add LOOP END.

(cherry picked from commit 5ef52ec422b8b92539baaa761ad878ccb6f82db8)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/117555: Add missing return statement after raise
Gaius Mulley [Mon, 2 Dec 2024 14:34:32 +0000 (14:34 +0000)] 
[PATCH] PR modula2/117555: Add missing return statement after raise

This patch adds missing return statements after a call to RAISE.  Four
of the modules in libgm2 have procedure functions with missing return
statements.  These errors were exposed after the reimplementation of
parameter declaration patch and triggered by -Wreturn-type.  The patch
also adds exit statements to the M2RTS noreturn functions.

gcc/m2/ChangeLog:

PR modula2/117555
* gm2-libs-iso/EXCEPTIONS.mod (CurrentNumber): Add return
statement.
* gm2-libs-iso/IOChan.mod (ReadResult): Ditto.
(CurrentFlags): Ditto.
(DeviceError): Ditto.
* gm2-libs-iso/IOLink.mod (DeviceTablePtrValue): Ditto.
* gm2-libs-iso/LongConv.mod (ValueReal): Ditto.
* gm2-libs/M2RTS.mod (Halt): Add noreturn attribute.
Add exit (1).
(HaltC): Add exit (1).
* pge-boot/GM2RTS.cc (M2RTS_Halt): Add exit (1).
(M2RTS_HaltC): Ditto.

(cherry picked from commit e77fd9aa89c210db6006fcefb03d80bae0fae851)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoarm, mve: Adding missing Runtime Library Exception to header files
Andre Vieira [Mon, 2 Dec 2024 13:35:03 +0000 (13:35 +0000)] 
arm, mve: Adding missing Runtime Library Exception to header files

Add missing Runtime Library Exception to mve header files to bring them into
line with other similar headers. Not adding it in the first place was an
oversight.

gcc/ChangeLog:

* config/arm/arm_mve.h: Add Runtime Library Exception.
* config/arm/arm_mve_types.h: Likewise.

(cherry picked from commit cde7ce0628f66a5d03cc97c70d4695e6f2acd4db)

8 months ago[PATCH] PR modula2/117555: libgm2 build failure after r15-5081-g95960cd473297c
Gaius Mulley [Mon, 2 Dec 2024 13:25:14 +0000 (13:25 +0000)] 
[PATCH] PR modula2/117555: libgm2 build failure after r15-5081-g95960cd473297c

This patch adds missing return statements to library procedure
functions.  These missing statements occur after a call to RAISE.

gcc/m2/ChangeLog:

PR modula2/117555
* gm2-libs-iso/M2EXCEPTION.mod (M2Exception): Add missing
return statement.
* gm2-libs-iso/RealConv.mod (ValueReal): Ditto.
* gm2-libs-iso/RndFile.mod (StartPos): Ditto.
(EndPos): Ditto.
(NewPos): Ditto.
* gm2-libs-iso/ShortConv.mod (ValueReal): Ditto.
* gm2-libs-iso/WholeConv.mod (ValueInt): Ditto.
(ValueCard): Ditto.

(cherry picked from commit 6d90f5d0ae928320e6e4ce9fce8e658404d8cb72)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Mon, 2 Dec 2024 00:24:12 +0000 (00:24 +0000)] 
Daily bump.

8 months ago[PATCH] modula2: Tidyup remove unnecessary parameters
Gaius Mulley [Sun, 1 Dec 2024 23:09:44 +0000 (23:09 +0000)] 
[PATCH] modula2: Tidyup remove unnecessary parameters

This patch removes ununsed parameters from gm2-compiler/M2Comp.mod.

gcc/m2/ChangeLog:

* gm2-compiler/M2Comp.mod (GenerateDependencies): Remove
unused parameter.
(WriteDep): Remove parameter dep.
(WritePhoneDep): Ditto.

(cherry picked from commit 20486ec75734f3e641a3ade4297f6ba64881bca8)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Remove unused parameter warnings seen in build
Gaius Mulley [Sun, 1 Dec 2024 14:41:40 +0000 (14:41 +0000)] 
[PATCH] modula2: Remove unused parameter warnings seen in build

This patch removes unused parameters in gm2-compiler/M2Check.mod.
It also removes a --fixme-- and completes the missing code
which type checks unbounded arrays.  The patch also fixes a
build error seen when building m2/stage2/cc1gm2.

gcc/m2/ChangeLog:

* gm2-compiler/M2Check.mod (checkUnboundedArray): New
procedure function.
(checkUnboundedUnbounded): Ditto.
(checkUnbounded): Rewrite to check the unbounded data
type.
(checkPair): Add comment.
(doCheckPair): Add comment.
Remove tinfo parameter from the call to checkTypeKindViolation.
(checkTypeKindViolation): Remove ununsed parameter tinfo.
* gm2-libs-ch/UnixArgs.cc (GM2RTS.h): Remove include.
* gm2-libs-ch/m2rts.h (M2RTS_INIT): New define.
(M2RTS_DEP): Ditto.
(M2RTS_RegisterModule): New prototype.
(GM2RTS.h): Add include to the MC_M2 block.

gcc/testsuite/ChangeLog:

* gm2/iso/fail/testarrayunbounded2.mod: New test.
* gm2/iso/fail/testarrayunbounded3.mod: New test.
* gm2/iso/fail/testarrayunbounded4.mod: New test.
* gm2/iso/fail/testarrayunbounded5.mod: New test.
* gm2/iso/fail/testarrayunbounded6.mod: New test.
* gm2/iso/pass/testarrayunbounded.mod: New test.

(cherry picked from commit 2828ec526eaf5612178b62d48bfd8443c7ecd674)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Sun, 1 Dec 2024 00:26:11 +0000 (00:26 +0000)] 
Daily bump.

8 months agoFortran: Fix failing character pointer fcn assignment [PR105054]
Paul Thomas [Wed, 13 Nov 2024 08:57:55 +0000 (08:57 +0000)] 
Fortran: Fix failing character pointer fcn assignment [PR105054]

2024-11-14  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/105054
* resolve.cc (get_temp_from_expr): If the pointer function has
a deferred character length, generate a new deferred charlen
for the temporary.

gcc/testsuite/
PR fortran/105054
* gfortran.dg/ptr_func_assign_6.f08: New test.

(cherry picked from commit f530a8c61383b174a476b64f46d56adeedf49dc4)

8 months ago[PATCH] modula2: gcc/m2/Make-lang.in fix includes during bootstrap build
Gaius Mulley [Sat, 30 Nov 2024 02:22:37 +0000 (02:22 +0000)] 
[PATCH] modula2: gcc/m2/Make-lang.in fix includes during bootstrap build

This patch fixes the include directories used when building objects in
gm2-compiler-boot.  It adds the missing gm2-gcc directory and uses a
new variable GM2_BOOT_INCLUDES for all gm2-compiler-boot rules.

gcc/m2/ChangeLog:

* Make-lang.in (GM2_BOOT_INCLUDES): New variable.
(m2/gm2-compiler-boot/M2GCCDeclare.o): Rewrite to use
GM2_BOOT_INCLUDES.
(m2/gm2-compiler-boot/M2Error.o): Ditto.
(m2/gm2-compiler-boot/%.o): Ditto.

(cherry picked from commit 58bc39c73ca9aeca3d62d2d963be0121d0efeeac)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Sat, 30 Nov 2024 00:25:55 +0000 (00:25 +0000)] 
Daily bump.

8 months ago[PATCH] PR modula2/116181 Use GCC tree location_t and separate pointer types
Gaius Mulley [Fri, 29 Nov 2024 22:34:49 +0000 (22:34 +0000)] 
[PATCH] PR modula2/116181 Use GCC tree location_t and separate pointer types

This patch fixes all remaining -Wodr warnings in the modula-2 front end.
It removes the m2 Tree and m2 Location definitions and uses tree and
location_t throughout.  This allows the bootstrap tool mc to pick up the
GCC definitions for these data types (for the C translation of m2 sources).

The patch introduces a new module CDataTypes which contain two pointer
types: CharStar and ConstCharStar.  These map onto their C counterparts
when processed by mc however currently gm2 treats them as ADDRESS.
It might be sensible to have the gm2 versions of these data types
implemented though a builtin module in the future.

gcc/m2/ChangeLog:

PR modula2/116181
* Make-lang.in (GM2-GCC-DEFS): Add gcctypes.def and
CDataTypes.def.
(MC-LIB-DEFS): Add CDataTypes.def.
* Make-maintainer.in (m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o):
Change include path to pge-boot.
(m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)%.o): Ditto.
(GM2PATH): Add -I$(srcdir)/m2/gm2-gcc.
(m2/mc-boot-gen/$(SRC_PREFIX)%.h): Add -I$(srcdir)/m2/gm2-gcc.
(m2/mc-boot-gen/$(SRC_PREFIX)%.cc): Ditto.
* gm2-compiler/M2ALU.def (PushIntegerTree): Replace Tree with tree.
(PopIntegerTree): Ditto.
(PushRealTree): Ditto.
(PopRealTree): Ditto.
(PushComplexTree): Ditto.
(PopComplexTree): Ditto.
(PushSetTree): Ditto.
(PopSetTree): Ditto.
(PopConstructorTree): Ditto.
(ConstructSetConstant): Ditto.
(BuildRange): Ditto.
(CheckOrResetOverflow): Ditto.
(PushTypeOfTree): Ditto.
* gm2-compiler/M2ALU.mod (Tree): Replace with ...
(tree): ... this.
(gcctypes): Import location_t and tree.
(m2linemap): Remove import of location_t.
* gm2-compiler/M2Base.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Base.mod (gcctypes): Import of location_t.
(m2linemap): Remove import of location_t.
* gm2-compiler/M2Bitset.mod (m2tree): Remove import of Tree.
* gm2-compiler/M2CaseList.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2Emit.def (gcctypes): Import location_t.
* gm2-compiler/M2GCCDeclare.def (gcctypes): Import tree.
(PromoteToString): Replace Tree with tree.
(PromoteToCString): Ditto.
(ConstantKnownAndUsed): Ditto.
* gm2-compiler/M2GCCDeclare.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2GenGCC.def (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
(GetHighFromUnbounded): Replace Tree with tree.
(StringToChar): Ditto.
(LValueToGenericPtr): Ditto.
(ZConstToTypedConst): Ditto.
(PrepareCopyString): Ditto.
* gm2-compiler/M2GenGCC.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LangDump.def (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LangDump.mod (Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LexBuf.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2LexBuf.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Options.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Options.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Range.def (m2linemap): Replace with ...
(gcctypes): ... this.
(CDataTypes): Import ConstCharStar.
(CodeErrorCheck): Replace Tree with tree.
(OverlapsRange): Ditto.
(IsEqual): Ditto.
(IsGreaterOrEqual): Ditto.
(IsGreater): Ditto.
(BuildIfCallWholeHandlerLoc): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
(BuildIfCallRealHandlerLoc): Ditto.
(GetMinMax): Ditto.
* gm2-compiler/M2Range.mod (m2tree): Remove Tree.
(CodeErrorCheck): Replace Tree with tree.
(OverlapsRange): Ditto.
(IsEqual): Ditto.
(IsGreaterOrEqual): Ditto.
(IsGreater): Ditto.
(GetMinMax): Ditto.
(BuildIfCallWholeHandlerLoc): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
(BuildIfCallRealHandlerLoc): Ditto.
* gm2-compiler/M2System.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2System.mod (m2linemap): Replace with ...
(gcctypes): ... this.
(CreateMinMaxFor): Replace Tree with tree.
(CreateType): Ditto.
(AttemptToCreateType): Ditto.
(CreateSetType): Ditto.
(AttemptToCreateSetType): Ditto.
* gm2-compiler/P2SymBuild.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/SymbolConversion.def (m2tree): Replace with ...
(gcctypes): ... this.
(Mod2Gcc): Replace Tree with tree.
(Gcc2Mod): Ditto.
(AddModGcc): Ditto.
* gm2-compiler/SymbolConversion.mod (m2tree): Replace with ...
(gcctypes): ... this.
(Mod2Gcc): Replace Tree with tree.
(Gcc2Mod): Ditto.
(AddModGcc): Ditto.
(Mod2GccWithoutGCCPoison): Ditto.
* gm2-compiler/SymbolTable.def (m2tree): Replace with ...
(gcctypes): ... this.
(PutModuleFinallyFunction): Replace Tree with tree.
(GetModuleFinallyFunction): Ditto.
* gm2-compiler/SymbolTable.mod (m2tree): Replace with ...
(gcctypes): ... this.
(PutModuleFinallyFunction): Replace Tree with tree.
(GetModuleFinallyFunction): Ditto.
* gm2-compiler/m2flex.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-gcc/init.def (PerCompilationInit): Replace ADDRESS with ConstCharStar.
(CDataTypes): Import ConstCharStar.
* gm2-gcc/m2block.def (SYSTEM): Remove import.
(CDataTypes): Import ConstCharStar.
(m2linemap): Remove import.
(m2tree): Remove import.
(gcctypes): Import tree.
(global_constant): Replace Tree with tree.
(RememberInitModuleFunction): Ditto.
(DumpGlobalConstants): Ditto.
(RememberConstant): Ditto.
(RememberType): Ditto.
(pushDecl): Ditto.
(popFunctionScope): Ditto.
(pushFunctionScope): Ditto.
(finishFunctionCode): Ditto.
(finishFunctionDecl): Ditto.
(GetErrorNode): Ditto.
(includeDecl): Ditto.
(GetGlobals): Ditto.
(GetGlobalContext): Ditto.
(begin_statement_list): Ditto.
(push_statement_list): Ditto.
(pop_statement_list): Ditto.
(getLabel): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
* gm2-gcc/m2builtins.def (CDataTypes): Import ConstCharStar.
(GetBuiltinConst): Replace Tree with tree.
(GetBuiltinConstType): Ditto.
(GetBuiltinTypeInfoType): Ditto.
(GetBuiltinTypeInfo): Ditto.
(BuiltinExists): Ditto.
(BuildBuiltinTree): Ditto.
(BuiltinMemCopy): Ditto.
(BuiltinMemSet): Ditto.
(BuiltInAlloca): Ditto.
(BuiltInIsfinite): Ditto.
* gm2-gcc/m2convert.def (CDataTypes): Import ConstCharStar.
(ToWord): Ditto.
(ToCardinal): Ditto.
(ToInteger): Ditto.
(ToBitset): Ditto.
(ConvertToPtr): Ditto.
(BuildConvert): Ditto.
(ConvertConstantAndCheck): Ditto.
(ConvertString): Ditto.
(GenericToType): Ditto.
* gm2-gcc/m2decl.cc (m2decl_BuildParameterDeclaration): Add
const attribute.
* gm2-gcc/m2decl.def (CDataTypes): Import ConstCharStar.
(BuildModuleCtor): Ditto.
(DeclareModuleCtor): Ditto.
(DeclareM2linkForcedModuleInitOrder): Ditto.
(DeclareM2linkStaticInitialization): Ditto.
(BuildPtrToTypeString): Ditto.
(BuildIntegerConstant): Ditto.
(BuildStringConstantType): Ditto.
(DeclareKnownVariable): Ditto.
(DeclareKnownConstant): Ditto.
(BuildParameterDeclaration): Ditto.
(BuildEndFunctionDeclaration): Ditto.
(RememberVariables): Ditto.
(BuildConstLiteralNumber): Ditto.
(BuildStringConstant): Ditto.
(BuildCStringConstant): Ditto.
(GetDeclContext): Ditto.
* gm2-gcc/m2decl.h (m2decl_BuildParameterDeclaration): Add
const attribute.
* gm2-gcc/m2except.def (CDataTypes): Import ConstCharStar.
(BuildThrow): Ditto.
(BuildTryBegin): Ditto.
(BuildTryEnd): Ditto.
(BuildCatchBegin): Ditto.
(BuildCatchEnd): Ditto.
* gm2-gcc/m2expr.def (CDataTypes): Import ConstCharStar.
(CSTIntToString): Ditto.
(CSTIntToChar): Ditto.
(CheckConstStrZtypeRange): Ditto.
(CompareTrees): Ditto.
(GetPointerOne): Ditto.
(GetPointerZero): Ditto.
(GetWordOne): Ditto.
(GetWordZero): Ditto.
(GetIntegerOne): Ditto.
(GetIntegerZero): Ditto.
(GetCardinalOne): Ditto.
(GetCardinalZero): Ditto.
(GetSizeOfInBits): Ditto.
(GetSizeOf): Ditto.
(BuildLogicalRotate): Ditto.
(BuildLRRn): Ditto.
(BuildLRLn): Ditto.
(BuildMask): Ditto.
(BuildMult): Ditto.
(BuildMultCheck): Ditto.
(BuildLRR): Ditto.
(BuildLRL): Ditto.
(BuildLogicalShift): Ditto.
(BuildLSR): Ditto.
(BuildLSL): Ditto.
(BuildDivM2): Ditto.
(BuildDivM2Check): Ditto.
(BuildModM2): Ditto.
(BuildModM2Check): Ditto.
(BuildModFloor): Ditto.
(BuildDivCeil): Ditto.
(BuildModCeil): Ditto.
(BuildDivFloor): Ditto.
(BuildModTrunc): Ditto.
(BuildDivTrunc): Ditto.
(BuildDivTruncCheck): Ditto.
(BuildRDiv): Ditto.
(BuildSubCheck): Ditto.
(BuildAddCheck): Ditto.
(BuildSub): Ditto.
(BuildAdd): Ditto.
(FoldAndStrip): Ditto.
(StringLength): Ditto.
(TreeOverflow): Ditto.
(RemoveOverflow): Ditto.
(BuildCoerce): Ditto.
(BuildTrunc): Ditto.
(BuildNegate): Ditto.
(BuildNegateCheck): Ditto.
(BuildSetNegate): Ditto.
(BuildTBitSize): Ditto.
(BuildSize): Ditto.
(BuildAddr): Ditto.
(BuildOffset1): Ditto.
(BuildOffset): Ditto.
(BuildLogicalOrAddress): Ditto.
(BuildLogicalOr): Ditto.
(BuildLogicalAnd): Ditto.
(BuildSymmetricDifference): Ditto.
(BuildLogicalDifference): Ditto.
(BuildLessThan): Ditto.
(BuildGreaterThan): Ditto.
(BuildLessThanOrEqual): Ditto.
(BuildGreaterThanOrEqual): Ditto.
(BuildEqualTo): Ditto.
(BuildNotEqualTo): Ditto.
(BuildIsSuperset): Ditto.
(BuildIsNotSuperset): Ditto.
(BuildIsSubset): Ditto.
(BuildIsNotSubset): Ditto.
(BuildIfConstInVar): Ditto.
(BuildIfNotConstInVar): Ditto.
(BuildIfVarInVar): Ditto.
(BuildIfNotVarInVar): Ditto.
(BuildForeachWordInSetDoIfExpr): Ditto.
(BuildIfInRangeGoto): Ditto.
(BuildIfNotInRangeGoto): Ditto.
(BuildArray): Ditto.
(BuildComponentRef): Ditto.
(BuildIndirect): Ditto.
(IsTrue): Ditto.
(IsFalse): Ditto.
(GetCstInteger): Ditto.
(AreConstantsEqual): Ditto.
(AreRealOrComplexConstantsEqual): Ditto.
(DetermineSign): Ditto.
(BuildCap): Ditto.
(BuildAbs): Ditto.
(BuildRe): Ditto.
(BuildIm): Ditto.
(BuildCmplx): Ditto.
(BuildBinaryForeachWordDo): Ditto.
(BuildBinarySetDo): Ditto.
(ConstantExpressionWarning): Ditto.
(BuildAddAddress): Ditto.
(calcNbits): Ditto.
(OverflowZType): Ditto.
(BuildCondIfExpression): Ditto.
* gm2-gcc/m2linemap.def (CDataTypes): Import ConstCharStar.
* gm2-gcc/m2misc.def (m2tree): Replace with ...
(gcctypes): ... this.
(DebugTree): Replace Tree with tree.
* gm2-gcc/m2pp.def (m2tree): Replace with ...
(gcctypes): ... this.
(DumpGimpleFd): Replace Tree with tree.
* gm2-gcc/m2statement.cc (m2statement_BuildBuiltinCallTree):
Remove unused location parameter.
* gm2-gcc/m2statement.def (m2linemap): Replace with ...
(gcctypes): ... this.
(CDataTypes): Import CharStar.
(DoJump): Replace Tree with tree.
Replace ADDRESS with CharStar.
(BuildStartFunctionCode): Replace Tree with tree.
(BuildEndFunctionCode): Ditto.
(BuildReturnValueCode): Ditto.
(BuildAssignmentTree): Ditto.
(BuildAssignmentStatement): Ditto.
(BuildGoto): Ditto.
(DeclareLabel): Ditto.
(BuildIfThenDoEnd): Ditto.
(BuildIfThenElseEnd): Ditto.
(BuildParam): Ditto.
(BuildFunctionCallTree): Ditto.
(BuildProcedureCallTree): Ditto.
(BuildIndirectProcedureCallTree): Ditto.
(BuildFunctValue): Ditto.
(BuildCall2): Ditto.
(BuildCall3): Ditto.
(SetLastFunction): Ditto.
(GetLastFunction): Ditto.
(GetParamTree): Ditto.
(BuildTryFinally): Ditto.
(BuildCleanUp): Ditto.
(BuildAsm): Ditto.
(BuildUnaryForeachWordDo): Ditto.
(BuildExcludeVarConst): Ditto.
(BuildExcludeVarVar): Ditto.
(BuildIncludeVarConst): Ditto.
(BuildIncludeVarVar): Ditto.
(BuildStart): Ditto.
(BuildEnd): Ditto.
(BuildCallInner): Ditto.
(BuildBuiltinCallTree):  Remove unused location parameter.
* gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): Remove
unused location parameter.
* gm2-gcc/m2tree.def (gcctypes): Import tree.
(IsAConstant): Replace Tree with tree.
(IsOrdinal): Ditto.
(IsTreeOverflow): Ditto.
(skip_const_decl): Ditto.
(skip_type_decl): Ditto.
(is_type): Ditto.
(is_array): Ditto.
(is_var): Ditto.
(debug_tree): Ditto.
(IstreeOverflow): Ditto.
* gm2-gcc/m2treelib.def (m2linemap): Replace with ...
(gcctypes): ... this.
(get_set_address_if_var): Ditto.
(get_set_field_rhs): Ditto.
(get_set_field_lhs): Ditto.
(get_set_address): Ditto.
(get_set_value): Ditto.
(get_field_no): Ditto.
(get_rvalue): Ditto.
(DoCall): Ditto.
(build_modify_expr): Ditto.
(do_jump_if_bit): Ditto.
* gm2-gcc/m2type.def (m2linemap): Replace with ...
(gcctypes): ... this.
(m2tree): Remove.
(CDataTypes): Import ConstCharStar and charStar.
(ValueInTypeRange): Replace Tree with tree.
(ValueOutOfTypeRange): Ditto.
(ExceedsTypeRange): Ditto.
(WithinTypeRange): Ditto.
(BuildSubrangeType): Ditto.
(BuildCharConstant): Ditto.
(BuildCharConstantChar): Ditto.
(BuildArrayConstructorElement): Ditto.
(BuildEndArrayConstructor): Ditto.
(BuildStartArrayConstructor): Ditto.
(BuildRecordConstructorElement): Ditto.
(BuildEndRecordConstructor): Ditto.
(BuildStartRecordConstructor): Ditto.
(BuildEndSetConstructor): Ditto.
(BuildSetConstructorElement): Ditto.
(BuildStartSetConstructor): Ditto.
(BuildSetType): Ditto.
(BuildConstPointerType): Ditto.
(BuildPointerType): Ditto.
(BuildEnumerator): Ditto.
(BuildEndEnumeration): Ditto.
(BuildStartEnumeration): Ditto.
(BuildTypeDeclaration): Ditto.
(GetMaxFrom): Ditto.
(GetMinFrom): Ditto.
(GetDefaultType): Ditto.
(BuildEndType): Ditto.
(BuildStartType): Ditto.
(BuildVariableArrayAndDeclare): Ditto.
(BuildProcTypeParameterDeclaration): Ditto.
(BuildStartFunctionType): Ditto.
(BuildEndFunctionType): Ditto.
(GetTreeType): Ditto.
(DeclareKnownType): Ditto.
(GetM2ZType): Ditto.
(GetM2RType): Ditto.
(BuildSetTypeFromSubrange): Ditto.
(BuildSmallestTypeRange): Ditto.
(GetBooleanType): Ditto.
(GetBooleanFalse): Ditto.
(GetBooleanTrue): Ditto.
(GetPackedBooleanType): Ditto.
(GetCharType): Ditto.
(GetByteType): Ditto.
(GetVoidType): Ditto.
(GetBitnumType): Ditto.
(GetRealType): Ditto.
(GetLongRealType): Ditto.
(GetShortRealType): Ditto.
(GetLongIntType): Ditto.
(GetPointerType): Ditto.
(GetCardinalType): Ditto.
(GetIntegerType): Ditto.
(GetWordType): Ditto.
(GetM2CardinalType): Ditto.
(GetBitsetType): Ditto.
(GetM2CType): Ditto.
(GetProcType): Ditto.
(GetM2ComplexType): Ditto.
(GetM2LongComplexType): Ditto.
(GetM2ShortComplexType): Ditto.
(GetM2Complex128): Ditto.
(GetM2Complex96): Ditto.
(GetM2Complex64): Ditto.
(GetM2Complex32): Ditto.
(GetM2Real128): Ditto.
(GetM2Real96): Ditto.
(GetM2Real64): Ditto.
(GetM2Real32): Ditto.
(GetM2Bitset32): Ditto.
(GetM2Bitset16): Ditto.
(GetM2Bitset8): Ditto.
(GetM2Word64): Ditto.
(GetM2Word32): Ditto.
(GetM2Word16): Ditto.
(GetM2Cardinal64): Ditto.
(GetM2Cardinal32): Ditto.
(GetM2Cardinal16): Ditto.
(GetM2Cardinal8): Ditto.
(GetM2Integer64): Ditto.
(GetM2Integer32): Ditto.
(GetM2Integer16): Ditto.
(GetM2Integer8): Ditto.
(GetISOLocType): Ditto.
(GetISOByteType): Ditto.
(GetISOWordType): Ditto.
(GetShortCardType): Ditto.
(GetM2ShortCardType): Ditto.
(GetShortIntType): Ditto.
(GetM2ShortIntType): Ditto.
(GetM2LongCardType): Ditto.
(GetM2LongIntType): Ditto.
(GetM2LongRealType): Ditto.
(GetM2RealType): Ditto.
(GetM2ShortRealType): Ditto.
(GetM2IntegerType): Ditto.
(GetM2CharType): Ditto.
(GetCSizeTType): Ditto.
(GetCSSizeTType): Ditto.
(BuildArrayStringConstructor): Ditto.
(RealToTree): Ditto.
(BuildStartRecord): Ditto.
(BuildStartUnion): Ditto.
(BuildStartVarient): Ditto.
(BuildEndVarient): Ditto.
(BuildStartFieldVarient): Ditto.
(BuildEndFieldVarient): Ditto.
(BuildStartFieldRecord): Ditto.
(BuildFieldRecord): Ditto.
(ChainOn): Ditto.
(ChainOnParamValue): Ditto.
(AddStringToTreeList): Ditto.
(BuildEndRecord): Ditto.
(SetAlignment): Ditto.
(SetDeclPacked): Ditto.
(SetTypePacked): Ditto.
(SetRecordFieldOffset): Ditto.
(BuildPackedFieldRecord): Ditto.
(BuildNumberOfArrayElements): Ditto.
(AddStatement): Ditto.
(MarkFunctionReferenced): Ditto.
(BuildArrayIndexType): Ditto.
(GetArrayNoOfElements): Ditto.
(BuildEndArrayType): Ditto.
(PutArrayType): Ditto.
(BuildStartArrayType): Ditto.
(IsAddress): Ditto.
(SameRealType): Ditto.
* m2.flex (Gm2linemap.h): Include.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GFIO.cc: Ditto.
* mc-boot/GIndexing.cc: Ditto.
* mc-boot/GM2Dependent.cc: Ditto.
* mc-boot/GSArgs.cc: Ditto.
* mc-boot/GStringConvert.cc: Ditto.
* mc-boot/Gdecl.cc: Ditto.
* mc-boot/Gdecl.h: Ditto.
* mc-boot/Gdtoa.h: Ditto.
* mc-boot/Gkeyc.cc: Ditto.
* mc-boot/Gkeyc.h: Ditto.
* mc-boot/Glibc.h: Ditto.
* mc-boot/GmcComp.cc: Ditto.
* mc-boot/GmcLexBuf.cc: Ditto.
* mc-boot/GmcPreprocess.cc: Ditto.
* mc-boot/GmcStream.cc: Ditto.
* mc-boot/Gmcp1.cc: Ditto.
* mc-boot/Gmcp3.cc: Ditto.
* mc-boot/Gmcp4.cc: Ditto.
* mc-boot/Gmcp5.cc: Ditto.
* mc-boot/GnameKey.cc: Ditto.
* mc-boot/Gvarargs.cc: Ditto.
* mc/decl.def (putDefUnqualified): New procedure function.
(isDefUnqualified): Ditto.
* mc/decl.mod (defT): Add unqualified field.
(charStarN): New variable.
(constCharStarN): Ditto.
(checkGccType): New procedure.
(checkCDataTypes): Ditto.
(import): Call checkGccType and checkCDataTypes.
(putDefUnqualified): New procedure function.
(isDefUnqualified): Ditto.
* mc/keyc.def (useGccTree): New procedure.
(useGccLocation): Ditto.
* mc/keyc.mod (checkGccConfigSystem): Call checkGccConfigSystem.
(useGccTree): New procedure.
(useGccLocation): Ditto.
* mc/mcp1.bnf (decl): Import putDefUnqualified.
(Export): Call putDefUnqualified.
* gm2-gcc/CDataTypes.def: New file.
* gm2-gcc/gcctypes.def: New file.

(cherry picked from commit f6e629a7134c6b83be4542b8cd26b7c4483d17f4)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/116557 Remove physical address from the GPL header comment
Gaius Mulley [Fri, 29 Nov 2024 18:34:33 +0000 (18:34 +0000)] 
[PATCH] PR modula2/116557 Remove physical address from the GPL header comment

This patch removes the physical address from all the header comments
in the m2 subdirectory.  The physical address is replaced with the
text "You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>." instead.

gcc/m2/ChangeLog:

PR modula2/116557
* gm2-lang.cc: Replace physical address with URL in GPL header.
* gm2-lang.h: Ditto.
* images/LICENSE.IMG: Ditto.
* m2-tree.def: Ditto.
* mc-boot/GIndexing.cc: Ditto.
* mc-boot/Gkeyc.cc: Ditto.
* mc-boot/Glists.cc: Ditto.
* mc-boot/GmcComp.cc: Ditto.
* mc-boot/GmcDebug.cc: Ditto.
* mc-boot/GmcFileName.cc: Ditto.
* mc-boot/GmcMetaError.cc: Ditto.
* mc-boot/GmcOptions.cc: Ditto.
* mc-boot/GmcPreprocess.cc: Ditto.
* mc-boot/GmcPretty.cc: Ditto.
* mc-boot/GmcPrintf.cc: Ditto.
* mc-boot/GmcQuiet.cc: Ditto.
* mc-boot/GmcReserved.cc: Ditto.
* mc-boot/GmcSearch.cc: Ditto.
* mc-boot/GmcStack.cc: Ditto.
* mc/Indexing.mod: Ditto.
* mc/keyc.mod: Ditto.
* mc/lists.mod: Ditto.
* mc/mcComp.mod: Ditto.
* mc/mcDebug.mod: Ditto.
* mc/mcFileName.mod: Ditto.
* mc/mcMetaError.mod: Ditto.
* mc/mcOptions.mod: Ditto.
* mc/mcPreprocess.mod: Ditto.
* mc/mcPretty.mod: Ditto.
* mc/mcPrintf.mod: Ditto.
* mc/mcQuiet.mod: Ditto.
* mc/mcReserved.mod: Ditto.
* mc/mcSearch.mod: Ditto.
* mc/mcStack.mod: Ditto.
* tools-src/buildpg: Ditto.
* tools-src/calcpath: Ditto.
* tools-src/checkmeta.py: Ditto.
* tools-src/def2doc.py: Ditto.
* tools-src/makeSystem: Ditto.
* tools-src/tidydates.py: Ditto.

(cherry picked from commit 78dc2e2575c602c62d50a9522ea976020a5bf7aa)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/116181: m2rts fix -Wodr warning
Gaius Mulley [Fri, 29 Nov 2024 16:36:14 +0000 (16:36 +0000)] 
[PATCH] PR modula2/116181: m2rts fix -Wodr warning

This patch fixes the -Wodr warning seen in pge-boot/m2rts.h
when building pge.

gcc/m2/ChangeLog:

PR modula2/116181
* pge-boot/GM2RTS.h: Regenerate.
* pge-boot/m2rts.h: Ditto.

(cherry picked from commit 87ce8172f0bf649a8a79ef7481fb3bf35882083f)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/116181 remove ODR warnings from library interface files
Gaius Mulley [Fri, 29 Nov 2024 15:30:44 +0000 (15:30 +0000)] 
[PATCH] PR modula2/116181 remove ODR warnings from library interface files

This patch removes the warnings generated by -Wodr from the library
interface between modula-2 and C.

gcc/m2/ChangeLog:

PR modula2/116181
* Make-lang.in (MC_SRC_FLAGS): New macro.
(m2/mc-boot/$(SRC_PREFIX)%.o): Use MC_SRC_FLAGS.
(m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto.
(m2/gm2-libs-boot/M2RTS.o): Ditto.
(m2/gm2-libs-boot/%.o): Ditto.
(GM2-LIBS-BOOT-H): New macro.
(m2/gm2-libs-boot/RTcodummy.o): Use MC_SRC_FLAGS.
Remove gm2-libs-host.h from the dependancy.
(m2/gm2-libs-boot/wrapc.o): Use MC_SRC_FLAGS.
Add dependancy GM2-LIBS-BOOT-H.
(m2/gm2-libs-boot/UnixArgs.o): Ditto.
(m2/gm2-libs-boot/choosetemp.o): Ditto.
(m2/gm2-libs-boot/errno.o): Ditto.
(m2/gm2-libs-boot/dtoa.o): Ditto.
(m2/gm2-libs-boot/ldtoa.o): Ditto.
(m2/gm2-libs-boot/termios.o): Ditto.
(m2/gm2-libs-boot/SysExceptions.o): Ditto.
(m2/gm2-compiler-boot/M2GCCDeclare.o): Add gm2-libs-ch to the
search path.
(m2/gm2-compiler-boot/M2Error.o): Ditto.
(m2/gm2-compiler-boot/%.o): Ditto.
(m2/pge-boot/%.o): Ditto.
* gm2-gcc/m2color.cc (m2color_colorize_start): Replace parameter
type char to void and recast to char * when calling colorize_start.
* gm2-gcc/m2color.h (m2color_colorize_start): Replace parameter
type char to void.
* gm2-gcc/m2type.h: Remove #if 0 block.
* gm2-libs-ch/SysExceptions.c (DECL_PROC_T): Provide alternative
defines for MC an gm2.
(PROC_FUNC): Ditto.
(EXTERN): Force undefine and redefine.
(SysExceptions_InitExceptionHandlers): Rewrite function
declaration using defined macros.
(_M2_SysExceptions_init): Use EXTERN.
(_M2_SysExceptions_finish): Replace with ...
(_M2_SysExceptions_fini): ... this and add parameters.
* gm2-libs-ch/UnixArgs.cc (gm2-libs-host.h): Include.
(GUnixArgs.h): Include.
(GM2RTS.h): Include.
(UnixArgs_GetArgV): Change return type to void *.
(UnixArgs_GetEnvV): Ditto.
* gm2-libs-ch/m2rts.h (M2RTS_RegisterModule_Cstr): Add new
conditional macro.
(M2RTS_RequestDependant): Remove.
(M2RTS_RegisterModule): Ditto.
(M2RTS_Terminate): Ditto.
(M2RTS_DeconstructModules): Ditto.
(M2RTS_Halt): Ditto.
(_M2_M2RTS_init): Ditto.
(M2RTS_ConstructModules): Ditto.
* gm2-libs-ch/termios.c (_termios_C): Define.
(EXTERN): Add conditional definition.
(doSetUnset): New function.
(_M2_termios_init): Add correct parameters.
(_M2_termios_finish): Ditto.
(_M2_termios_fini): Ditto.
* mc-boot-ch/GSysExceptions.c (DECL_PROC_T): New define.
(PROC_FUNC): Ditto.
(EXTERN): Force undef.
(SysExceptions_InitExceptionHandlers): Rewrite.
* mc-boot-ch/Glibc.c (libc_open): Rename parameter
oflag to flags.
* mc-boot-ch/Gtermios.cc (_termios_C): New define.
(KillTermios): Change parameter type from
struct termios * to termios_TERMIOS.
(tcsnow): Rewrite.
(tcsnow): Rewrite.
(tcsdrain): Rewrite.
(tcsflush): Rewrite.
(cfgetospeed): Rewrite.
(cfgetispeed): Rewrite.
(cfsetospeed): Rewrite.
(cfsetispeed): Rewrite.
(cfsetspeed): Rewrite.
(cfsetspeed): Rewrite.
(tcgetattr): Rewrite.
(tcsetattr): Rewrite.
(cfmakeraw): Rewrite.
(tcsendbreak): Rewrite.
(tcdrain): Rewrite.
(tcflushi): Rewrite.
(tcflusho): Rewrite.
(tcflushio): Rewrite.
(tcflowoni): Rewrite.
(tcflowoffi): Rewrite.
(tcflowono): Rewrite.
(tcflowoffo): Rewrite.
(GetFlag): Rewrite.
(SetFlag): Rewrite.
(GetChar): Rewrite.
(SetChar): Rewrite.
(InitTermios): Rewrite.
* pge-boot/GM2RTS.cc: Regenerate.
* pge-boot/GSysExceptions.cc: Ditto.
* pge-boot/Gtermios.cc: Ditto.
* pge-boot/m2rts.h: Rewrite.
* mc-boot-ch/GSYSTEM.h: New file.
* mc-boot-ch/GSysExceptions.h: New file.
* mc-boot-ch/Gtermios.h: New file.

(cherry picked from commit b8ef805e4d850971b9926fd81b4f0612ddffaf82)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agotree-optimization/117594 - fix live op vectorization for length masked case
Richard Biener [Mon, 18 Nov 2024 12:46:52 +0000 (13:46 +0100)] 
tree-optimization/117594 - fix live op vectorization for length masked case

The code was passing factor == 0 to vect_get_loop_len which always
returns an unmodified length, even if the number of scalar elements
doesn't agree.  It also failed to insert the eventually generated
code.

PR tree-optimization/117594
* tree-vect-loop.cc (vectorizable_live_operation_1): Pass
factor == 1 to vect_get_loop_len, insert generated stmts.

* gcc.dg/vect/pr117594.c: New testcase.

(cherry picked from commit c108785c425b2042f63fa975c58c274d19a8d160)

8 months agotree-optimization/117574 - bougs niter lt-to-ne
Richard Biener [Fri, 15 Nov 2024 10:56:14 +0000 (11:56 +0100)] 
tree-optimization/117574 - bougs niter lt-to-ne

When trying to change a IV from IV0 < IV1 to IV0' != IV1' we apply
fancy adjustments to the may_be_zero condition we compute rather
than using the obvious IV0->base >= IV1->base expression (to be
able to use > instead of >=?).  This doesn't seem to go well.

PR tree-optimization/117574
* tree-ssa-loop-niter.cc (number_of_iterations_lt_to_ne):
Use the obvious may_be_zero condition.

* gcc.dg/torture/pr117574-1.c: New testcase.

(cherry picked from commit ff5a14abeb31cd6bd0ca55e7043d05c8141a8c7f)

8 months agomiddle-end/117433 - ICE with gimple BLKmode reg copy
Richard Biener [Mon, 4 Nov 2024 10:39:05 +0000 (11:39 +0100)] 
middle-end/117433 - ICE with gimple BLKmode reg copy

When we end up expanding a SSA name copy with BLKmode regs which can
happen for vectors, possibly wrapped in a NOP-conversion or
a PAREN_EXPR and we are not optimizing we can end up with two
BLKmode MEMs that expand_gimple_stmt_1 doesn't properly handle
when expanding, trying to emit_move_insn them.  Looking at store_expr
which what expand_gimple_stmt_1 is really doing reveals a lot of
magic that's missing.  It eventually falls back to emit_block_move
(store_expr isn't exported), so this is what I ended up using here
given I think we'll only have BLKmode "registers" for vectors.

PR middle-end/117433
* cfgexpand.cc (expand_gimple_stmt_1): Use emit_block_move
when moving temp to BLKmode target.

* gcc.dg/pr117433.c: New testcase.

(cherry picked from commit 2fc25a21820001c67258d30f0960ac9cd0f268cf)

8 months agotree-optimization/117417 - ICE with complex load optimization
Richard Biener [Tue, 12 Nov 2024 10:15:15 +0000 (11:15 +0100)] 
tree-optimization/117417 - ICE with complex load optimization

When we decompose a complex load only used as real and imaginary
parts we fail to honor IL constraints which are that a BIT_FIELD_REF
of register type should be outermost in a ref.  The following
simply avoids the transform when the complex load has such a
BIT_FIELD_REF.

PR tree-optimization/117417
* tree-ssa-forwprop.cc (pass_forwprop::execute): Avoid
decomposing BIT_FIELD_REF complex load.

* gcc.dg/torture/pr117417.c: New testcase.

(cherry picked from commit d976daa931642d940b7b27032ca6139210c07eed)

8 months agotree-optimization/117333 - ICE with NULL access size DR
Richard Biener [Tue, 29 Oct 2024 08:42:12 +0000 (09:42 +0100)] 
tree-optimization/117333 - ICE with NULL access size DR

dr_may_alias_p ICEs when TYPE_SIZE of DR->ref is NULL but this is
valid IL when the access size of an aggregate copy can be infered
from the RHS.

PR tree-optimization/117333
* tree-data-ref.cc (dr_may_alias_p): Guard against NULL
access size.

* gcc.dg/torture/pr117333.c: New testcase.

(cherry picked from commit 0e99b22aa666f107c4035d32bfb5ab11534a9d2f)

8 months agotree-optimization/117307 - STMT_VINFO_SLP_VECT_ONLY mis-computation
Richard Biener [Mon, 28 Oct 2024 08:52:08 +0000 (09:52 +0100)] 
tree-optimization/117307 - STMT_VINFO_SLP_VECT_ONLY mis-computation

STMT_VINFO_SLP_VECT_ONLY isn't properly computed as union of all
group members and when the group is later split due to duplicates
not all sub-groups inherit the flag.

PR tree-optimization/117307
* tree-vect-data-refs.cc (vect_analyze_data_ref_accesses):
Properly compute STMT_VINFO_SLP_VECT_ONLY.  Set it on all
parts of a split group.

* gcc.dg/vect/pr117307.c: New testcase.

(cherry picked from commit 19722308a286d9a00eead8ac82b948da8c4ca38b)

8 months agotree-optimization/117254 - ICE with access diangostics
Richard Biener [Tue, 22 Oct 2024 09:46:47 +0000 (11:46 +0200)] 
tree-optimization/117254 - ICE with access diangostics

The diagnostics code fails to handle non-constant domain max.

PR tree-optimization/117254
* gimple-ssa-warn-access.cc (maybe_warn_nonstring_arg):
Check the array domain max is constant before using it.

* gcc.dg/pr117254.c: New testcase.

(cherry picked from commit d464a52d0678dfea523a60efe8b792ba1b8d40db)

8 months agoDaily bump.
GCC Administrator [Fri, 29 Nov 2024 00:25:26 +0000 (00:25 +0000)] 
Daily bump.

8 months agotree-sra: Avoid SRAing arguments to a function returning_twice (PR 117142)
Martin Jambor [Wed, 23 Oct 2024 09:30:32 +0000 (11:30 +0200)] 
tree-sra: Avoid SRAing arguments to a function returning_twice (PR 117142)

PR 117142 shows that the current SRA probably never worked reliably
with arguments passed to a function returning twice, because it then
creates statements before the call which however needs to be at the
beginning of a basic block.

While it should be possible to make at least the case of passing
arguments by value work with SRA (the statements would need to be put
just on the non-abnormal edges leading to the BB), this would mean
large surgery of function sra_modify_expr and I guess the time would
better be spent re-organizing the whole pass.

gcc/ChangeLog:

2024-10-21  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/117142
* tree-sra.cc (build_access_from_call_arg): Disqualify any
candidate passed to a function returning twice.

gcc/testsuite/ChangeLog:

2024-10-21  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/117142
* gcc.dg/tree-ssa/pr117142.c: New test.

(cherry picked from commit 29d8f1f0b7ad3c69b3bdb130325300d5f73aa784)

8 months ago[PR117105][LRA]: Use unique value reload pseudo for early clobber operand
Vladimir N. Makarov [Mon, 25 Nov 2024 21:09:00 +0000 (16:09 -0500)] 
[PR117105][LRA]: Use unique value reload pseudo for early clobber operand

LRA did not generate insn satisfying insn constraints on the PR
test.  The reason for this is that LRA assigned the same hard reg for
two conflicting reload pseudos.  The two insn reload pseudos are
originated from the same pseudo and LRA tried to optimize as it
assigned the same value for the reload pseudos.  It is an LRA
optimization to minimize reload insns.  The two reload pseudos
conflict as one of them is an early clobber insn operands.  The patch
solves this problem by assigning unique value if the operand is early
clobber one.

gcc/ChangeLog:

PR target/117105
* lra-constraints.cc (get_reload_reg): Create unique value reload
pseudos for early clobbered operands.

gcc/testsuite/ChangeLog:

PR target/117105
* gcc.target/i386/pr117105.c: New test.

(cherry picked from commit 4b09e2c67ef593db171b0755b46378964421782b)

8 months ago[PR114942][LRA]: Don't reuse input reload reg of inout early clobber operand
Vladimir N. Makarov [Fri, 10 May 2024 13:15:50 +0000 (09:15 -0400)] 
[PR114942][LRA]: Don't reuse input reload reg of inout early clobber operand

  The insn in question has the same reg in inout operand and input
operand.  The inout operand is early clobber.  LRA reused input reload
reg of the inout operand for the input operand which is wrong.  It
were a good decision if the inout operand was not early clobber one.
The patch rejects the reuse for the PR test case.

gcc/ChangeLog:

PR target/114942
* lra-constraints.cc (struct input_reload): Add new member early_clobber_p.
(get_reload_reg): Add new arg early_clobber_p, don't reuse input
reload with true early_clobber_p member value, use the arg for new
element of curr_insn_input_reloads.
(match_reload): Assign false to early_clobber_p member.
(process_addr_reg, simplify_operand_subreg, curr_insn_transform):
Adjust get_reload_reg calls.

gcc/testsuite/ChangeLog:

PR target/114942
* gcc.target/i386/pr114942.c: New.

(cherry picked from commit 9585317f0715699197b1313bbf939c6ea3c1ace6)

8 months agoDaily bump.
GCC Administrator [Thu, 28 Nov 2024 00:25:21 +0000 (00:25 +0000)] 
Daily bump.

8 months agoFortran: Partial reversion of r15-5083 [PR117763]
Paul Thomas [Tue, 26 Nov 2024 08:58:21 +0000 (08:58 +0000)] 
Fortran: Partial reversion of r15-5083 [PR117763]

2024-11-26  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/117763
* trans-array.cc (gfc_get_array_span): Guard against derefences
of 'expr'. Clean up some typos. Use 'gfc_get_vptr_from_expr'
for clarity and apply a functional reversion of last section
that deals with class dummies.

gcc/testsuite/
PR fortran/117763
* gfortran.dg/pr117763.f90: New test.

(cherry picked from commit 8278d9551df610179fca114808a7e6e62bab3d82)

8 months agoDaily bump.
GCC Administrator [Wed, 27 Nov 2024 00:25:01 +0000 (00:25 +0000)] 
Daily bump.

8 months agognat: fix lto-type-mismatch between C_Version_String and gnat_version_string [PR115917]
Arsen Arsenović [Thu, 15 Aug 2024 17:17:41 +0000 (19:17 +0200)] 
gnat: fix lto-type-mismatch between C_Version_String and gnat_version_string [PR115917]

gcc/ada/ChangeLog:

PR ada/115917
* gnatvsn.ads: Add note about the duplication of this value in
version.c.
* version.c (VER_LEN_MAX): Define to the same value as
Gnatvsn.Ver_Len_Max.
(gnat_version_string): Use VER_LEN_MAX as bound.

(cherry picked from commit 9cbcf8d1de159e6113fafb5dc2feb4a7e467a302)

8 months ago[PATCH] modula2: change identifier names to avoid build warnings
Gaius Mulley [Tue, 26 Nov 2024 16:05:03 +0000 (16:05 +0000)] 
[PATCH] modula2: change identifier names to avoid build warnings

This fix avoids the following warnings: In implementation module
‘StdChans’: either the identifier has the same name as a keyword or
alternatively a keyword has the wrong case (‘IN’ and ‘in’)
   54 |    stdnull: ChanId ;

the symbol name ‘in’ is legal as an identifier, however as such it
might cause confusion and is considered bad programming practice.

gcc/m2/ChangeLog:

* gm2-libs-iso/StdChans.mod (in): Rename to ...
(inch): ... this.
(out): Rename to ...
(outch): ... this.
(err): Rename to ...
(errch): ... this.

(cherry picked from commit b584f387bf74df9ba2cbbc07d00a05a105757329)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/116378 m2 bootstrap fails on x86_64-darwin
Gaius Mulley [Tue, 26 Nov 2024 15:56:48 +0000 (15:56 +0000)] 
[PATCH] PR modula2/116378 m2 bootstrap fails on x86_64-darwin

This patch fixes m2 bootstrap failure on x86_64-darwin.  libc_open
is defined with three parameters the last of which is an int for
portability (rather than a vararg).  This avoids portability
problems by promoting mode_t to an int.  In the future it could
be tidied up by using the m2 optarg extension.

gcc/m2/ChangeLog:

PR modula2/116378
* gm2-libs-iso/TermFile.mod (termOpen): Add third argument
for open.
* gm2-libs/libc.def (open): Remove vararg and use INTEGER for
mode parameter three.
* mc-boot-ch/Glibc.c (tracedb_open): Replace mode_t with int.
(libc_open): Rewrite without varargs.
* mc-boot/Glibc.h (libc_open): Replace varargs with int mode.
* pge-boot/Glibc.cc (libc_open): Rewrite.
* pge-boot/Glibc.h (libc_open): Replace varargs with int mode.

gcc/testsuite/ChangeLog:

PR modula2/116378
* gm2/extensions/run/pass/testopen.mod: Add third argument
for open.
* gm2/isolib/run/pass/openlibc.mod: Ditto.
* gm2/pim/run/pass/testaddr3.mod: Ditto.

(cherry picked from commit 9cdde72d1cefdf2ffff52ad2eec1ff465dccb3ab)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/116181 fix ODR warnings for C/m2 interface library modules
Gaius Mulley [Tue, 26 Nov 2024 15:52:55 +0000 (15:52 +0000)] 
[PATCH] PR modula2/116181 fix ODR warnings for C/m2 interface library modules

This patch fixes many ODR warnings which appear when compiling the
interface files found in gcc/m2/*-ch/ and gcc/m2/{pge,mc}-boot
directories.

gcc/m2/ChangeLog:

PR modula2/116181
* gm2-compiler/ppg.mod (FindStr): Initialize j.
* gm2-libs-ch/UnixArgs.cc (_M2_UnixArgs_ctor): Replace
M2RTS_RegisterModule with M2RTS_RegisterModule_Cstr.
* gm2-libs-ch/dtoa.cc (_M2_dtoa_ctor): Ditto.
* gm2-libs-ch/ldtoa.cc (ldtoa_strtold): Cast parameter s
for strtod.
(_M2_ldtoa_ctor): Replace M2RTS_RegisterModule with
M2RTS_RegisterModule_Cstr.
* gm2-libs-ch/m2rts.h (M2RTS_RegisterModule_Cstr): New
define.
(M2RTS_RegisterModule): Remove const.
* mc-boot-ch/GSelective.c (Selective_FdIsSet): Return bool
rather than int.
* mc-boot-ch/Gldtoa.cc (ldtoa_strtold): Change const char to
void.
Cast s before passing as a parameter to strtod.
* mc-boot-ch/Glibc.c (tracedb_open): Replace const char with const
void.
(libc_perror): Replace char with const char.
(libc_printf): Replace char with void.
(libc_snprintf): Replace char with void.
Add const_cast for parameter to index.
Add reinterpret_cast for parameter to vsnprintf.
(libc_open): Replace first paramter type char with void.
Add vararg for the third parameter.
* mc-boot-ch/Gm2rtsdummy.cc (M2RTS_RequestDependant): Remove #if 0 code.
(m2pim_M2RTS_RegisterModule): Change const char parameters to void
(M2RTS_RegisterModule): Ditto.
(_M2_M2RTS_init): Remove #if 0 code.
(M2RTS_ConstructModules): Ditto.
(M2RTS_Terminate): Ditto.
(M2RTS_DeconstructModules): Ditto.
(M2RTS_Halt): Ditto.
* mc-boot-ch/Gtermios.cc (SetFlag): Return bool.
* mc-boot-ch/m2rts.h (M2RTS_RegisterModule_Cstr): New define.
(M2RTS_RegisterModule): Change const char parameters to void.
* mc-boot/Gdecl.cc: Regenerate.
* mc/decl.mod (getNextConstExp): Reimplement.
* pge-boot/GDynamicStrings.cc: Regenerate.
* pge-boot/GDynamicStrings.h: Ditto.
* pge-boot/GM2RTS.h (M2RTS_RegisterModule_Cstr): New function.
(M2RTS_RegisterModule): Reformat.
* pge-boot/GSymbolKey.cc: Regenerate.
* pge-boot/GSysExceptions.cc (_M2_SysExceptions_init): Add correct parameters.
(_M2_SysExceptions_fini): Ditto.
* pge-boot/GUnixArgs.cc (_M2_UnixArgs_ctor::_M2_UnixArgs_ctor):
Replace call to M2RTS_RegisterModule with M2RTS_RegisterModuleCstr.
* pge-boot/Gerrno.cc (_M2_errno_init): Add correct parameters.
(_M2_errno_fini): Ditto.
* pge-boot/Gldtoa.cc (ldtoa_strtold): Replace const char with
void.
Use reinterpret_cast when passing s to strtod.
Replace true with TRUE.
* pge-boot/Gldtoa.h (ldtoa_strtold): Tidy up.
* pge-boot/Glibc.cc (libc_read): Use size_t as the return type.
(libc_write): Ditto.
(libc_strlen): Ditto.
(libc_perror): Replace char with const char.
(libc_printf): Replace char to const char.
Cast parameter to index using const_cast.
(libc_snprintf): Replace char with void.
Cast parameter to index using const_cast.
(libc_malloc): Replace parameter type with size_t.
(libc_memcpy): Replace third parameter type with size_t.
(libc_open): Use varargs.
* pge-boot/Glibc.h (libc_perror): Add _string_high parameter.
* pge-boot/Gpge.cc: Regenerate.
* pge-boot/Gtermios.cc (SetFlag): Replace return type with bool.
(_M2_termios_init): Add correct parameters.
(_M2_termios_fini): Ditto.
* pge-boot/m2rts.h (M2RTS_RegisterModule_Cstr): New define.
(M2RTS_RegisterModule): Replace const char with void.

(cherry picked from commit 9f3b5c2314239e1d3b6e1722e676ea1935bc2836)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agotestsuite: arm: Use correct the expected asm in epilog-1.c test
Torbjörn SVENSSON [Tue, 26 Nov 2024 09:31:49 +0000 (10:31 +0100)] 
testsuite: arm: Use correct the expected asm in epilog-1.c test

In r14.2.0-376-g724446556e5, I accidentally introduced a regression in
the expected assembler as the csinc instruction was not used for
armv8.1-m.main.

The generated assembler for armv8.1-m.main is:
        push    {r3, r4, r5, lr}
        ldr     r4, .L5
        ldr     r5, [r4]
        adds    r4, r2, #1
        tst     r5, #4
        it      ne
        movne   r2, r4
        bl      bar
        movs    r0, #0
        pop     {r3, r4, r5, pc}

gcc/testsuite/ChangeLog:

* gcc.target/arm/epilog-1.c: Corrected armv8.1.m-main asm.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
8 months ago[PATCH] PR modula2/115823 Wrong expansion of isnormal optab
Gaius Mulley [Tue, 26 Nov 2024 13:18:27 +0000 (13:18 +0000)] 
[PATCH] PR modula2/115823 Wrong expansion of isnormal optab

This patch corrects the function declaration of a builtin
(using the libname rather than the source name).

gcc/m2/ChangeLog:

PR modula2/115823
* gm2-gcc/m2builtins.cc (define_builtin): Build
the function decl using the libname.

gcc/testsuite/ChangeLog:

PR modula2/115823
* gm2/builtins/run/pass/testisnormal.mod: Change to an
implementation module.
* gm2/builtins/run/pass/testisnormal.def: New test.
* gm2/builtins/run/pass/testsinl.def: New test.
* gm2/builtins/run/pass/testsinl.mod: New test.

(cherry picked from commit 79e029a41825f533bb87b4bee5427b90b62175ae)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Improve error message to include symbol name.
Gaius Mulley [Tue, 26 Nov 2024 13:15:56 +0000 (13:15 +0000)] 
[PATCH] modula2: Improve error message to include symbol name.

gcc/m2/ChangeLog:

* gm2-compiler/M2StateCheck.mod (GenerateError): Add
symbol name to the error message.

(cherry picked from commit 6a99f3ae962542165fdfc077f1040ea4d936691b)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Add GNU flex as a build and install prerequisite.
Gaius Mulley [Tue, 26 Nov 2024 13:11:31 +0000 (13:11 +0000)] 
[PATCH] modula2: Add GNU flex as a build and install prerequisite.

gcc/ChangeLog:

* doc/install.texi (GM2-prerequisite): Add GNU flex.

(cherry picked from commit 52f3473e375b1bb57d08c97291a82c04070036c3)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/116048 ICE when encountering wrong kind of qualident
Gaius Mulley [Tue, 26 Nov 2024 13:04:05 +0000 (13:04 +0000)] 
[PATCH] PR modula2/116048 ICE when encountering wrong kind of qualident

Following on from PR-115957 further ICEs can be generated by using the
wrong kind of qualident symbol.  For example using a variable instead of
a type or using a type instead of a const.  This fix tracks the expected
qualident kind state when parsing const, type and variable declarations.
If the error is unrecoverable then a detailed message explaining the
context of the qualident (and why the seen qualident is wrong) is
generated.

gcc/m2/ChangeLog:

PR modula2/116048
* Make-lang.in (GM2-COMP-BOOT-DEFS): Add M2StateCheck.def.
(GM2-COMP-BOOT-MODS): Add M2StateCheck.mod.
(GM2-COMP-DEFS): Add M2StateCheck.def.
(GM2-COMP-MODS): Add M2StateCheck.mod.
* gm2-compiler/M2Quads.mod (StartBuildWith): Generate
unrecoverable error is the qualident type is NulSym.
Replace MetaError1 with MetaErrorT1 and position the error
to the qualident.
* gm2-compiler/P3Build.bnf (M2StateCheck): Import procedures.
(seenError): New variable.
(WasNoError): Remove variable.
(BlockState): New variable.
(ErrorString): Rewrite using seenError.
(CompilationUnit): Ditto.
(QualidentCheck): New rule.
(ConstantDeclaration): Bookend with InclConst and ExclConst.
(Constructor): Add InclConstructor, ExclConstructor and call
CheckQualident.
(ConstActualParameters): Call PushState, PopState, InclConstFunc
and CheckQualident.
(TypeDeclaration): Bookend with InclType and ExclType.
(SimpleType): Call QualidentCheck.
(CaseTag): Ditto.
(OptReturnType): Ditto.
(VariableDeclaration): Bookend with InclVar and ExclVar.
(Designator): Call QualidentCheck.
(Formal;Type): Ditto.
* gm2-compiler/PCBuild.bnf (M2StateCheck): Import procedures.
(ConstantDeclaration): Rewrite using InclConst and ExclConst.
(Constructor): Bookend with InclConstructor and ExclConstructor.
Call CheckQualident.
(ConstructorOrConstActualParameters): Rewrite and cal
l CheckQualident.
(ConstActualParameters): Bookend with PushState PopState.
Call InclConstFunc and CheckQualident.
* gm2-gcc/init.cc (_M2_M2StateCheck_init): New declaration.
(_M2_P3Build_init): New declaration.
(init_PerCompilationInit): Call _M2_M2StateCheck_init and
_M2_P3Build_init.
* gm2-compiler/M2StateCheck.def: New file.
* gm2-compiler/M2StateCheck.mod: New file.

gcc/testsuite/ChangeLog:

PR modula2/116048
* gm2/errors/fail/errors-fail.exp: Remove -Wstudents
and add -Wuninit-variable-checking=all.
Replace gm2_init_pim with gm2_init_iso.
* gm2/errors/fail/testfio.mod: Modify test code to
provoke an error in the first basic block.
* gm2/errors/fail/testparam.mod: Ditto.
* gm2/errors/fail/array1.mod: Ditto.
* gm2/errors/fail/badtype.mod: New test.
* gm2/errors/fail/badvar.mod: New test.

(cherry picked from commit 7f8064ff0e2ac90c5bb6c30cc61acc5a28ebbe4c)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/115957 ICE on procedure local const declaration
Gaius Mulley [Tue, 26 Nov 2024 12:57:12 +0000 (12:57 +0000)] 
[PATCH] PR modula2/115957 ICE on procedure local const declaration

An ICE would occur if a constant was declared using a variable term.
This fix catches variable terms in constant expressions and generates
an unrecoverable error.

gcc/m2/ChangeLog:

PR modula2/115957
* gm2-compiler/M2StackAddress.mod (PopAddress): Detect tail=NIL
and generate an internal error.
* gm2-compiler/PCBuild.bnf (InConstParameter): New variable.
(InConstBlock): New variable.
(ErrorString): Rewrite using MetaErrorStringT0.
(ErrorArrayAt): Rewrite using MetaErrorStringT0.
(WarnMissingToken): Use MetaErrorStringT0.
(CompilationUnit): Set seenError FALSE.
(init): Initialize InConstParameter and InConstBlock.
(ConstantDeclaration): Set InConstBlock.
(ConstSetOrQualidentOrFunction): Call CheckNotVar if not
InConstParameter and InConstBlock.
(ConstActualParameters): Set InConstParameter TRUE and restore
value at the end.
* gm2-compiler/PCSymBuild.def (CheckNotVar): New procedure.
Remove all unnecessary export qualified list.
* gm2-compiler/PCSymBuild.mod (CheckNotVar): New procedure.

gcc/testsuite/ChangeLog:

PR modula2/115957
* gm2/errors/fail/badconst.mod: New test.
* gm2/pim/fail/tinyadr.mod: New test.

(cherry picked from commit d9709fafb2c498ba2f4c920f953c9b78fa3bf114)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Tue, 26 Nov 2024 00:24:56 +0000 (00:24 +0000)] 
Daily bump.

8 months agolibcpp: Fix ICE lexing invalid raw string in a deferred pragma [PR117118]
Lewis Hyatt [Mon, 14 Oct 2024 21:59:46 +0000 (17:59 -0400)] 
libcpp: Fix ICE lexing invalid raw string in a deferred pragma [PR117118]

The PR shows that we ICE after lexing an invalid unterminated raw string,
because lex_raw_string() pops the main buffer unexpectedly. Resolve by
handling this case the same way as for other directives.

libcpp/ChangeLog:
PR preprocessor/117118
* lex.cc (lex_raw_string): Treat an unterminated raw string the same
way for a deferred pragma as is done for other directives.

gcc/testsuite/ChangeLog:
PR preprocessor/117118
* c-c++-common/raw-string-directive-3.c: New test.
* c-c++-common/raw-string-directive-4.c: New test.

8 months agoFix uninitialized operands[2] in vec_unpacks_hi_v4sf.
liuhongt [Fri, 22 Nov 2024 07:57:38 +0000 (23:57 -0800)] 
Fix uninitialized operands[2] in vec_unpacks_hi_v4sf.

It could cause weired spill in RA when register pressure is high.

gcc/ChangeLog:

PR target/117562
* config/i386/sse.md (vec_unpacks_hi_v4sf): Initialize
operands[2] with CONST0_RTX.

(cherry picked from commit ba4cf2e296d8d5950c3d356fa6b6efcad00d0189)

8 months agoDaily bump.
GCC Administrator [Mon, 25 Nov 2024 00:23:17 +0000 (00:23 +0000)] 
Daily bump.

8 months agoFortran: Fix segfault in allocation of unlimited poly array [PR84869]
Paul Thomas [Sun, 24 Nov 2024 14:22:06 +0000 (14:22 +0000)] 
Fortran: Fix segfault in allocation of unlimited poly array [PR84869]

2024-11-24  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran/ChangeLog

PR fortran/84869
* trans-expr.cc (trans_class_vptr_len_assignment): To access
the '_len' field, 're' must be unlimited polymorphic.

gcc/testsuite/
PR fortran/84869
* gfortran.dg/pr84869.f90: Comment out test of component refs.

8 months agoDaily bump.
GCC Administrator [Sun, 24 Nov 2024 00:24:53 +0000 (00:24 +0000)] 
Daily bump.

8 months agoFortran: Suppress invalid finalization of artificial variable [PR116388]
Paul Thomas [Mon, 11 Nov 2024 09:01:11 +0000 (09:01 +0000)] 
Fortran: Suppress invalid finalization of artificial variable [PR116388]

2024-11-11  Tomas Trnka  <trnka@scm.com>
    Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/116388
* class.cc (finalize_component): Leading underscore in the name
of 'byte_stride' to suppress invalid finalization.

gcc/testsuite/
PR fortran/116388
* gfortran.dg/finalize_58.f90: New test.

(cherry picked from commit 42a2df0b7985b2a4732ba1c29726ac7aabd5eeae)

8 months agoFortran: Fix elemental array refs in SELECT TYPE [PR109345]
Paul Thomas [Mon, 11 Nov 2024 12:21:57 +0000 (12:21 +0000)] 
Fortran: Fix elemental array refs in SELECT TYPE [PR109345]

2024-11-10  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/109345
* trans-array.cc (gfc_get_array_span): Unlimited polymorphic
expressions are now treated separately since the span need not
be the same as the element size.

gcc/testsuite/
PR fortran/109345
* gfortran.dg/character_workout_1.f90: Cut trailing whitespace.
* gfortran.dg/pr109345.f90: New test.

(cherry picked from commit e22d80d4f0f8d33f538c1a4bad07b2c819a6d55c)

8 months ago[PATCH] modula2: bootstrap fix for string and vector headers.
Gaius Mulley [Sat, 23 Nov 2024 15:27:45 +0000 (15:27 +0000)] 
[PATCH] modula2: bootstrap fix for string and vector headers.

This patch fixes the include of headers (<string> and <vector>) which
are included after GCC's system.h has been included.  It defines
INCLUDE_STRING before including "system.h".  This allows gcc to
bootstrap with Apple clang 15.

gcc/m2/ChangeLog:

* gm2-gcc/m2linemap.cc (INCLUDE_STRING): Define before
include of gcc-consolidation.h.
* gm2spec.cc (INCLUDE_STRING): Define before include of
system.h.
(INCLUDE_VECTOR): Ditto.

(cherry picked from commit f4047a8614d2215e0d6acf071c521ac08ab1bbb2)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/115823 Wrong expansion of isnormal optab
Gaius Mulley [Sat, 23 Nov 2024 14:27:06 +0000 (14:27 +0000)] 
[PATCH] PR modula2/115823 Wrong expansion of isnormal optab

The bug fix changes gcc/m2/gm2-gcc/m2builtins.c:m2builtins_BuiltinExists
to recognise both __builtin_<functionname> and functionname as a builtin.

gcc/m2/ChangeLog:

PR modula2/115823
* gm2-gcc/m2builtins.cc (struct builtin_macro_definition): New
field builtinname.
(builtin_function_match): New function.
(builtin_macro_match): Ditto.
(m2builtins_BuiltinExists): Use builtin_function_match and
builtin_macro_match.
(lookup_builtin_macro): Use builtin_macro_match.
(lookup_builtin_function): Use builtin_function_match.
(define_builtin): Assign builtinname field.

gcc/testsuite/ChangeLog:

PR modula2/115823
* gm2/builtins/run/pass/testalloa.mod: New test.

(cherry picked from commit 2d1f68e7965795dc66db83bc7840ba7a23eeb01b)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/115804 ICE during gimplification with new isfinite optab
Gaius Mulley [Sat, 23 Nov 2024 13:16:15 +0000 (13:16 +0000)] 
[PATCH] PR modula2/115804 ICE during gimplification with new isfinite optab

The calls to five m2 builtins have the incorrect return type.
This was detected when adding isfinitedf2 optab to the s390
backend which results in ICEs during gimplification in the
gm2 testsuite.

gcc/m2/ChangeLog:

PR modula2/115804
* gm2-gcc/m2builtins.cc (builtin_function_entry): Add GTY.
(DoBuiltinMemCopy): Add rettype and use rettype in the call.
(DoBuiltinAlloca): Ditto.
(DoBuiltinIsfinite): Ditto.
(DoBuiltinIsnan): Ditto.
(m2builtins_BuiltInHugeVal): Ditto.
(m2builtins_BuiltInHugeValShort): Ditto.
(m2builtins_BuiltInHugeValLong): Ditto.

Co-Authored-By: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Co-Authored-By: Andrew Pinski <quic_apinski@quicinc.com>
(cherry picked from commit 4594d555aa551a9998fc921363c5f6ea50630d5c)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoAVR: target/117744 - Fix asm for partial clobber of address reg,
Georg-Johann Lay [Sat, 23 Nov 2024 11:51:32 +0000 (12:51 +0100)] 
AVR: target/117744 - Fix asm for partial clobber of address reg,

gcc/
PR target/117744
* config/avr/avr.cc (out_movqi_r_mr): Fix code when a load
only partially clobbers an address register due to
changing the address register temporally to accommodate for
faked addressing modes.

(cherry picked from commit ee8e6784876aa050d2e01f54d1da4acf758b635a)

8 months agoDaily bump.
GCC Administrator [Sat, 23 Nov 2024 00:27:49 +0000 (00:27 +0000)] 
Daily bump.

8 months ago[PATCH] modula2: tidyup remove unused procedures and unused parameters
Gaius Mulley [Fri, 22 Nov 2024 21:09:10 +0000 (21:09 +0000)] 
[PATCH] modula2: tidyup remove unused procedures and unused parameters

This patch removes M2GenGCC.mod:QuadCondition and
M2Quads.mod:GenQuadOTypeUniquetok.  It also removes unused parameter
WalkAction for all FoldIf procedures.

gcc/m2/ChangeLog:

* gm2-compiler/M2GenGCC.mod (QuadCondition): Remove.
(FoldIfEqu): Remove WalkAction parameter.
(FoldIfNotEqu): Ditto.
(FoldIfGreEqu): Ditto.
(FoldIfLessEqu): Ditto.
(FoldIfGre): Ditto.
(FoldIfLess): Ditto.
(FoldIfIn): Ditto.
(FoldIfNotIn): Ditto.
* gm2-compiler/M2Quads.mod (GenQuadOTypeUniquetok): Remove.

(cherry picked from commit 038144534a683d4248c9b98a7110a59b305f124a)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/115540 gcc/m2/mc-boot-ch/Gtermios.cc error return-statement with...
Gaius Mulley [Fri, 22 Nov 2024 19:46:44 +0000 (19:46 +0000)] 
[PATCH] PR modula2/115540 gcc/m2/mc-boot-ch/Gtermios.cc error return-statement with a value

This patch fixes three occurrences of cfmakeraw use in the hand built
m2 support libraries which incorrectly attempt to return a void
result.

gcc/m2/ChangeLog:

PR modula2/115540
* gm2-libs-ch/termios.c (cfmakeraw): Remove return.
* mc-boot-ch/Gtermios.cc (cfmakeraw): Remove return.
* pge-boot/Gtermios.cc (cfmakeraw): Remove return.

(cherry picked from commit d16355c72c7f7b54ecf06371d14d7ad309ea4c34)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/115536 Expression is evaluated incorrectly when encountering relop...
Gaius Mulley [Fri, 22 Nov 2024 18:38:51 +0000 (18:38 +0000)] 
[PATCH] PR modula2/115536 Expression is evaluated incorrectly when encountering relops and indirection

This fix ensures that we only call BuildRelOpFromBoolean if we are
inside a constant expression (where no indirection can be used).
The fix creates a temporary variable when a boolean is created from
a relop in other cases.
The previous pattern implementation would not work if the operands required
dereferencing during non const expressions.  Comparison of relop results
in a constant expression are resolved by constant propagation, basic
block analysis and dead code removal.  After the quadruples have been
optimized only one assignment to the boolean variable will remain for
const expressions.  All quadruple pattern checking for boolean
expressions is removed by the patch.  Thus the implementation becomes
more generic.

gcc/m2/ChangeLog:

PR modula2/115536
* gm2-compiler/M2BasicBlock.def (GetBasicBlockScope): New procedure.
(GetBasicBlockStart): Ditto.
(GetBasicBlockEnd): Ditto.
(IsBasicBlockFirst): New procedure function.
* gm2-compiler/M2BasicBlock.mod (ConvertQuads2BasicBlock): Allow
conditional boolean quads to be removed.
(GetBasicBlockScope): Implement new procedure.
(GetBasicBlockStart): Ditto.
(GetBasicBlockEnd): Ditto.
(IsBasicBlockFirst): Implement new procedure function.
* gm2-compiler/M2GCCDeclare.def (FoldConstants): New parameter
declaration.
* gm2-compiler/M2GCCDeclare.mod (FoldConstants): New parameter
declaration.
(DeclareTypesConstantsProceduresInRange): Recreate basic blocks
after resolving constant expressions.
(CodeBecomes): Guard IsVariableSSA with IsVar.
* gm2-compiler/M2GenGCC.def (ResolveConstantExpressions): New
parameter declaration.
* gm2-compiler/M2GenGCC.mod (FoldIfLess): Remove relop pattern
detection.
(FoldIfGre): Ditto.
(FoldIfLessEqu): Ditto.
(FoldIfGreEqu): Ditto.
(FoldIfIn): Ditto.
(FoldIfNotIn): Ditto.
(FoldIfEqu): Ditto.
(FoldIfNotEqu): Ditto.
(FoldBecomes): Add BasicBlock parameter and allow conditional
boolean becomes to be folded in the first basic block.
(ResolveConstantExpressions): Reimplement.
* gm2-compiler/M2Quads.def (IsConstQuad): New procedure function.
(IsConditionalBooleanQuad): Ditto.
* gm2-compiler/M2Quads.mod (IsConstQuad): Implement new procedure function.
(IsConditionalBooleanQuad): Ditto.
(MoveWithMode): Use GenQuadOTypetok.
(IsInitialisingConst): Rewrite using OpUsesOp1.
(OpUsesOp1): New procedure function.
(doBuildAssignment): Mark des as a VarConditional.
(ConvertBooleanToVariable): Call PutVarConditional.
(DumpQuadSummary): New procedure.
(BuildRelOpFromBoolean): Updated debugging and improved comments.
(BuildRelOp): Only call BuildRelOpFromBoolean if we are in a const
expression and both operands are boolean relops.
(GenQuadOTypeUniquetok): New procedure.
(BackPatch): Correct comment.
* gm2-compiler/SymbolTable.def (PutVarConditional): New procedure.
(IsVarConditional): New procedure function.
* gm2-compiler/SymbolTable.mod (PutVarConditional): Implement new
procedure.
(IsVarConditional): Implement new procedure function.
(SymConstVar): New field IsConditional.
(SymVar): New field IsConditional.
(MakeVar): Initialize IsConditional field.
(MakeConstVar): Initialize IsConditional field.
* gm2-compiler/M2Swig.mod (DoBasicBlock): Change parameters to
use BasicBlock.
* gm2-compiler/M2Code.mod (SecondDeclareAndOptimize): Use iterator
to FoldConstants over basic block list.
* gm2-compiler/M2SymInit.mod (AppendEntry): Replace parameters
with BasicBlock.
* gm2-compiler/P3Build.bnf (Relation): Call RecordOp for #, <> and =.

gcc/testsuite/ChangeLog:

PR modula2/115536
* gm2/iso/const/pass/constbool4.mod: New test.
* gm2/iso/const/pass/constbool5.mod: New test.
* gm2/iso/run/pass/condtest2.mod: New test.
* gm2/iso/run/pass/condtest3.mod: New test.
* gm2/iso/run/pass/condtest4.mod: New test.
* gm2/iso/run/pass/condtest5.mod: New test.
* gm2/iso/run/pass/constbool4.mod: New test.

(cherry picked from commit 9f168b412f44781013401492acfedf22afe7741b)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoFortran: fix passing of NULL() actual argument to character dummy [PR104819]
Harald Anlauf [Thu, 14 Nov 2024 20:38:04 +0000 (21:38 +0100)] 
Fortran: fix passing of NULL() actual argument to character dummy [PR104819]

Ensure that character length is set and passed by the call to a procedure
when its dummy argument is NULL() with MOLD argument present, or set length
to either 0 or the callee's expected character length.  For assumed-rank
dummies, use the rank of the MOLD argument.  Generate temporaries for
passed arguments when needed.

PR fortran/104819

gcc/fortran/ChangeLog:

* trans-expr.cc (conv_null_actual): Helper function to handle
passing of NULL() to non-optional dummy arguments of non-bind(c)
procedures.
(gfc_conv_procedure_call): Use it for character dummies.

gcc/testsuite/ChangeLog:

* gfortran.dg/null_actual_6.f90: New test.

(cherry picked from commit f70c1d517e09c4dde421774a8cec591ca3c479a0)