]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
12 months agoi386: Account for the memory read in V*QImode multiplication sequences
Uros Bizjak [Mon, 22 May 2023 14:31:41 +0000 (16:31 +0200)] 
i386: Account for the memory read in V*QImode multiplication sequences

Add the cost of a memory read to the cost of V*QImode vector mult sequences.

gcc/ChangeLog:

* config/i386/i386.cc (ix86_multiplication_cost): Add
the cost of a memory read to the cost of V?QImode sequences.

12 months agoSkip some tests that won't work for target AVR.
Georg-Johann Lay [Mon, 22 May 2023 14:21:58 +0000 (16:21 +0200)] 
Skip some tests that won't work for target AVR.

gcc/testsuite/
* lib/target-supports.exp (check_effective_target_lra) [avr]: Return 0.
* gcc.dg/pr19402-2.c: Skip for avr.
* gcc.dg/pr86124.c: Same.
* gcc.dg/pr94291.c: Same.
* gcc.dg/torture/builtin-complex-1.c: Same.
* gcc.dg/torture/fp-int-convert-float32x-timode.c: Same.
* gcc.dg/torture/fp-int-convert-float32x.c: Same.
* gcc.dg/torture/fp-int-convert-float64-timode.c: Same.
* gcc.dg/torture/fp-int-convert-float64.c: Same.
* gcc.dg/torture/fp-int-convert-long-double.c: Same.
* gcc.dg/torture/fp-int-convert-timode.c: Same.
* c-c++-common/torture/builtin-convertvector-1.c: Same.
* c-c++-common/torture/complex-sign-add.c: Same.
* c-c++-common/torture/complex-sign-mixed-add.c: Same.
* c-c++-common/torture/complex-sign-mixed-div.c: Same.
* c-c++-common/torture/complex-sign-mixed-mul.c: Same.
* c-c++-common/torture/complex-sign-mixed-sub.c: Same.
* c-c++-common/torture/complex-sign-mul-minus-one.c: Same.
* c-c++-common/torture/complex-sign-mul-one.c: Same.
* c-c++-common/torture/complex-sign-mul.c: Same.
* c-c++-common/torture/complex-sign-sub.c: Same.

12 months agoRISC-V: Add "m_" prefix for private member
Juzhe-Zhong [Mon, 22 May 2023 14:05:18 +0000 (22:05 +0800)] 
RISC-V: Add "m_" prefix for private member

Since the current framework is hard to maintain and
hard to be used in the future possible auto-vectorization patterns.

We will need to keep adding more helpers and arguments during the
auto-vectorization supporting. We should refactor the framework
now for the future use since the we don't support too much
auto-vectorization
patterns for now.

Start with this simple patch, this patch is adding "m_" prefix for
private the members.

gcc/ChangeLog:

* config/riscv/riscv-v.cc: Add "m_" prefix.

Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
12 months agoRISC-V: Fix typo of multiple_rgroup-2.h
Juzhe-Zhong [Mon, 22 May 2023 10:38:26 +0000 (18:38 +0800)] 
RISC-V: Fix typo of multiple_rgroup-2.h

Just notice this following fail in the regression:
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-2.c (test for
excess errors)
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c (test
for excess errors)

Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-2.h: Fix
typo

12 months agoada: Reuse idiomatic procedure in CStand
Ronan Desplanques [Thu, 9 Feb 2023 22:00:41 +0000 (23:00 +0100)] 
ada: Reuse idiomatic procedure in CStand

This change replaces a call to Set_Name_Entity_Id with a call to
the higher-level Set_Current_Entity.

gcc/ada/

* cstand.adb: Use more idiomatic procedure.

12 months agoada: Avoid repeated calls when looking for first/last slocs of a node
Piotr Trojanek [Thu, 9 Feb 2023 18:20:14 +0000 (19:20 +0100)] 
ada: Avoid repeated calls when looking for first/last slocs of a node

gcc/ada/

* errout.adb (First_Loc): Avoid repeated calls.
(Last_Loc): Likewise.

12 months agoada: Small cleanup in support for protected subprograms
Eric Botcazou [Fri, 10 Feb 2023 18:07:33 +0000 (19:07 +0100)] 
ada: Small cleanup in support for protected subprograms

This moves the propagation of the Uses_Sec_Stack flag, from the original to
the rewritten subprogram, to the point where the latter is expanded, along
with the propagation of the Has_Nested_Subprogram flag, as well as addresses
a ??? comment in the same block of code.  No functional changes.

gcc/ada/

* inline.adb (Cleanup_Scopes): Do not propagate the Uses_Sec_Stack
flag from original to rewritten protected subprograms here...
* exp_ch9.adb (Expand_N_Protected_Body) <N_Subprogram_Body>:
...but here instead. Add local variables and remove a useless
test.

12 months agoada: Use idiomatic construct in Expand_N_Package_Body
Eric Botcazou [Fri, 10 Feb 2023 10:15:15 +0000 (11:15 +0100)] 
ada: Use idiomatic construct in Expand_N_Package_Body

gcc/ada/

* exp_ch7.adb (Expand_N_Package_Body): Call Defining_Entity to get
the entity of the body.

12 months agoada: Fix source location for crashes in expanded Loop_Entry attributes
Piotr Trojanek [Fri, 10 Feb 2023 15:28:41 +0000 (16:28 +0100)] 
ada: Fix source location for crashes in expanded Loop_Entry attributes

Historically, Loop_Entry attributes were expanded while expanding their
corresponding loops, so it was easier to use location of these loops for
expanded code. Now, these attributes are expanded where they appear, so
we can easily use the location of the attribute reference for expanded
code.

This matters when there is a crash in the expanded code, e.g. because of
a stack overflow in the declaration of an constant object that captures
the Loop_Entry prefix. Now backtrace will point to the source location
of the attribute, which is more helpful than the location of the loop.

gcc/ada/

* exp_attr.adb (Expand_Loop_Entry_Attribute): Use location of the
attribute reference, not of the loop statement.

12 months agoada: Add missing word in comment
Ronan Desplanques [Thu, 9 Feb 2023 09:34:11 +0000 (10:34 +0100)] 
ada: Add missing word in comment

gcc/ada/

* par-ch3.adb: Add missing word in comment.

12 months agoada: Incorrect constant folding in postcondition involving 'Old
Justin Squirek [Thu, 9 Feb 2023 17:00:46 +0000 (17:00 +0000)] 
ada: Incorrect constant folding in postcondition involving 'Old

The following patch fixes an issue in the compiler whereby certain flavors of
access comparisons may be incorrectly constant-folded out of contract
expressions - notably in postcondition expressions featuring a reference to
'Old.

gcc/ada/

* checks.adb (Install_Null_Excluding_Check): Avoid non-null
optimizations when assertions are enabled.

12 months agoada: Fix crash caused by incorrect expansion of iterated component
Marc Poulhiès [Thu, 9 Feb 2023 08:36:14 +0000 (09:36 +0100)] 
ada: Fix crash caused by incorrect expansion of iterated component

The way iterated component are expanded could lead to inconsistent tree.

This change fixes 2 issues:

- in an early step during Pre_Analyze, the loop variable still has
Any_Type and the compiler must not emit an error. A later full Analyze
is supposed to correctly set the Etype, and only then should the
compiler emit an error if Any_Type is still used.

- when expanding into a loop with assignments statement, the expression
is analyzed in an early context (where the loop variable still has
Any_Type Etype) and then copied. The compiler would crash because this
Any_Type is never changed because the expression node has its Analyzed
flag set. Resetting the flag ensures the later Analyze call also
analyzes these nodes and set Etype correctly.

gcc/ada/

* exp_aggr.adb (Process_Transient_Component): Reset Analyzed flag
for the copy of the initialization expression.
* sem_attr.adb (Validate_Non_Static_Attribute_Function_Call): Skip
error emission during Pre_Analyze.

12 months agoada: Fix missing finalization in separate package body
Eric Botcazou [Thu, 9 Feb 2023 15:05:16 +0000 (16:05 +0100)] 
ada: Fix missing finalization in separate package body

This directly comes from a loophole in the implementation.

gcc/ada/

* exp_ch7.adb (Process_Package_Body): New procedure taken from...
(Build_Finalizer.Process_Declarations): ...here.  Call the above
procedure to deal with both package bodies and package body stubs.

12 months agoada: Remove outdated part of comment
Ronan Desplanques [Thu, 9 Feb 2023 13:07:01 +0000 (14:07 +0100)] 
ada: Remove outdated part of comment

The concept of extended nodes was retired with the introduction of
variable-sized node types, but a reference to that concept was left
over in a comment. This change removes that reference.

gcc/ada/

* atree.ads: Remove outdated part of comment.

12 months agoada: Fix missing finalization in library-unit instance spec
Eric Botcazou [Wed, 8 Feb 2023 21:16:23 +0000 (22:16 +0100)] 
ada: Fix missing finalization in library-unit instance spec

This fixes the missing finalization of objects declared in the spec of
package instances that are library units (and only them, i.e. not all
library-level package instances) when the instances have a package body.

The finalization is done when there is no package body, and supporting
this case precisely broke the other case because of a thinko or a typo.

This also requires a small adjustment to the routine writing ALI files.

gcc/ada/

* exp_ch7.adb (Build_Finalizer): Reverse the test comparing the
instantiation and declaration nodes of a package instance, and
therefore bail out only when they are equal.  Adjust comments.
(Expand_N_Package_Declaration): Do not clear the Finalizer field.
* lib-writ.adb: Add with and use clauses for Sem_Util.
(Write_Unit_Information): Look at unit nodes to find finalizers.
* sem_ch12.adb (Analyze_Package_Instantiation): Beef up the comment
about the rewriting of the instantiation node into a declaration.

12 months agoada: Rename Is_Past_Self_Hiding_Point flag to be Is_Not_Self_Hidden
Bob Duff [Wed, 8 Feb 2023 16:46:10 +0000 (11:46 -0500)] 
ada: Rename Is_Past_Self_Hiding_Point flag to be Is_Not_Self_Hidden

...which seems clearer.

Still work in progress.

gcc/ada/

* cstand.adb (Is_Past_Self_Hiding_Point): Rename to be
Is_Not_Self_Hidden.
* einfo.ads: Likewise.
* exp_aggr.adb: Likewise.
* gen_il-fields.ads: Likewise.
* gen_il-gen-gen_entities.adb: Likewise.
* sem.adb: Likewise.
* sem_aggr.adb: Likewise.
* sem_ch11.adb: Likewise.
* sem_ch12.adb: Likewise.
* sem_ch5.adb: Likewise.
* sem_ch6.adb: Likewise.
* sem_ch7.adb: Likewise.
* sem_prag.adb: Likewise.

12 months agoada: Fix spurious freezing error on nonabstract null extension
Eric Botcazou [Wed, 8 Feb 2023 15:26:46 +0000 (16:26 +0100)] 
ada: Fix spurious freezing error on nonabstract null extension

This prevents the wrapper function created for each nonoverridden inherited
function with a controlling result of nonabstract null extensions of tagged
types from causing premature freezing of types referenced in its profile.

gcc/ada/

* exp_ch3.adb (Make_Controlling_Function_Wrappers): Create the body
as the expanded body of an expression function.

12 months agoada: Further fixes to GNATprove and CodePeer expression pretty-printer
Piotr Trojanek [Tue, 7 Feb 2023 20:36:36 +0000 (21:36 +0100)] 
ada: Further fixes to GNATprove and CodePeer expression pretty-printer

The expression pretty-printer still crashes on several tests, but
already gives much better outputs for many previously unsupported
constructs.

gcc/ada/

* pprint.adb (Expression_Image): Handle several previously unsupported
constructs.

12 months agoada: Cleanup redundant condition in resolution of entity names
Piotr Trojanek [Mon, 6 Feb 2023 21:56:49 +0000 (22:56 +0100)] 
ada: Cleanup redundant condition in resolution of entity names

Code cleanup related to new contract for SPARK; semantics is unaffected.

gcc/ada/

* sem_res.adb (Resolve_Entity_Name): Combine two IF statements that
execute code only for references that come from source.

12 months agoada: Add Is_Past_Self_Hiding_Point flag
Bob Duff [Mon, 6 Feb 2023 16:58:52 +0000 (11:58 -0500)] 
ada: Add Is_Past_Self_Hiding_Point flag

This patch adds a flag Is_Past_Self_Hiding_Point. When False,
this will replace E_Void as the indicator for a premature use of
a declaration within itself -- for example, "X : T := X;".

One might think this flag should be called something like
Is_Hidden_From_All_Visibility, reversing the sense of
Is_Past_Self_Hiding_Point. We don't do that because we want
Is_Past_Self_Hiding_Point to be initially False by default (and we have
no mechanism for defaulting to True), and because it doesn't exactly
match the RM definition of "hidden from all visibility" (for
example, for record components).

This is work in progress; more changes are needed before we
can remove all Mutate_Ekind(..., E_Void).

gcc/ada/

* einfo.ads (Is_Past_Self_Hiding_Point): Document.
* gen_il-fields.ads (Is_Past_Self_Hiding_Point): Add to list of
fields.
* gen_il-gen-gen_entities.adb (Is_Past_Self_Hiding_Point): Declare
in all entities.
* exp_aggr.adb: Set Is_Past_Self_Hiding_Point as appropriate.
* sem.adb: Likewise.
* sem_aggr.adb: Likewise.
* sem_ch11.adb: Likewise.
* sem_ch12.adb: Likewise.
* sem_ch5.adb: Likewise.
* sem_ch7.adb: Likewise.
* sem_prag.adb: Likewise.
* sem_ch6.adb: Likewise.
(Set_Formal_Mode): Minor cleanup: Move from spec.
* sem_ch6.ads:
(Set_Formal_Mode): Minor cleanup: Move to body.
* cstand.adb: Call Set_Is_Past_Self_Hiding_Point on all entities
as soon as they are created.
* comperr.adb (Compiler_Abort): Minor cleanup -- use 'in' instead
of 'or else'.
* debug.adb: Minor comment cleanups.

12 months agoada: Accept Assert pragmas in expression functions
Steve Baird [Fri, 3 Feb 2023 01:33:53 +0000 (17:33 -0800)] 
ada: Accept Assert pragmas in expression functions

gcc/ada/

* sem_ch4.adb (Analyze_Expression_With_Actions.Check_Action_Ok):
Accept an executable pragma occuring in a declare expression as
per AI22-0045. This means Assert and Inspection_Point pragmas as
well as any implementation-defined pragmas that the implementation
chooses to categorize as executable. Currently Assume and Debug
are the only such pragmas.

12 months agoada: Add warning on frontend inlining of Subprogram_Variant
Piotr Trojanek [Mon, 6 Feb 2023 13:45:22 +0000 (14:45 +0100)] 
ada: Add warning on frontend inlining of Subprogram_Variant

We already warned when contracts like pre/postcondition appear together
with pragma Inline_Always and they are ignored by the frontend inlining.

For consistency we now also warn for Subprogram_Variant, which is
similarly ignored even though this contract is only meaningful for
recursive subprograms and those can't be inlined anyway (but error about
this might only be emitted when full compilation is done).

gcc/ada/

* sem_prag.adb
(Check_Postcondition_Use_In_Inlined_Subprogram): Mention
Subprogram_Variant in the comment.
(Analyze_Subprogram_Variant_In_Decl_Part): Warn when contract is
ignored because of pragma Inline_Always and frontend inlining.

12 months agoada: Fix spurious warning on Inline_Always and contracts
Piotr Trojanek [Mon, 6 Feb 2023 13:40:26 +0000 (14:40 +0100)] 
ada: Fix spurious warning on Inline_Always and contracts

Warnings about pre/postconditions being ignored with Inline_Always were
only true for the obsolete frontend inlining. With the current backend
pre/postconditions work fine with Inline_Always.

gcc/ada/

* sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram): Only
emit warning when frontend inlining is enabled.

12 months agoada: Improve -gnatyx style check
Arnaud Charlet [Mon, 6 Feb 2023 08:50:42 +0000 (08:50 +0000)] 
ada: Improve -gnatyx style check

Check redundant parentheses in many more places, for now only under
-gnatdQ, while pending violations are fixed.

gcc/ada/

* par-ch3.adb, sem_ch4.adb (P_Discrete_Range, Analyze_Logical_Op,
Analyze_Short_Circuit): Add calls to Check_Xtra_Parentheses.
* par-ch5.adb (P_Condition): Move logic to Check_Xtra_Parentheses.
* style.ads, styleg.adb, styleg.ads (Check_Xtra_Parens): Move logic
related to expressions requiring parentheses here.

12 months agoada: Remove extra parentheses
Arnaud Charlet [Fri, 3 Feb 2023 11:07:24 +0000 (11:07 +0000)] 
ada: Remove extra parentheses

In preparation of enhancing -gnatyx to check for these automatically.

gcc/ada/

* ali-util.adb, par-endh.adb, par-prag.adb, par-ch2.adb,
checks.adb, fmap.adb, libgnat/a-nbnbig.ads, libgnat/g-dynhta.adb,
libgnat/s-carun8.adb, libgnat/s-strcom.adb, libgnat/a-dhfina.adb,
libgnat/a-direct.adb, libgnat/a-rbtgbo.adb, libgnat/a-strsea.adb,
libgnat/a-ststio.adb, libgnat/a-suenco.adb, libgnat/a-costso.adb,
libgnat/a-strmap.adb, libgnat/g-alleve.adb,
libgnat/g-debpoo.adb, libgnat/g-sercom__linux.adb,
libgnat/s-genbig.adb, libgnat/s-mmap.adb, libgnat/s-regpat.adb,
par-ch5.adb, sem_case.adb, sem_ch12.adb, sem_ch13.adb,
sem_ch8.adb, sem_eval.adb, sem_prag.adb, sem_type.adb,
exp_ch11.adb, exp_ch2.adb, exp_ch3.adb, exp_ch4.adb, exp_ch5.adb,
exp_ch6.adb, exp_ch9.adb, exp_put_image.adb, freeze.adb, live.adb,
sem_aggr.adb, sem_cat.adb, sem_ch10.adb, sem_ch3.adb, sem_ch6.adb,
sem_ch9.adb, sem_disp.adb, sem_elab.adb, sem_res.adb,
sem_util.adb, sinput.adb, uintp.adb, bcheck.adb, binde.adb,
binderr.adb, einfo-utils.adb, clean.adb, sem_ch4.adb, gnatls.adb,
gprep.adb, sem_ch11.adb: Remove extra parentheses.

12 months agoada: Remove a remaining reference to ?
Arnaud Charlet [Fri, 3 Feb 2023 11:08:35 +0000 (11:08 +0000)] 
ada: Remove a remaining reference to ?

We should no longer use ? anywhere when emitting warnings.

gcc/ada/

* sem_aggr.adb (Get_Value): Use ?? instead of ?.

12 months agoada: Remove redundant protection against empty lists
Piotr Trojanek [Wed, 1 Feb 2023 12:24:43 +0000 (13:24 +0100)] 
ada: Remove redundant protection against empty lists

Calls to List_Length on No_List intentionally return 0 (and likewise
call to First on No_List intentionally return Empty), so explicit guards
against No_List are unnecessary. Code cleanup; semantics is unaffected.

gcc/ada/

* exp_aggr.adb (Aggregate_Size): Remove redundant calls to
Present.
* exp_ch5.adb (Expand_N_If_Statement): Likewise.
* sem_prag.adb (Analyze_Pragma): Likewise.
* sem_warn.adb (Find_Var): Likewise.

12 months agoada: Support calls through dereferences in Find_Actual
Claire Dross [Fri, 3 Feb 2023 15:42:15 +0000 (16:42 +0100)] 
ada: Support calls through dereferences in Find_Actual

Return the corresponding formal in the designated subprogram profile in
that case.

gcc/ada/

* sem_util.adb (Find_Actual): On calls through dereferences,
return the corresponding formal in the designated subprogram
profile.

12 months agoada: Remove unreferenced utility routine Is_Actual_Tagged_Parameter
Piotr Trojanek [Fri, 3 Feb 2023 14:57:28 +0000 (15:57 +0100)] 
ada: Remove unreferenced utility routine Is_Actual_Tagged_Parameter

Routine Is_Actual_Tagged_Parameter was added to detect unsupported SPARK
2005 constructs, but this feature was deconstructed in favor of SPARK
2014 and its SPARK_Mode aspects.

gcc/ada/

* sem_util.ads (Is_Actual_Tagged_Parameter): Remove spec.
* sem_util.adb (Is_Actual_Tagged_Parameter): Remove body.

12 months agoada: Add contracts to Ada.Strings.Unbounded library
Joffrey Huguet [Mon, 16 Jan 2023 15:44:14 +0000 (16:44 +0100)] 
ada: Add contracts to Ada.Strings.Unbounded library

This patch adds contracts to the conversions between
Unbounded_String and String, the Element function and the
equality between two Unbounded_String, or between
Unbounded_String and String.
This patch also disallows the use of a function in SPARK, because
it returns an uninitialized Unbounded_String.

gcc/ada/

* libgnat/a-strunb.ads, libgnat/a-strunb__shared.ads
(To_Unbounded_String): Add postcondition. Add aspect SPARK_Mode
Off on the version that takes a Natural as parameter.
(To_String): Complete postcondition.
(Set_Unbounded_String): Add postcondition.
(Element): Likewise.
("="): Likewise.

12 months agoada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction
Eric Botcazou [Wed, 1 Feb 2023 16:46:17 +0000 (17:46 +0100)] 
ada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction

This makes it so that the compiler does not crash and flags the underlying
violation of the restriction instead.

gcc/ada/

* exp_ch3.adb (Freeze_Type): Do not associate the Finalize_Address
routine for a class-wide type if restriction No_Dispatching_Calls
is in effect.

12 months agoada: Implement conversions from Big_Integer to large types
Eric Botcazou [Wed, 1 Feb 2023 13:15:19 +0000 (14:15 +0100)] 
ada: Implement conversions from Big_Integer to large types

This implements the conversion from Big_Integer to Long_Long_Unsigned on
32-bit platforms and to Long_Long_Long_{Integer,Unsigned} on 64-bit ones.

gcc/ada/

* libgnat/s-genbig.ads (From_Bignum): New overloaded declarations.
* libgnat/s-genbig.adb (LLLI): New subtype.
(LLLI_Is_128): New boolean constant.
(From_Bignum): Change the return type of the signed implementation
to Long_Long_Long_Integer and add support for the case where its
size is 128 bits.  Add a wrapper around it for Long_Long_Integer.
Add an unsigned implementation returning Unsigned_128 and a wrapper
around it for Unsigned_64.
(To_Bignum): Test LLLI_Is_128 instead of its size.
(To_String.Image): Add qualification to calls to From_Bignum.
* libgnat/a-nbnbin.adb (To_Big_Integer): Likewise.
(Signed_Conversions.From_Big_Integer): Likewise.
(Unsigned_Conversions): Likewise.

12 months agoada: Fix error and crash on imported function with precondition and 'Base
Eric Botcazou [Wed, 1 Feb 2023 11:35:08 +0000 (12:35 +0100)] 
ada: Fix error and crash on imported function with precondition and 'Base

This fixes a spurious error on an imported function with a precondition
and a parameter declared with a 'Base formal type, and even a crash in
the case where this function is declared in a generic package.

gcc/ada/

* freeze.adb (Wrap_Imported_Subprogram): Use Copy_Subprogram_Spec
to copy the spec from the subprogram to the generated subprogram
body.
(Freeze_Entity): Do not wrap imported subprograms inside generics.

12 months agoada: Reject illegal declarations in expression functions
Steve Baird [Tue, 31 Jan 2023 01:05:13 +0000 (17:05 -0800)] 
ada: Reject illegal declarations in expression functions

gcc/ada/

* sem_ch4.adb (Analyze_Expression_With_Actions.Check_Action_Ok):
If Comes_From_Source (A) is False, then look at Original_Node (A)
instead of A. In particular, if an (illegal) expression function
is transformed into a "vanilla" function, we don't want to allow
it just because Comes_From_Source is now False.

12 months agoada: Better error message if non-Ada2022 code declares No_Return function
Steve Baird [Mon, 30 Jan 2023 23:41:48 +0000 (15:41 -0800)] 
ada: Better error message if non-Ada2022 code declares No_Return function

When a feature that is legal in Ada2022 but not in earlier Ada versions
is used, we typically want to call Error_Msg_Ada_2022_Feature in order to
generate an informative message in the error case. Specifying No_Return
for a function (as opposed to a procedure) is no exception to this rule.

gcc/ada/

* sem_prag.adb (Analyze_Pragma): In Check_No_Return, call
Error_Msg_Ada_2022_Feature in the case of a function. Remove code
outside of Check_No_Return that was querying Ada_Version.

12 months agoada: Fix double finalization in conditional exit statement
Eric Botcazou [Tue, 31 Jan 2023 15:04:01 +0000 (16:04 +0100)] 
ada: Fix double finalization in conditional exit statement

The temporary is first finalized through its enclosing block.

gcc/ada/

* exp_ch4.adb (Expand_N_Expression_With_Actions.Process_Action): Do
not look into nested blocks.

12 months agoada: Fix handling of constrained array declarations in declare-expression
Eric Botcazou [Tue, 31 Jan 2023 13:33:44 +0000 (14:33 +0100)] 
ada: Fix handling of constrained array declarations in declare-expression

They need to go through Constrain_Array or else they do not really work.

gcc/ada/

* sem_ch3.adb (Find_Type_Of_Object): In a spec expression, also set
the Scope of the type, and call Constrain_Array for array subtypes.

12 months agoada: Fix traversal for the rightmost node of a pretty-printed expression
Piotr Trojanek [Tue, 31 Jan 2023 12:45:23 +0000 (13:45 +0100)] 
ada: Fix traversal for the rightmost node of a pretty-printed expression

When getting the rightmost node of a pretty-printed expression we
incorrectly traversed some composite nodes, which caused the expression
image to be chopped.

gcc/ada/

* pprint.adb (Expression_Image): Reduce scope of local variables; inline
local uncommented constant From_Source; concatenate string with a single
character, as it is likely to execute faster; add missing cases to
traversal for the rightmost node and assertion to demonstrate that the
??? comment is no longer relevant.

12 months agoada: Restrict expression pretty-printer to subexpressions
Piotr Trojanek [Mon, 30 Jan 2023 11:21:24 +0000 (12:21 +0100)] 
ada: Restrict expression pretty-printer to subexpressions

When pretty-printing expressions with a CASE alternatives we can qualify
the call to Nkind using N_Subexpr, so that we will get compile-time
errors when new node kinds are added (e.g. Ada 2022 case expressions).

gcc/ada/

* pprint.adb (Expr_Name): Qualify CASE expression with N_Subexpr; add
missing alternative for N_Raise_Storage_Error; remove dead alternatives;
explicitly list unsupported alternatives.

12 months agoada: Don't pretty-print DEL within expression images
Piotr Trojanek [Mon, 30 Jan 2023 10:28:55 +0000 (11:28 +0100)] 
ada: Don't pretty-print DEL within expression images

When printing expression images, e.g. for GNATprove counterexamples,
it seems better to print DEL not directly but with its numeric code.

gcc/ada/

* pprint.adb (Expr_Name): Exclude DEL from printable range.

12 months agoada: Update Controlling_Argument when copying trees
Piotr Trojanek [Fri, 27 Jan 2023 11:37:25 +0000 (12:37 +0100)] 
ada: Update Controlling_Argument when copying trees

When copying the AST we need to update fields that carry semantic
meaning and not just copy them. We already updated some of them,
e.g. the First/Next_Named_Association chain, but failed to update
the Controlling_Argument.

This fix doesn't appear to change anything for the compiler, but it is
needed for GNATprove, where we no longer want to expand expression
functions and instead we want to copy their preanalyzed expressions.

gcc/ada/

* sem_util.ads (New_Copy_Tree): Update comment.
* sem_util.adb (New_Copy_Tree): Update Controlling_Argument, very
much like we update the First/Next_Named_Association.

12 months agoada: update Ada_Version_Type in fe.h to match opt.ads
Bob Duff [Mon, 30 Jan 2023 21:56:08 +0000 (16:56 -0500)] 
ada: update Ada_Version_Type in fe.h to match opt.ads

Remove Ada_With_Extensions, which is not used on the C side.
Do not add Ada_With_Core_Extensions and Ada_With_All_Extensions,
which are also not used on the C side, and on the Ada side
are always used via functions All_Extensions_Allowed and
Core_Extensions_Allowed. Explain this in comments.

Move the functions closer to the type declaration,
so the usage style is clearer.

Cleanup only -- no change in compiler behavior.

gcc/ada/

* fe.h: Remove Ada_With_Extensions and add commentary.
* opt.ads: Rearrange code and add commentary.

12 months agoada: prevent infinite recursion in Collect_Types_In_Hierarchy
Bob Duff [Mon, 30 Jan 2023 16:25:08 +0000 (11:25 -0500)] 
ada: prevent infinite recursion in Collect_Types_In_Hierarchy

In (illegal) mutually-dependent type declarations, it is possible for
Etype (Etype (Typ)) to point back to Typ. This patch stops the recursion
in such cases.

gcc/ada/

* sem_util.adb (Process_Type): Stop the recursion.
* exp_aggr.adb (Build_Record_Aggr_Code): Add assertion.

12 months agoVECT: Fix bug of multiple-rgroup for length is counting elements
Ju-Zhe Zhong [Mon, 22 May 2023 08:35:37 +0000 (16:35 +0800)] 
VECT: Fix bug of multiple-rgroup for length is counting elements

Address comments from Richard that splits the patch of fixing
multiple-rgroup
handling of length counting elements.

This patch is fixing issue of handling multiple-rgroup of length is
counting elements

Before this patch, multiple rgroup run fail:
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c
execution test
FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c
execution test

After this patch, These tests are all passed.

gcc/ChangeLog:

* tree-vect-loop.cc (vect_get_loop_len): Fix issue for
multiple-rgroup of length.
* tree-vect-stmts.cc (vectorizable_store): Ditto.
(vectorizable_load): Ditto.
* tree-vectorizer.h (vect_get_loop_len): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-1.c: New
test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-1.h: New
test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-2.c: New
test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-2.h: New
test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c:
New test.
* gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c:
New test.

12 months agoRISC-V: Reorganize the code of CONST_VECTOR handling in riscv.cc
Juzhe-Zhong [Mon, 22 May 2023 07:42:18 +0000 (15:42 +0800)] 
RISC-V: Reorganize the code of CONST_VECTOR handling in riscv.cc

Since satisfies_constraint_vi (x) belongs to RVV region.
We make this condition inside riscv_v_ext_vector_mode_p to make codes
more reasonable.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_const_insns): Reorganize the
codes.

12 months agovect: Refactor code for index == count in vect_transform_slp_perm_load_1
Kewen Lin [Mon, 22 May 2023 02:19:02 +0000 (21:19 -0500)] 
vect: Refactor code for index == count in vect_transform_slp_perm_load_1

This patch is to refactor the handlings for the case (index
== count) in a loop of vect_transform_slp_perm_load_1, in
order to prepare a subsequent adjustment on *nperm.  This
patch doesn't have any functional changes.

Basically this is to rewrite two if below:

  if (index == count && !noop_p)
    {
       // A ...
       // ++*n_perms;
    }

  if (index == count)
    {
       if (!analyze_only)
 {
    if (!noop_p)
       // B1 ...

    // B2 ...

    for ...
      {
 if (!noop_p)
    // B3 building VEC_PERM_EXPR
 else
    // B4 building nothing (no uses for B2 and its seq)
      }
 }
       // B5
    }

into one hunk below:

  if (index == count)
    {
       if (!noop_p)
 {
   // A ...
   // ++*n_perms;

   if (!analyze_only)
     {
// B1 ...
// B2 ...
for ...
   // B3 building VEC_PERM_EXPR
     }
 }
       else if (!analyze_only)
 {
    // no B2 since no any further uses here.
    for ...
      // B4 building nothing
 }
// B5 ...
    }

gcc/ChangeLog:

* tree-vect-slp.cc (vect_transform_slp_perm_load_1): Refactor the
handling for the case index == count.

12 months agoDaily bump.
GCC Administrator [Mon, 22 May 2023 00:17:09 +0000 (00:17 +0000)] 
Daily bump.

12 months agolibgomp: Honor OpenMP's nteams-var ICV as upper limit on num teams [PR109875]
Tobias Burnus [Sun, 21 May 2023 18:36:19 +0000 (20:36 +0200)] 
libgomp: Honor OpenMP's nteams-var ICV as upper limit on num teams [PR109875]

The nteams-var ICV exists per device and can be set either via the routine
omp_set_num_teams or as environment variable (OMP_NUM_TEAMS with optional
_ALL/_DEV/_DEV_<num> suffix); it is default-initialized to zero. The number
of teams created is described under the num_teams clause. If the clause is
absent, the number of teams is implementation defined but at least
one team must exist and, if nteams-var is positive, at most nteams-var
teams may exist.

The latter condition was not honored in a target region before this
commit, such that too many teams were created.

Already before this commit, both the num_teams([lower:]upper) clause
(on the host and in target regions) and, only on the host, the nteams-var
ICV were honored. And as only one teams is created for host fallback,
unless the clause specifies otherwise, the nteams-var ICV was and is
effectively honored.

libgomp/ChangeLog:

PR libgomp/109875
* config/gcn/target.c (GOMP_teams4): Honor nteams-var ICV.
* config/nvptx/target.c (GOMP_teams4): Likewise.
* testsuite/libgomp.c-c++-common/teams-nteams-icv-1.c: New test.
* testsuite/libgomp.c-c++-common/teams-nteams-icv-2.c: New test.
* testsuite/libgomp.c-c++-common/teams-nteams-icv-3.c: New test.
* testsuite/libgomp.c-c++-common/teams-nteams-icv-4.c: New test.

12 months agotarget/90622: __builtin_avr_insert bits: Use BLD/BST for one bit in place.
Georg-Johann Lay [Sun, 21 May 2023 16:54:21 +0000 (18:54 +0200)] 
target/90622: __builtin_avr_insert bits: Use BLD/BST for one bit in place.

If just one bit is inserted in the same position like with:
    __builtin_avr_insert_bits (0xFFFFF2FF, src, dst);
a BLD/BST sequence is better than XOR/AND/XOR.  Thus, don't fold that
case to the latter sequence.

gcc/
PR target/90622
* config/avr/avr.cc (avr_fold_builtin) [AVR_BUILTIN_INSERT_BITS]:
Don't fold to XOR / AND / XOR if just one bit is copied to the
same position.

12 months agonvptx: Add suppport for __builtin_nvptx_brev instrinsic.
Roger Sayle [Sun, 21 May 2023 14:06:52 +0000 (15:06 +0100)] 
nvptx: Add suppport for __builtin_nvptx_brev instrinsic.

This patch adds support for (a pair of) bit reversal intrinsics
__builtin_nvptx_brev and __builtin_nvptx_brevll which perform 32-bit
and 64-bit bit reversal (using nvptx's brev instruction) matching
the __brev and __brevll instrinsics provided by NVidia's nvcc compiler.
https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH__INTRINSIC__INT.html

2023-05-21  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/nvptx/nvptx.cc (nvptx_expand_brev): Expand target
builtin for bit reversal using brev instruction.
(enum nvptx_builtins): Add NVPTX_BUILTIN_BREV and
NVPTX_BUILTIN_BREVLL.
(nvptx_init_builtins): Define "brev" and "brevll".
(nvptx_expand_builtin): Expand NVPTX_BUILTIN_BREV and
NVPTX_BUILTIN_BREVLL via nvptx_expand_brev function.
* doc/extend.texi (Nvidia PTX Builtin-in Functions): New
section, document __builtin_nvptx_brev{,ll}.

gcc/testsuite/ChangeLog
* gcc.target/nvptx/brev-1.c: New 32-bit test case.
* gcc.target/nvptx/brev-2.c: Likewise.
* gcc.target/nvptx/brevll-1.c: New 64-bit test case.
* gcc.target/nvptx/brevll-2.c: Likewise.

12 months agoatch.pd: Ensure (op CONSTANT_CLASS_P CONSTANT_CLASS_P) is simplified [PR109505]
Jakub Jelinek [Sun, 21 May 2023 11:36:56 +0000 (13:36 +0200)] 
atch.pd: Ensure (op CONSTANT_CLASS_P CONSTANT_CLASS_P) is simplified [PR109505]

On the following testcase we hang, because POLY_INT_CST is CONSTANT_CLASS_P,
but BIT_AND_EXPR with it and INTEGER_CST doesn't simplify and the
(x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2)
simplification actually relies on the (CST1 & CST2) simplification,
otherwise it is a deoptimization, trading 2 ops for 3 and furthermore
running into
/* Given a bit-wise operation CODE applied to ARG0 and ARG1, see if both
   operands are another bit-wise operation with a common input.  If so,
   distribute the bit operations to save an operation and possibly two if
   constants are involved.  For example, convert
     (A | B) & (A | C) into A | (B & C)
   Further simplification will occur if B and C are constants.  */
simplification which simplifies that
(x & CST2) | (CST1 & CST2) back to
CST2 & (x | CST1).
I went through all other places I could find where we have a simplification
with 2 CONSTANT_CLASS_P operands and perform some operation on those two,
while the other spots aren't that severe (just trade 2 operations for
another 2 if the two constants don't simplify, rather than as in the above
case trading 2 ops for 3), I still think all those spots really intend
to optimize only if the 2 constants simplify.

So, the following patch adds to those a ! modifier to ensure that,
even at GENERIC that modifier means !EXPR_P which is exactly what we want
IMHO.

2023-05-21  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109505
* match.pd ((x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2),
Combine successive equal operations with constants,
(A +- CST1) +- CST2 -> A + CST3, (CST1 - A) +- CST2 -> CST3 - A,
CST1 - (CST2 - A) -> CST3 + A): Use ! on ops with 2 CONSTANT_CLASS_P
operands.

* gcc.target/aarch64/sve/pr109505.c: New test.

12 months agoFix expand_single_bit_test for big-endian
Andrew Pinski [Sun, 21 May 2023 04:01:46 +0000 (21:01 -0700)] 
Fix expand_single_bit_test for big-endian

I had thought extract_bit_field bitpos argument was the shifted position
and not the bitposition like BIT_FIELD_REF so I had removed the code which
would use the correct bitposition for BYTES_BIG_ENDIAN.

Committed as obvious; I checked big-endian MIPS to make sure we are now
producing the correct code.

gcc/ChangeLog:

* expr.cc (expand_single_bit_test): Correct bitpos for big-endian.

12 months agoRISC-V: Support RVV VREINTERPRET from v{u}int*_t to vbool[2-64]_t
Pan Li [Wed, 17 May 2023 07:59:30 +0000 (15:59 +0800)] 
RISC-V: Support RVV VREINTERPRET from v{u}int*_t to vbool[2-64]_t

This patch support the RVV VREINTERPRET from the int to the
vbool[2|4|8|16|32|64]_t.  Aka:

vbool[2|4|8|16|32|64]_t __riscv_vreinterpret_x_x(v{u}int[8|16|32|64]_t);

These APIs help the users to convert vector LMUL=1 integer to
vbool[2-64]_t.  According to the RVV intrinsic SPEC as below,
the reinterpret intrinsics only change the types of the underlying
contents.

https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/master/rvv-intrinsic-rfc.md#reinterpret-vbool-o-vintm1

For example, given below code.
vbool64_t test_vreinterpret_v_u8m1_b64 (vuint8m1_t src) {
  return __riscv_vreinterpret_v_u8m1_b64 (src);
}

It will generate the assembly code similar as below:
vsetvli a5,zero,e8,mf8,ta,ma
vlm.v   v1,0(a1)
vsm.v   v1,0(a0)
ret

Please NOTE the test files doesn't cover all the possible combinations
of the intrinsic APIs introduced by this PATCH due to too many.
The reinterpret from vbool*_t to v{u}int*_t with lmul=1 will be coverred
int another PATCH.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/genrvv-type-indexer.cc (BOOL_SIZE_LIST): Add the
rest bool size, aka 2, 4, 8, 16, 32, 64.
* config/riscv/riscv-vector-builtins-functions.def (vreinterpret):
Register vbool[2|4|8|16|32|64] interpret function.
* config/riscv/riscv-vector-builtins-types.def (DEF_RVV_BOOL2_INTERPRET_OPS):
New macro for vbool2_t.
(DEF_RVV_BOOL4_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL8_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL16_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL32_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL64_INTERPRET_OPS): Likewise.
(vint8m1_t): Add the type to bool[2|4|8|16|32|64]_interpret_ops.
(vint16m1_t): Likewise.
(vint32m1_t): Likewise.
(vint64m1_t): Likewise.
(vuint8m1_t): Likewise.
(vuint16m1_t): Likewise.
(vuint32m1_t): Likewise.
(vuint64m1_t): Likewise.
* config/riscv/riscv-vector-builtins.cc (DEF_RVV_BOOL2_INTERPRET_OPS):
New macro for vbool2_t.
(DEF_RVV_BOOL4_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL8_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL16_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL32_INTERPRET_OPS): Likewise.
(DEF_RVV_BOOL64_INTERPRET_OPS): Likewise.
(required_extensions_p): Add vbool[2|4|8|16|32|64] interpret case.
* config/riscv/riscv-vector-builtins.def (bool2_interpret): Add
vbool2_t interprect to base type.
(bool4_interpret): Likewise.
(bool8_interpret): Likewise.
(bool16_interpret): Likewise.
(bool32_interpret): Likewise.
(bool64_interpret): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c: Add
test cases for vbool[2|4|8|16|32|64]_t.

12 months agoFix PR 109919: ICE in emit_move_insn with some bit tests
Andrew Pinski [Sat, 20 May 2023 21:14:23 +0000 (21:14 +0000)] 
Fix PR 109919: ICE in emit_move_insn with some bit tests

The problem is I used expand_expr with the target but
we don't want to use the target here as it is the wrong
mode for the original expression. The testcase would ICE
deap down while trying to do a move to use the target.
Anyways just calling expand_expr with NULL_EXPR fixes
the issue.

Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

PR middle-end/109919

gcc/ChangeLog:

* expr.cc (expand_single_bit_test): Don't use the
target for expand_expr.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr109919-1.c: New test.

12 months agoDaily bump.
GCC Administrator [Sun, 21 May 2023 00:16:29 +0000 (00:16 +0000)] 
Daily bump.

12 months agoinstall.texi: Remove alpha*-*-* section
Gerald Pfeifer [Sat, 20 May 2023 22:23:59 +0000 (00:23 +0200)] 
install.texi: Remove alpha*-*-* section

gcc/ChangeLog:

* doc/install.texi (Specific): Remove de facto empty alpha*-*-*
section.

12 months agoMode-Switching: Fix local array maybe uninitialized warning
Pan Li [Fri, 19 May 2023 23:49:00 +0000 (07:49 +0800)] 
Mode-Switching: Fix local array maybe uninitialized warning

There are 2 local array in function optimize_mode_switching. It will be
initialized conditionally at the beginning but then always consumed in
another loop. It may trigger the warning maybe-uninitialized, and may
result in build failure when enable werror, aka warning as error.

This patch will initialize the local array to zero explictly when
declaration.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* mode-switching.cc (entity_map): Initialize the array to zero.
(bb_info): Ditto.

12 months agotarget/105753: Fix ICE in add_clobbers due to extra PARALLEL in insn.
Triffid Hunter [Sat, 20 May 2023 05:50:00 +0000 (07:50 +0200)] 
target/105753: Fix ICE in add_clobbers due to extra PARALLEL in insn.

This patch removes the superfluous parallel in [u]divmod patterns in
the AVR backend.  Effect of extra parallel is that add_clobbers reaches
gcc_unreachable() because the clobbers for [u]divmod are missing.
If an insn has multiple parts like clobbers, the parallel around the
parts of the insn pattern is implicit.

gcc/
PR target/105753
* config/avr/avr.md (divmodpsi, udivmodpsi, divmodsi, udivmodsi):
Remove superfluous "parallel" in insn pattern.
([u]divmod<mode>4): Tidy code.  Use gcc_unreachable() instead of
printing error text to assembly.

gcc/testsuite/
PR target/105753
* gcc.target/avr/torture/pr105753.c: New test.

12 months agoExpand directly for single bit test
Andrew Pinski [Fri, 19 May 2023 22:09:04 +0000 (22:09 +0000)] 
Expand directly for single bit test

Instead of using creating trees to the expansion,
just expand directly which makes the code a little simplier
but also reduces how much GC memory will be used during the expansion.

gcc/ChangeLog:

* expr.cc (fold_single_bit_test): Rename to ...
(expand_single_bit_test): This and expand directly.
(do_store_flag): Update for the rename function.

12 months agoUse BIT_FIELD_REF inside fold_single_bit_test
Andrew Pinski [Fri, 19 May 2023 19:44:35 +0000 (19:44 +0000)] 
Use BIT_FIELD_REF inside fold_single_bit_test

Instead of depending on combine to do the extraction,
Let's create a tree which will expand directly into
the extraction. This improves code generation on some
targets.

gcc/ChangeLog:

* expr.cc (fold_single_bit_test): Use BIT_FIELD_REF
instead of shift/and.

12 months agoSimplify fold_single_bit_test with respect to code
Andrew Pinski [Fri, 19 May 2023 18:52:45 +0000 (18:52 +0000)] 
Simplify fold_single_bit_test with respect to code

Since we know that fold_single_bit_test is now only passed
NE_EXPR or EQ_EXPR, we can simplify it and just use a gcc_assert
to assert that is the code that is being passed.

gcc/ChangeLog:

* expr.cc (fold_single_bit_test): Add an assert
and simplify based on code being NE_EXPR or EQ_EXPR.

12 months agoSimplify fold_single_bit_test slightly
Andrew Pinski [Fri, 19 May 2023 18:36:39 +0000 (18:36 +0000)] 
Simplify fold_single_bit_test slightly

Now the only use of fold_single_bit_test is in do_store_flag,
we can change it such that to pass the inner arg and bitnum
instead of building a tree. There is no code generation changes
due to this change, only a decrease in GC memory that is produced
during expansion.

gcc/ChangeLog:

* expr.cc (fold_single_bit_test): Take inner and bitnum
instead of arg0 and arg1. Update the code.
(do_store_flag): Don't create a tree when calling
fold_single_bit_test instead just call it with the bitnum
and the inner tree.

12 months agoUse get_def_for_expr in fold_single_bit_test
Andrew Pinski [Fri, 19 May 2023 18:21:59 +0000 (18:21 +0000)] 
Use get_def_for_expr in fold_single_bit_test

The code in fold_single_bit_test, checks if
the inner was a right shift and improve the bitnum
based on that. But since the inner will always be a
SSA_NAME at this point, the code is dead. Move it over
to use the helper function get_def_for_expr instead.

gcc/ChangeLog:

* expr.cc (fold_single_bit_test): Use get_def_for_expr
instead of checking the inner's code.

12 months agoInline and simplify fold_single_bit_test_into_sign_test into fold_single_bit_test
Andrew Pinski [Fri, 19 May 2023 17:47:14 +0000 (17:47 +0000)] 
Inline and simplify fold_single_bit_test_into_sign_test into fold_single_bit_test

Since the last use of fold_single_bit_test is fold_single_bit_test,
we can inline it and even simplify the inlined version. This has
no behavior change.

gcc/ChangeLog:

* expr.cc (fold_single_bit_test_into_sign_test): Inline into ...
(fold_single_bit_test): This and simplify.

12 months agoMove fold_single_bit_test to expr.cc from fold-const.cc
Andrew Pinski [Fri, 19 May 2023 16:20:23 +0000 (16:20 +0000)] 
Move fold_single_bit_test to expr.cc from fold-const.cc

This is part 1 of N patch set that will change the expansion
of `(A & C) != 0` from using trees to directly expanding so later
on we can do some cost analysis.

Since the only user of fold_single_bit_test is now
expand, move it to there.

gcc/ChangeLog:

* fold-const.cc (fold_single_bit_test_into_sign_test): Move to
expr.cc.
(fold_single_bit_test): Likewise.
* expr.cc (fold_single_bit_test_into_sign_test): Move from fold-const.cc
(fold_single_bit_test): Likewise and make static.
* fold-const.h (fold_single_bit_test): Remove declaration.

12 months agoFix riscv_expand_conditional_move.
Die Li [Sat, 20 May 2023 05:00:13 +0000 (23:00 -0600)] 
Fix riscv_expand_conditional_move.

Two issues have been observed in current riscv_expand_conditional_move
implementation.
1. Before introduction of TARGET_XTHEADCONDMOV, op0 of comparision expression
is used for mode comparision with word_mode, but after TARGET_XTHEADCONDMOV
megered with TARGET_SFB_ALU, dest of if-then-else is used for mode comparision with
word_mode, and from md file mode of dest is DI or SI which can be different with
word_mode in RV64.

2. TARGET_XTHEADCONDMOV cannot be generated when the mode of the comparison is E_VOID.

This patch solves the issues above.

Provide an example from the newly added test case.

Testcase:
int ConNmv_reg_reg_reg(int x, int y, int z, int n){
  if (x != y) return z;
  return n;
}

Cflags:
-O2 -march=rv64gc_xtheadcondmov -mabi=lp64d

before patch:
ConNmv_reg_reg_reg:
bne a0,a1,.L23
mv a2,a3
.L23:
mv a0,a2
ret

after patch:
ConNmv_reg_reg_reg:
sub a1,a0,a1
th.mveqz a2,zero,a1
th.mvnez a3,zero,a1
or a0,a2,a3
ret

Co-Authored by: Fei Gao <gaofei@eswincomputing.com>
Signed-off-by: Die Li <lidie@eswincomputing.com>
gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_expand_conditional_move): Fix mode
checking.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadcondmov-indirect-rv32.c: New test.
* gcc.target/riscv/xtheadcondmov-indirect-rv64.c: New test.

12 months agoAdd bext pattern for ZBS
Raphael Moreira Zinsly [Sat, 20 May 2023 03:41:12 +0000 (21:41 -0600)] 
Add bext pattern for ZBS

Changes since v1:
        - Removed name clash change.
        - Fix new pattern indentation.

-- >8 --

When (a & (1 << bit_no)) is tested inside an IF we can use a bit extract.

gcc/ChangeLog:

* config/riscv/bitmanip.md (branch<X:mode>_bext): New split pattern.

gcc/testsuite/ChangeLog:
* gcc.target/riscv/zbs-bext-02.c: New test.

12 months agoRISC-V: Fix CTZ unnecessary sign extension [PR #106888]
Raphael Moreira Zinsly [Sat, 20 May 2023 02:54:34 +0000 (20:54 -0600)] 
RISC-V: Fix CTZ unnecessary sign extension [PR #106888]

Changes since v1:
- Remove subreg from operand 1.

-- >8 --

We were not able to match the CTZ sign extend pattern on RISC-V
because it gets optimized to zero extend and/or to ANDI patterns.
For the ANDI case, combine scrambles the RTL and generates the
extension by using subregs.

gcc/ChangeLog:
PR target/106888
* config/riscv/bitmanip.md
(<bitmanip_optab>disi2): Match with any_extend.
(<bitmanip_optab>disi2_sext): New pattern to match
with sign extend using an ANDI instruction.

gcc/testsuite/ChangeLog:
PR target/106888
* gcc.target/riscv/pr106888.c: New test.
* gcc.target/riscv/zbbw.c: Check for ANDI.

12 months agoDaily bump.
GCC Administrator [Sat, 20 May 2023 00:16:40 +0000 (00:16 +0000)] 
Daily bump.

12 months agoAllow plugin dumps
Nathan Sidwell [Wed, 17 May 2023 23:27:13 +0000 (19:27 -0400)] 
Allow plugin dumps

Defer dump option parsing until plugins are initialized.  This allows one to
use plugin names for dumps.

PR other/99451
gcc/
* opts.h (handle_deferred_dump_options): Declare.
* opts-global.cc (handle_common_deferred_options): Do not handle
dump options here.
(handle_deferred_dump_options): New.
* toplev.cc (toplev::main): Call it after plugin init.

12 months agoRISC-V: Remove masking third operand of rotate instructions
Joern Rennecke [Fri, 19 May 2023 22:18:42 +0000 (16:18 -0600)] 
RISC-V: Remove masking third operand of rotate instructions

Sorry, I forgot the ChangeLog entry for my patch and missed the [v2]
part of the subject.

2023-05-18  Joern Rennecke  <joern.rennecke@embecosm.com>

gcc/ChangeLog:
* config/riscv/constraints.md (DsS, DsD): Restore agreement
with shiftm1 mode attribute.

12 months agoc: Remove dead code related to type compatibility across TUs.
Martin Uecker [Fri, 19 May 2023 14:15:17 +0000 (16:15 +0200)] 
c: Remove dead code related to type compatibility across TUs.

Code to detect struct/unions across the same TU is not needed
anymore. Code for determining compatibility of tagged types is
preserved as it will be used for C2X. Some errors in the unused
code are fixed.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c/
* c-decl.cc (set_type_context): Remove.
(pop_scope, diagnose_mismatched_decls, pushdecl):
Remove dead code.
* c-typeck.cc (comptypes_internal): Remove dead code.
(same_translation_unit_p): Remove.
(tagged_types_tu_compatible_p): Some fixes.

12 months agofortran: Use CLASS_DATA from gfortran.h
Bernhard Reutner-Fischer [Thu, 18 May 2023 16:04:10 +0000 (18:04 +0200)] 
fortran: Use CLASS_DATA from gfortran.h

gcc/fortran/ChangeLog:

* expr.cc (gfc_get_corank): Use CLASS_DATA from gfortran.h.
* resolve.cc (resolve_component): Same.
(resolve_fl_derived0): Same.
* simplify.cc (gfc_simplify_extends_type_of): Same.
(simplify_cobound): Same.

12 months agoFix driver/33980: Precompiled header file not removed on error
Andrew Pinski [Fri, 19 May 2023 06:12:49 +0000 (06:12 +0000)] 
Fix driver/33980: Precompiled header file not removed on error

So the problem here is that in the spec files, we were not marking the pch
output file to be removed on error.
The way to fix this is to mark the --output-pch argument as the output
file argument.
For the C++ specs file, we had to move around where the %V was located
such that it would be after the %w marker as %V marker clears the outputfiles.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/cp/ChangeLog:

PR driver/33980
* lang-specs.h ("@c++-header"): Add %w after
the --output-pch.
("@c++-system-header"): Likewise.
("@c++-user-header"): Likewise.

gcc/ChangeLog:

PR driver/33980
* gcc.cc (default_compilers["@c-header"]): Add %w
after the --output-pch.

12 months agoRISC-V: improve codegen for large constants with same 32-bit lo and hi parts [2]
Vineet Gupta [Tue, 9 May 2023 23:22:08 +0000 (16:22 -0700)] 
RISC-V: improve codegen for large constants with same 32-bit lo and hi parts [2]

[part #2 of PR/109279]

SPEC2017 deepsjeng uses large constants which currently generates less than
ideal code. This fix improves codegen for large constants which have
same low and hi parts: e.g.

long long f(void) { return 0x0101010101010101ull; }

Before
        li      a5,0x1010000
        addi    a5,a5,0x101
        mv      a0,a5
        slli    a5,a5,32
        add     a0,a5,a0
        ret

With patch
li a5,0x1010000
addi a5,a5,0x101
slli a0,a5,32
add a0,a0,a5
ret

This is testsuite clean.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_split_integer): if loval is equal
to hival, ASHIFT the corresponding regs.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
12 months agoc++: simplify norm_cache manipulation
Patrick Palka [Fri, 19 May 2023 13:58:20 +0000 (09:58 -0400)] 
c++: simplify norm_cache manipulation

We can avoid performing two norm_cache lookups during normalization of a
concept-id by allocating and inserting a norm_entry* before rather than
after the fact, which is simpler and cheaper.

gcc/cp/ChangeLog:

* constraint.cc (normalize_concept_check): Avoid having to do
two norm_cache lookups.  Remove unnecessary early exit for an
ill-formed concept definition.

12 months agoc++: scoped variable template-id of reference type [PR97340]
Patrick Palka [Fri, 19 May 2023 13:40:16 +0000 (09:40 -0400)] 
c++: scoped variable template-id of reference type [PR97340]

lookup_and_finish_template_variable calls convert_from_reference, which
means for a variable template-id of reference type the function wraps
the corresponding VAR_DECL in an INDIRECT_REF.  But the downstream logic
of two callers, tsubst_qualified_id and finish_class_member_access_expr,
expect a DECL_P result and this unexpected INDIRECT_REF leads to an ICE
resolving such a (dependently scoped) template-id as in the first testcase.
(Note these two callers eventually call convert_from_reference on the
result anyway, so calling it earlier seems redundant in this case.)

This patch fixes this by pulling out the convert_from_reference call
from lookup_and_finish_template_variable and into the callers that
actually need it, which turns out to only be tsubst_copy_and_build
(if we got rid of the call there we'd mishandle the second testcase).

PR c++/97340

gcc/cp/ChangeLog:

* pt.cc (lookup_and_finish_template_variable): Don't call
convert_from_reference.
(tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
convert_from_reference on the result of
lookup_and_finish_template_variable.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/var-templ80.C: New test.
* g++.dg/cpp1y/var-templ81.C: New test.

12 months agoRISC-V: testsuite: Remove empty *-run-template.h.
Robin Dapp [Tue, 16 May 2023 06:24:04 +0000 (08:24 +0200)] 
RISC-V: testsuite: Remove empty *-run-template.h.

This patch removes empty run template files and one redundant stdio.h
include.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/binop/shift-run.c: Do not include
<stdio.h>.
* gcc.target/riscv/rvv/autovec/binop/shift-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vadd-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vand-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vdiv-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vmax-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vmin-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vmul-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vor-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vrem-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vsub-run-template.h: Removed.
* gcc.target/riscv/rvv/autovec/binop/vxor-run-template.h: Removed.

12 months agoRISC-V: Allow more loading of const vectors.
Robin Dapp [Fri, 12 May 2023 08:26:51 +0000 (10:26 +0200)] 
RISC-V: Allow more loading of const vectors.

This patch fixes the recent vmv patch in order to allow loading
of constants via vmv.vi with the "fixed-vlmax" vectorization flavor.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_const_insns): Remove else.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c: New test.
* gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c: New test.

12 months agoPR modula2/109908 Delete from m2iso Strings is broken
Gaius Mulley [Fri, 19 May 2023 11:18:53 +0000 (12:18 +0100)] 
PR modula2/109908 Delete from m2iso Strings is broken

This patch re-implements Strings.Delete and also supplies
some runtime test code.

gcc/m2/ChangeLog:

PR modula2/109908
* gm2-libs-iso/Strings.mod (Delete): Re-implement.

gcc/testsuite/ChangeLog:

PR modula2/109908
* gm2/isolib/run/pass/testdelete.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
12 months agotree-ssa-math-opts: Pattern recognize some further hand written forms of signed __bui...
Jakub Jelinek [Fri, 19 May 2023 10:58:32 +0000 (12:58 +0200)] 
tree-ssa-math-opts: Pattern recognize some further hand written forms of signed __builtin_mul_overflow{,_p} [PR105776]

In the pattern recognition of signed __builtin_mul_overflow{,_p} we
check for result of unsigned division (which follows unsigned
multiplication) being equality compared against one of the multiplication's
argument (the one not used in the division) and check for the comparison
to be done against same precision cast of the argument (because
division's result is unsigned and the argument is signed).
But as shown in this PR, one can write it equally as comparison done in
the signed type, i.e. compare division's result cast to corresponding
signed type against the argument.

The following patch handles even those cases.

2023-05-19  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/105776
* tree-ssa-math-opts.cc (arith_overflow_check_p): If cast_stmt is
non-NULL, allow division statement to have a cast as single imm use
rather than comparison/condition.
(match_arith_overflow): In that case remove the cast stmt in addition
to the division statement.

* gcc.target/i386/pr105776.c: New test.

12 months agotree-ssa-math-opts: Pattern recognize hand written __builtin_mul_overflow_p with...
Jakub Jelinek [Fri, 19 May 2023 10:57:31 +0000 (12:57 +0200)] 
tree-ssa-math-opts: Pattern recognize hand written __builtin_mul_overflow_p with same unsigned types even when target just has highpart umul [PR101856]

As can be seen on the following testcase, we pattern recognize it on
i?86/x86_64 as return __builtin_mul_overflow_p (x, y, 0UL) and avoid
that way the extra division, but don't do it e.g. on aarch64 or ppc64le,
even when return __builtin_mul_overflow_p (x, y, 0UL); actually produces
there better code.  The reason for testing the presence of the optab
handler is to make sure the generated code for it is short to ensure
we don't actually pessimize code instead of optimizing it.
But, we have one case that the internal-fn.cc .MUL_OVERFLOW expansion
handles nicely, and that is when arguments/result is the same mode
TYPE_UNSIGNED type, we only use IMAGPART_EXPR of it (i.e.
__builtin_mul_overflow_p rather than __builtin_mul_overflow) and
umul_highpart_optab supports the particular mode, in that case
we emit comparison of the highpart umul result against zero.

So, the following patch matches what we do in internal-fn.cc and
also pattern matches __builtin_mul_overflow_p if
1) we only need the flag whether it overflowed (i.e. !use_seen)
2) it is unsigned (i.e. !cast_stmt)
3) umul_highpart is supported for the mode

2023-05-19  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/101856
* tree-ssa-math-opts.cc (match_arith_overflow): Pattern detect
unsigned __builtin_mul_overflow_p even when umulv4_optab doesn't
support it but umul_highpart_optab does.

* gcc.dg/tree-ssa/pr101856.c: New test.

12 months agolibgomp: Fix up -static -fopenmp linking [PR109904]
Jakub Jelinek [Fri, 19 May 2023 08:13:14 +0000 (10:13 +0200)] 
libgomp: Fix up -static -fopenmp linking [PR109904]

When an OpenMP program with target regions is linked statically,
it fails to link on various arches (doesn't when using recent glibc
because it has libdl stuff in libc), because libgomp.a(target.o) uses
dlopen/dlsym/dlclose, but we aren't linking against -ldl (unless
user asked for that).  We already have libgomp.spec so that we
can supply extra libraries to link against in the -static case,
this patch adds -ldl to that if plugins are supported.

2023-05-19  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/109904
* configure.ac (link_gomp): Include also $DL_LIBS.
* configure: Regenerated.

12 months agolibstdc++: Move lafstern.org reference to https
Gerald Pfeifer [Fri, 19 May 2023 08:12:09 +0000 (10:12 +0200)] 
libstdc++: Move lafstern.org reference to https

libstdc++-v3/ChangeLog:

* doc/xml/manual/strings.xml: Move lafstern.org reference to https.
* doc/html/manual/strings.html: Regenerate.

12 months agoDarwin, libgcc : Adjust min version supported for the OS.
Iain Sandoe [Thu, 11 May 2023 22:24:02 +0000 (23:24 +0100)] 
Darwin, libgcc : Adjust min version supported for the OS.

Tools from later versions of the OS deprecate or fail to support
earlier OS revisions.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libgcc/ChangeLog:

* config.host: Arrange to set min Darwin OS versions from
the configured host version.
* config/darwin10-unwind-find-enc-func.c: Do not use current
headers, but declare the nexessary structures locally to the
versions in use for Mac OSX 10.6.
* config/t-darwin: Amend to handle configured min OS
versions.
* config/t-darwin-min-1: New.
* config/t-darwin-min-5: New.
* config/t-darwin-min-8: New.

12 months agoFix internal error on small array with negative lower bound
Eric Botcazou [Fri, 19 May 2023 07:00:11 +0000 (09:00 +0200)] 
Fix internal error on small array with negative lower bound

Ada supports arrays with negative indices, although the internal index type
is sizetype like in other languages, which is unsigned.  This means that
negative values are represented by very large numbers, which works with a
bit of care.  This plugs a small loophole in output_constructor_bitfield.

gcc/
* varasm.cc (output_constructor_bitfield): Call tree_to_uhwi instead
of tree_to_shwi on array indices.  Minor tweaks.

gcc/testsuite/
* gnat.dg/specs/array6.ads: New test.

12 months agoc: Do not allow thread-local tentative definitions for C2x
Joseph Myers [Fri, 19 May 2023 00:42:07 +0000 (00:42 +0000)] 
c: Do not allow thread-local tentative definitions for C2x

C2x makes it clear that thread-local declarations can never be
tentative definitions (the legacy feature of C where you can e.g. do
"int i;" more than once at file scope, possibly with one of the
declarations initialized, and it counts as exactly one definition),
but are always definitions in the absence of "extern".  The wording
about external definitions was unclear in the thread-local case in C11
/ C17 (both about what counts as a tentative definition, and what is a
"definition" at all), not having been updated to cover the addition of
thread-local storage.

Implement this C2x requirement.  Arguably this is a defect fix that
would be appropriate to apply for all standard versions, but for now
the change is conditional on flag_isoc2x (however, it doesn't handle
_Thread_local / thread_local any different from GNU __thread).  Making
the change unconditional results in various TLS tests failing to
compile (gcc.dg/c11-thread-local-1.c gcc.dg/tls/thr-init-1.c
gcc.dg/tls/thr-init-2.c gcc.dg/torture/tls/thr-init-2.c
objc.dg/torture/tls/thr-init.m), though it's not clear if those tests
reflect any real code similarly trying to make use of thread-local
tentative definitions.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c/
* c-decl.cc (diagnose_mismatched_decls): Do not handle
thread-local declarations as tentative definitions for C2x.
(finish_decl): Do not allow thread-local definition with
incomplete type for C2x.

gcc/testsuite/
* gcc.dg/c2x-thread-local-2.c: New test.

12 months agoDaily bump.
GCC Administrator [Fri, 19 May 2023 00:17:43 +0000 (00:17 +0000)] 
Daily bump.

12 months agogcc: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 23:03:40 +0000 (01:03 +0200)] 
gcc: use _P() defines from tree.h

gcc/ChangeLog:

* alias.cc (ref_all_alias_ptr_type_p): Use _P() defines from tree.h.
* attribs.cc (diag_attr_exclusions): Ditto.
(decl_attributes): Ditto.
(build_type_attribute_qual_variant): Ditto.
* builtins.cc (fold_builtin_carg): Ditto.
(fold_builtin_next_arg): Ditto.
(do_mpc_arg2): Ditto.
* cfgexpand.cc (expand_return): Ditto.
* cgraph.h (decl_in_symtab_p): Ditto.
(symtab_node::get_create): Ditto.
* dwarf2out.cc (base_type_die): Ditto.
(implicit_ptr_descriptor): Ditto.
(gen_array_type_die): Ditto.
(gen_type_die_with_usage): Ditto.
(optimize_location_into_implicit_ptr): Ditto.
* expr.cc (do_store_flag): Ditto.
* fold-const.cc (negate_expr_p): Ditto.
(fold_negate_expr_1): Ditto.
(fold_convert_const): Ditto.
(fold_convert_loc): Ditto.
(constant_boolean_node): Ditto.
(fold_binary_op_with_conditional_arg): Ditto.
(build_fold_addr_expr_with_type_loc): Ditto.
(fold_comparison): Ditto.
(fold_checksum_tree): Ditto.
(tree_unary_nonnegative_warnv_p): Ditto.
(integer_valued_real_unary_p): Ditto.
(fold_read_from_constant_string): Ditto.
* gcc-rich-location.cc (maybe_range_label_for_tree_type_mismatch::get_text): Ditto.
* gimple-expr.cc (useless_type_conversion_p): Ditto.
(is_gimple_reg): Ditto.
(is_gimple_asm_val): Ditto.
(mark_addressable): Ditto.
* gimple-expr.h (is_gimple_variable): Ditto.
(virtual_operand_p): Ditto.
* gimple-ssa-warn-access.cc (pass_waccess::check_dangling_stores): Ditto.
* gimplify.cc (gimplify_bind_expr): Ditto.
(gimplify_return_expr): Ditto.
(gimple_add_padding_init_for_auto_var): Ditto.
(gimplify_addr_expr): Ditto.
(omp_add_variable): Ditto.
(omp_notice_variable): Ditto.
(omp_get_base_pointer): Ditto.
(omp_strip_components_and_deref): Ditto.
(omp_strip_indirections): Ditto.
(omp_accumulate_sibling_list): Ditto.
(omp_build_struct_sibling_lists): Ditto.
(gimplify_adjust_omp_clauses_1): Ditto.
(gimplify_adjust_omp_clauses): Ditto.
(gimplify_omp_for): Ditto.
(goa_lhs_expr_p): Ditto.
(gimplify_one_sizepos): Ditto.
* graphite-scop-detection.cc (scop_detection::graphite_can_represent_scev): Ditto.
* ipa-devirt.cc (odr_types_equivalent_p): Ditto.
* ipa-prop.cc (ipa_set_jf_constant): Ditto.
(propagate_controlled_uses): Ditto.
* ipa-sra.cc (type_prevails_p): Ditto.
(scan_expr_access): Ditto.
* optabs-tree.cc (optab_for_tree_code): Ditto.
* toplev.cc (wrapup_global_declaration_1): Ditto.
* trans-mem.cc (transaction_invariant_address_p): Ditto.
* tree-cfg.cc (verify_types_in_gimple_reference): Ditto.
(verify_gimple_comparison): Ditto.
(verify_gimple_assign_binary): Ditto.
(verify_gimple_assign_single): Ditto.
* tree-complex.cc (get_component_ssa_name): Ditto.
* tree-emutls.cc (lower_emutls_2): Ditto.
* tree-inline.cc (copy_tree_body_r): Ditto.
(estimate_move_cost): Ditto.
(copy_decl_for_dup_finish): Ditto.
* tree-nested.cc (convert_nonlocal_omp_clauses): Ditto.
(note_nonlocal_vla_type): Ditto.
(convert_local_omp_clauses): Ditto.
(remap_vla_decls): Ditto.
(fixup_vla_decls): Ditto.
* tree-parloops.cc (loop_has_vector_phi_nodes): Ditto.
* tree-pretty-print.cc (print_declaration): Ditto.
(print_call_name): Ditto.
* tree-sra.cc (compare_access_positions): Ditto.
* tree-ssa-alias.cc (compare_type_sizes): Ditto.
* tree-ssa-ccp.cc (get_default_value): Ditto.
* tree-ssa-coalesce.cc (populate_coalesce_list_for_outofssa): Ditto.
* tree-ssa-dom.cc (reduce_vector_comparison_to_scalar_comparison): Ditto.
* tree-ssa-forwprop.cc (can_propagate_from): Ditto.
* tree-ssa-propagate.cc (may_propagate_copy): Ditto.
* tree-ssa-sccvn.cc (fully_constant_vn_reference_p): Ditto.
* tree-ssa-sink.cc (statement_sink_location): Ditto.
* tree-ssa-structalias.cc (type_must_have_pointers): Ditto.
* tree-ssa-ter.cc (find_replaceable_in_bb): Ditto.
* tree-ssa-uninit.cc (warn_uninit): Ditto.
* tree-ssa.cc (maybe_rewrite_mem_ref_base): Ditto.
(non_rewritable_mem_ref_base): Ditto.
* tree-streamer-in.cc (lto_input_ts_type_non_common_tree_pointers): Ditto.
* tree-streamer-out.cc (write_ts_type_non_common_tree_pointers): Ditto.
* tree-vect-generic.cc (do_binop): Ditto.
(do_cond): Ditto.
* tree-vect-stmts.cc (vect_init_vector): Ditto.
* tree-vector-builder.h (tree_vector_builder::note_representative): Ditto.
* tree.cc (sign_mask_for): Ditto.
(verify_type_variant): Ditto.
(gimple_canonical_types_compatible_p): Ditto.
(verify_type): Ditto.
* ubsan.cc (get_ubsan_type_info_for_type): Ditto.
* var-tracking.cc (prepare_call_arguments): Ditto.
(vt_add_function_parameters): Ditto.
* varasm.cc (decode_addr_const): Ditto.

12 months agoomp: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 23:02:58 +0000 (01:02 +0200)] 
omp: use _P() defines from tree.h

gcc/ChangeLog:

* omp-low.cc (scan_sharing_clauses): Use _P() defines from tree.h.
(lower_reduction_clauses): Ditto.
(lower_send_clauses): Ditto.
(lower_omp_task_reductions): Ditto.
* omp-oacc-neuter-broadcast.cc (install_var_field): Ditto.
(worker_single_copy): Ditto.
* omp-offload.cc (oacc_rewrite_var_decl): Ditto.
* omp-simd-clone.cc (plausible_type_for_simd_clone): Ditto.

12 months agoobjc: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 23:00:00 +0000 (01:00 +0200)] 
objc: use _P() defines from tree.h

gcc/objc/ChangeLog:

* objc-act.cc (objc_volatilize_decl): Use _P() defines from tree.h.
(objc_is_global_reference_p): Ditto.
(objc_generate_write_barrier): Ditto.
(objc_gimplify_property_ref): Ditto.
* objc-next-runtime-abi-01.cc (next_runtime_abi_01_receiver_is_class_object): Ditto.
* objc-next-runtime-abi-02.cc (next_runtime_abi_02_receiver_is_class_object): Ditto.
(next_runtime_abi_02_build_objc_method_call): Ditto.

12 months agoc: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:54:54 +0000 (00:54 +0200)] 
c: use _P() defines from tree.h

gcc/c-family/ChangeLog:

* c-ada-spec.cc (has_static_fields): Use _P() defines from tree.h.
(dump_ada_declaration): Ditto.
(dump_ada_structure): Ditto.
* c-common.cc (unsafe_conversion_p): Ditto.
(shorten_compare): Ditto.
(pointer_int_sum): Ditto.
(c_common_truthvalue_conversion): Ditto.
(scalar_to_vector): Ditto.
* c-common.h (gnu_vector_type_p): Ditto.
* c-omp.cc (c_omp_depend_t_p): Ditto.
(c_omp_split_clauses): Ditto.
* c-ubsan.cc (ubsan_instrument_division): Ditto.
* c-warn.cc (conversion_warning): Ditto.
(warnings_for_convert_and_check): Ditto.

gcc/c/ChangeLog:

* c-convert.cc (c_convert): Ditto.
* c-decl.cc (merge_decls): Ditto.
* c-parser.cc (c_parser_omp_clause_reduction): Ditto.
(c_parser_omp_declare_reduction): Ditto.
* c-typeck.cc (build_component_ref): Ditto.
(convert_argument): Ditto.
(pointer_diff): Ditto.
(build_unary_op): Ditto.
(build_c_cast): Ditto.
(build_modify_expr): Ditto.
(store_init_value): Ditto.
(constexpr_init_fits_real_type): Ditto.
(check_constexpr_init): Ditto.
(c_finish_return): Ditto.
(handle_omp_array_sections_1): Ditto.
(c_finish_omp_clauses): Ditto.
* gimple-parser.cc (c_finish_gimple_return): Ditto.

libcc1/ChangeLog:

* libcc1plugin.cc (plugin_float_type): Ditto.
* libcp1plugin.cc (plugin_reactivate_decl): Ditto.
(plugin_get_float_type): Ditto.

12 months agofortran: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:50:55 +0000 (00:50 +0200)] 
fortran: use _P() defines from tree.h

gcc/fortran/ChangeLog:

* trans-array.cc (is_pointer_array): Use _P() defines from tree.h.
(gfc_conv_scalarized_array_ref): Ditto.
(gfc_conv_array_ref): Ditto.
* trans-decl.cc (gfc_finish_decl): Ditto.
(gfc_get_symbol_decl): Ditto.
* trans-expr.cc (gfc_trans_pointer_assignment): Ditto.
(gfc_trans_arrayfunc_assign): Ditto.
(gfc_trans_assignment_1): Ditto.
* trans-intrinsic.cc (gfc_conv_intrinsic_minmax): Ditto.
(conv_intrinsic_ieee_value): Ditto.
* trans-io.cc (gfc_convert_array_to_string): Ditto.
* trans-openmp.cc (gfc_omp_is_optional_argument): Ditto.
(gfc_trans_omp_clauses): Ditto.
* trans-stmt.cc (gfc_conv_label_variable): Ditto.
* trans.cc (gfc_build_addr_expr): Ditto.
(get_array_span): Ditto.

12 months agod: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:49:14 +0000 (00:49 +0200)] 
d: use _P() defines from tree.h

gcc/d/ChangeLog:

* d-codegen.cc (underlying_complex_expr): Use _P defines from tree.h.
* d-convert.cc (convert): Ditto.
(convert_for_rvalue): Ditto.

12 months agolto: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:48:07 +0000 (00:48 +0200)] 
lto: use _P() defines from tree.h

gcc/ChangeLog:

* lto-streamer-in.cc (lto_input_var_decl_ref): Use _P defines from
tree.h.
(lto_read_body_or_constructor): Ditto.
* lto-streamer-out.cc (tree_is_indexable): Ditto.
(lto_output_var_decl_ref): Ditto.
(DFS::DFS_write_tree_body): Ditto.
(wrap_refs): Ditto.
(write_symbol_extension_info): Ditto.

gcc/lto/ChangeLog:

* lto-common.cc (lto_maybe_register_decl): Use _P defines from tree.h.
* lto-symtab.cc (warn_type_compatibility_p): Ditto.
(lto_symtab_resolve_replaceable_p): Ditto.
(lto_symtab_merge_decls_1): Ditto.
* lto-symtab.h (lto_symtab_prevailing_decl): Ditto.

12 months agom2: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:45:35 +0000 (00:45 +0200)] 
m2: use _P() defines from tree.h

gcc/m2/ChangeLog:

* gm2-gcc/m2builtins.cc (doradix): Use _P defines from tree.h.
(doplaces): Ditto.
(doexponentmin): Ditto.
(doexponentmax): Ditto.
(dolarge): Ditto.
(dosmall): Ditto.
(dogUnderflow): Ditto.
* gm2-gcc/m2convert.cc (unsafe_conversion_p): Ditto.
* gm2-gcc/m2expr.cc (m2expr_build_unary_op_check): Ditto.
(m2expr_build_binary_op_check): Ditto.
* gm2-gcc/m2tree.cc (m2tree_is_var): Ditto.
* gm2-gcc/m2treelib.cc (build_modify_expr): Ditto.
* gm2-gcc/m2type.cc (gm2_finish_decl): Ditto.
* m2pp.cc (hextree): Ditto.
(m2pp_call_expr): Ditto.

12 months agoc++: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:44:12 +0000 (00:44 +0200)] 
c++: use _P() defines from tree.h

gcc/cp/ChangeLog:

* call.cc (promoted_arithmetic_type_p): Use _P defines from tree.h.
(build_conditional_expr): Ditto.
(convert_like_internal): Ditto.
(convert_arg_to_ellipsis): Ditto.
(build_over_call): Ditto.
(compare_ics): Ditto.
* class.cc (is_empty_base_ref): Ditto.
* coroutines.cc (rewrite_param_uses): Ditto.
* cp-tree.h (DECL_DISCRIMINATOR_P): Ditto.
(ARITHMETIC_TYPE_P): Ditto.
* cvt.cc (ocp_convert): Ditto.
* cxx-pretty-print.cc (pp_cxx_template_argument_list): Ditto.
* decl.cc (layout_var_decl): Ditto.
(get_tuple_size): Ditto.
* error.cc (dump_simple_decl): Ditto.
* lambda.cc (start_lambda_scope): Ditto.
* mangle.cc (write_template_arg): Ditto.
* method.cc (spaceship_comp_cat): Ditto.
* module.cc (node_template_info): Ditto.
(trees_out::start): Ditto.
(trees_out::decl_node): Ditto.
(trees_in::read_var_def): Ditto.
(set_instantiating_module): Ditto.
* name-lookup.cc (maybe_record_mergeable_decl): Ditto.
(consider_decl): Ditto.
(maybe_add_fuzzy_decl): Ditto.
* pt.cc (convert_nontype_argument): Ditto.
* semantics.cc (handle_omp_array_sections_1): Ditto.
(finish_omp_clauses): Ditto.
(finish_omp_target_clauses_r): Ditto.
(is_this_parameter): Ditto.
* tree.cc (build_cplus_array_type): Ditto.
(is_this_expression): Ditto.
* typeck.cc (do_warn_enum_conversions): Ditto.
* typeck2.cc (store_init_value): Ditto.
(check_narrowing): Ditto.

12 months agogcc/config/*: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:38:33 +0000 (00:38 +0200)] 
gcc/config/*: use _P() defines from tree.h

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_short_vector_p): Use _P
defines from tree.h.
(aarch64_mangle_type): Ditto.
* config/alpha/alpha.cc (alpha_in_small_data_p): Ditto.
(alpha_gimplify_va_arg_1): Ditto.
* config/arc/arc.cc (arc_encode_section_info): Ditto.
(arc_is_aux_reg_p): Ditto.
(arc_is_uncached_mem_p): Ditto.
(arc_handle_aux_attribute): Ditto.
* config/arm/arm.cc (arm_handle_isr_attribute): Ditto.
(arm_handle_cmse_nonsecure_call): Ditto.
(arm_set_default_type_attributes): Ditto.
(arm_is_segment_info_known): Ditto.
(arm_mangle_type): Ditto.
* config/arm/unknown-elf.h (IN_NAMED_SECTION_P): Ditto.
* config/avr/avr.cc (avr_lookup_function_attribute1): Ditto.
(avr_decl_absdata_p): Ditto.
(avr_insert_attributes): Ditto.
(avr_section_type_flags): Ditto.
(avr_encode_section_info): Ditto.
* config/bfin/bfin.cc (bfin_handle_l2_attribute): Ditto.
* config/bpf/bpf.cc (bpf_core_compute): Ditto.
* config/c6x/c6x.cc (c6x_in_small_data_p): Ditto.
* config/csky/csky.cc (csky_handle_isr_attribute): Ditto.
(csky_mangle_type): Ditto.
* config/darwin-c.cc (darwin_pragma_unused): Ditto.
* config/darwin.cc (is_objc_metadata): Ditto.
* config/epiphany/epiphany.cc (epiphany_function_ok_for_sibcall): Ditto.
* config/epiphany/epiphany.h (ROUND_TYPE_ALIGN): Ditto.
* config/frv/frv.cc (frv_emit_movsi): Ditto.
* config/gcn/gcn-tree.cc (gcn_lockless_update): Ditto.
* config/gcn/gcn.cc (gcn_asm_output_symbol_ref): Ditto.
* config/h8300/h8300.cc (h8300_encode_section_info): Ditto.
* config/i386/i386-expand.cc: Ditto.
* config/i386/i386.cc (type_natural_mode): Ditto.
(ix86_function_arg): Ditto.
(ix86_data_alignment): Ditto.
(ix86_local_alignment): Ditto.
(ix86_simd_clone_compute_vecsize_and_simdlen): Ditto.
* config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Ditto.
(i386_pe_type_dllexport_p): Ditto.
(i386_pe_adjust_class_at_definition): Ditto.
* config/i386/winnt.cc (i386_pe_determine_dllimport_p): Ditto.
(i386_pe_binds_local_p): Ditto.
(i386_pe_section_type_flags): Ditto.
* config/ia64/ia64.cc (ia64_encode_section_info): Ditto.
(ia64_gimplify_va_arg): Ditto.
(ia64_in_small_data_p): Ditto.
* config/iq2000/iq2000.cc (iq2000_function_arg): Ditto.
* config/lm32/lm32.cc (lm32_in_small_data_p): Ditto.
* config/loongarch/loongarch.cc (loongarch_handle_model_attribute): Ditto.
* config/m32c/m32c.cc (m32c_insert_attributes): Ditto.
* config/mcore/mcore.cc (mcore_mark_dllimport): Ditto.
(mcore_encode_section_info): Ditto.
* config/microblaze/microblaze.cc (microblaze_elf_in_small_data_p): Ditto.
* config/mips/mips.cc (mips_output_aligned_decl_common): Ditto.
* config/mmix/mmix.cc (mmix_encode_section_info): Ditto.
* config/nvptx/nvptx.cc (nvptx_encode_section_info): Ditto.
(pass_in_memory): Ditto.
(nvptx_generate_vector_shuffle): Ditto.
(nvptx_lockless_update): Ditto.
* config/pa/pa.cc (pa_function_arg_padding): Ditto.
(pa_function_value): Ditto.
(pa_function_arg): Ditto.
* config/pa/pa.h (IN_NAMED_SECTION_P): Ditto.
(TEXT_SPACE_P): Ditto.
* config/pa/som.h (MAKE_DECL_ONE_ONLY): Ditto.
* config/pdp11/pdp11.cc (pdp11_return_in_memory): Ditto.
* config/riscv/riscv.cc (riscv_in_small_data_p): Ditto.
(riscv_mangle_type): Ditto.
* config/rl78/rl78.cc (rl78_insert_attributes): Ditto.
(rl78_addsi3_internal): Ditto.
* config/rs6000/aix.h (ROUND_TYPE_ALIGN): Ditto.
* config/rs6000/darwin.h (ROUND_TYPE_ALIGN): Ditto.
* config/rs6000/freebsd64.h (ROUND_TYPE_ALIGN): Ditto.
* config/rs6000/linux64.h (ROUND_TYPE_ALIGN): Ditto.
* config/rs6000/rs6000-call.cc (rs6000_function_arg_boundary): Ditto.
(rs6000_function_arg_advance_1): Ditto.
(rs6000_function_arg): Ditto.
(rs6000_pass_by_reference): Ditto.
* config/rs6000/rs6000-logue.cc (rs6000_function_ok_for_sibcall): Ditto.
* config/rs6000/rs6000.cc (rs6000_data_alignment): Ditto.
(rs6000_set_default_type_attributes): Ditto.
(rs6000_elf_in_small_data_p): Ditto.
(IN_NAMED_SECTION): Ditto.
(rs6000_xcoff_encode_section_info): Ditto.
(rs6000_function_value): Ditto.
(invalid_arg_for_unprototyped_fn): Ditto.
* config/s390/s390-c.cc (s390_fn_types_compatible): Ditto.
(s390_vec_n_elem): Ditto.
* config/s390/s390.cc (s390_check_type_for_vector_abi): Ditto.
(s390_function_arg_integer): Ditto.
(s390_return_in_memory): Ditto.
(s390_encode_section_info): Ditto.
* config/sh/sh.cc (sh_gimplify_va_arg_expr): Ditto.
(sh_function_value): Ditto.
* config/sol2.cc (solaris_insert_attributes): Ditto.
* config/sparc/sparc.cc (function_arg_slotno): Ditto.
* config/sparc/sparc.h (ROUND_TYPE_ALIGN): Ditto.
* config/stormy16/stormy16.cc (xstormy16_encode_section_info): Ditto.
(xstormy16_handle_below100_attribute): Ditto.
* config/v850/v850.cc (v850_encode_section_info): Ditto.
(v850_insert_attributes): Ditto.
* config/visium/visium.cc (visium_pass_by_reference): Ditto.
(visium_return_in_memory): Ditto.
* config/xtensa/xtensa.cc (xtensa_multibss_section_type_flags): Ditto.

12 months agoanalyzer: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:37:46 +0000 (00:37 +0200)] 
analyzer: use _P() defines from tree.h

gcc/analyzer/ChangeLog:

* region-model-manager.cc (get_code_for_cast): Use _P defines from
tree.h.
(region_model_manager::get_or_create_cast): Ditto.
(region_model_manager::get_region_for_global): Ditto.
* region-model.cc (region_model::get_lvalue_1): Ditto.
* region.cc (decl_region::maybe_get_constant_value): Ditto.

12 months agoada: use _P() defines from tree.h
Bernhard Reutner-Fischer [Sat, 13 May 2023 22:35:12 +0000 (00:35 +0200)] 
ada: use _P() defines from tree.h

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_entity): Use _P defines
from tree.h.
(constructor_address_p): Ditto.
(elaborate_expression_1): Ditto.
* gcc-interface/trans.cc (Identifier_to_gnu): Ditto.
(is_nrv_p): Ditto.
(Subprogram_Body_to_gnu): Ditto.
(gnat_to_gnu): Ditto.
(gnat_to_gnu_external): Ditto.
(add_decl_expr): Ditto.
(gnat_gimplify_expr): Ditto.
* gcc-interface/utils.cc (create_var_decl): Ditto.
* gcc-interface/utils2.cc (get_base_type): Ditto.
(build_binary_op): Ditto.
(build_unary_op): Ditto.
(gnat_protect_expr): Ditto.
(gnat_invariant_expr): Ditto.