]> gcc.gnu.org Git - gcc.git/log
gcc.git
2 months agoada: Adapt proof of runtime units
Yannick Moy [Fri, 12 Jan 2024 11:30:38 +0000 (11:30 +0000)]
ada: Adapt proof of runtime units

Restore proof of runtime units after changes in SPARK.

gcc/ada/

* libgnat/a-strsea.adb (Index): Add assertions.
* libgnat/a-strsup.ads ("="): Remove useless precondition.
* libgnat/s-aridou.adb (Prove_Rounding_Case): Add assertions.
(Lemma_Shift_Right): Add call to lemma.
* libgnat/s-arit32.adb (Prove_Rounding_Case): Add assertion.
(Prove_ Signs): Add assertions.
(Scaled_Divide32): Add assertions.

2 months agoUpdate copyright years.
Marc Poulhiès [Fri, 12 Jan 2024 08:46:00 +0000 (09:46 +0100)]
Update copyright years.

2 months agoada: Improve pragma No_Return's pre-Ada2022 handling of functions
Steve Baird [Tue, 19 Dec 2023 00:17:40 +0000 (16:17 -0800)]
ada: Improve pragma No_Return's pre-Ada2022 handling of functions

Ada 2022 allows pragma No_Return to apply to a function (or a generic function).
For earlier Ada versions, if a No_Return pragma argument's possible
resolutions include a function (or a generic function) then we want to ignore
that candidate if a non-function candidate is also available and otherwise
to generate an error message mentioning that this is an Ada 2022 feature.

gcc/ada/

* sem_prag.adb (Analyze_Pragma): Restructure the loop over
possible resolutions of a No_Return pragma's argument so that
functions (and generic functions) are not processed until after it
is known whether there is a non-function candidate resolution. For
a pre-2022 Ada version, terminate the iteration before processing
functions if a non-function resolution is found.

2 months agoada: Fix LTO type mismatches in GNAT.Sockets.Thin
Eric Botcazou [Tue, 9 Jan 2024 15:25:09 +0000 (16:25 +0100)]
ada: Fix LTO type mismatches in GNAT.Sockets.Thin

The default implementation of GNAT.Sockets.Thin is mainly used on Linux and
the socklen_t type used in various routines of the BSD sockets C API is a
typedef for unsigned int there, so importing it as Interface.C.int will be
flagged as a type mismatch during LTO compilation.

gcc/ada/

* libgnat/g-socthi.ads (C_Bind): Turn into inline function.
(C_Getpeername): Likewise.
(C_Getsockname): Likewise.
(C_Getsockopt): Likewise.
(C_Setsockopt): Likewise.
(Nonreentrant_Gethostbyaddr): Likewise.
* libgnat/g-socthi.adb (Syscall_Accept): Adjust profile.
(Syscall_Connect): Likewise.
(Syscall_Recvfrom): Likewise.
(Syscall_Sendto): Likewise.
(C_Bind): New function.
(C_Accept): Adjust to above change for profiles.
(C_Connect): Likewise.
(C_Getpeername): New function.
(C_Getsockname): Likewise.
(C_Getsockopt): Likewise.
(C_Recvfrom):  Adjust to above change for profiles.
(C_Setsockopt): New function.
(Nonreentrant_Gethostbyaddr): Likewise.

2 months agoada: Aspects on multiple component declarations
Bob Duff [Tue, 9 Jan 2024 12:59:22 +0000 (07:59 -0500)]
ada: Aspects on multiple component declarations

This patch fixes a bug where aspect specifications were ignored
on all but the last of multiple component declarations.
For example, in a record type with components "X, Y: T with Volatile;"
only Y was marked Volatile; X was not. Both should be marked Volatile.

The fix is in Par.Ch3.P_Component_Items, where P_Aspect_Specifications
needs to be called each time through the loop.

In addition, various minor cleanups.

gcc/ada/

* par-ch3.adb (P_Component_Items): Move P_Aspect_Specifications
into the loop, so aspects can be attached to multiple component
declarations.
(P_Type_Declaration, P_Subtype_Declaration)
(P_Known_Discriminant_Part_Opt): Remove default for Semicolon in
calls to P_Aspect_Specifications.
* gen_il-gen-gen_nodes.adb (N_Discriminant_Specification): Add
Aspect_Specifications field to N_Discriminant_Specification, which
was missing.
* aspects.adb (Has_Aspect_Specifications_Flag): Make it True for
N_Discriminant_Specification.
* par-ch13.adb: Remove default for Semicolon in calls to
P_Aspect_Specifications.
(Get_Aspect_Specifications): Misc cleanup.
(P_Aspect_Specifications): Remove comment. It's not clear what
"the flag" is referring to, but anyway the first part of the
comment is obvious, and the second part is apparently obsolete.
Misc cleanup.
* par.adb (P_Aspect_Specifications, Get_Aspect_Specifications):
Remove default for Semicolon; calls are more readable that way.
Improve comments.
* par-ch12.adb: Remove default for Semicolon in calls to
P_Aspect_Specifications.
* par-ch6.adb: Likewise.
* par-ch7.adb: Likewise.
* par-ch9.adb: Likewise.
* par-endh.adb: Likewise.

2 months agoada: Bad internal naming when using pragma Compile_Time_Error
Justin Squirek [Tue, 9 Jan 2024 15:08:08 +0000 (15:08 +0000)]
ada: Bad internal naming when using pragma Compile_Time_Error

This patch fixes an error in the compiler whereby the presence of a condition
which tests the size of a type not known at compile time within an instance
of pragma Compile_Time_Error causes incorrect internal names to be generated
for said type during expansion.

gcc/ada/

* sem_prag.adb (Defer_Compile_Time_Warning_Error_To_BE): Better
handle itypes such that the tree copy required for the expansion
of the pragma doesn't cause ordering problems with internal names.

2 months agoada: Fix missing flag for GNATprove
Yannick Moy [Thu, 4 Jan 2024 13:18:04 +0000 (14:18 +0100)]
ada: Fix missing flag for GNATprove

GNATprove expects the frontend to position correctly range check
flags, on expressions which might lead to a range check failure.
This was missing on in-out parameters of calls. Now fixed.

There is no impact on compilation.

gcc/ada/

* sem_res.adb (Resolve_Actuals): Add range check flag.

2 months agoada: Fix spurious error on generic state in SPARK
Yannick Moy [Mon, 8 Jan 2024 08:53:58 +0000 (09:53 +0100)]
ada: Fix spurious error on generic state in SPARK

The public state of a generic package needs not be part of the state of
the enclosing unit, only the state of instantiations need to be accounted
for in the enclosing package. Now fixed.

gcc/ada/

* sem_util.adb (Find_Placement_In_State_Space): Stop search for
placement when reaching the public state of a generic package.

2 months agoada: Reject non-statically compatible extended return statement
Javier Miranda [Sun, 7 Jan 2024 13:37:15 +0000 (13:37 +0000)]
ada: Reject non-statically compatible extended return statement

Add missing check of RM 6.5(5.3/5): when the result subtype of the
function is defined by a subtype mark, the subtype defined by the
subtype indication of the extended return statement shall be
statically compatible with the result subtype of the function.

gcc/ada/

* sem_ch3.adb (Check_Return_Subtype_Indication): Add missing check
on statically compatible subtypes.
* sem_eval.adb (Subtypes_Statically_Compatible): Ensure that both
types are either scalar types or access types to evaluate this
predicate.

2 months agoada: Minor comment improvement
Bob Duff [Fri, 5 Jan 2024 22:18:43 +0000 (17:18 -0500)]
ada: Minor comment improvement

Clarify comment about selectors.

gcc/ada/

* sem_ch13.adb (Resolve_Name): Clarify comment.

2 months agoada: Fix bug in overloaded selected_components in aspect_specifications
Bob Duff [Fri, 5 Jan 2024 15:40:00 +0000 (10:40 -0500)]
ada: Fix bug in overloaded selected_components in aspect_specifications

This patch fixes a bug where if a selected_component X.Y appears in an
aspect_specification, and there are two or more overloaded Y's in X,
then it can choose the wrong one, leading to subsequent type errors.
It was always picking the last declaration of Y, and leaving Entity
set to that. We now reset Entity (as for the already-existing code
for N_Identifier just below).

Note that Resolve_Aspect_Expressions is called only for
aspect_specifications, and not even all aspect_specifications,
so the bug didn't occur for other names. For example,
Resolve_Aspect_Expressions is not called for aspect_specifications
in the visible part of a library package if there is no private part.

gcc/ada/

* sem_ch13.adb (Resolve_Name): This is called only for names in
aspect_specifications. If the name is an overloaded
selected_component, reset the Entity. Note that this was already
done for N_Identifier in the code just below.

2 months agoada: Fix Program_Error raised during generation of data representation in JSON
Eric Botcazou [Fri, 5 Jan 2024 11:04:17 +0000 (12:04 +0100)]
ada: Fix Program_Error raised during generation of data representation in JSON

This happens for the extension of a private discriminated tagged type.

gcc/ada/

* repinfo.adb (List_Record_Info.List_Structural_Record_Layout): Add
another guard for private types after retrieving the parent in the
extension case.

2 months agoada: SPARK rule changed on functions with side effects
Yannick Moy [Thu, 21 Dec 2023 16:38:21 +0000 (17:38 +0100)]
ada: SPARK rule changed on functions with side effects

SPARK RM definition of function with side effects now makes them
implicitly volatile functions.

gcc/ada/

* sem_util.adb (Is_Volatile_Function): Return True on functions
with side effects.

2 months agoada: Accept constants of access types as globals of side-effect function
Piotr Trojanek [Thu, 4 Jan 2024 18:58:07 +0000 (19:58 +0100)]
ada: Accept constants of access types as globals of side-effect function

Complete support for functions with side-effects.

gcc/ada/

* sem_prag.adb (Analyze_Global_Item): Handle side-effect
functions like procedures.

2 months agoada: Update comment about implicit inputs of Depends contract
Piotr Trojanek [Thu, 4 Jan 2024 18:26:12 +0000 (19:26 +0100)]
ada: Update comment about implicit inputs of Depends contract

Sync comment with the updated SPARK RM rules.

gcc/ada/

* sem_prag.adb (Collect_Global_Item): Update comment.

2 months agoMention that some options are turned on by `-Ofast` in their descriptions [PR97263]
Andrew Pinski [Mon, 6 May 2024 21:14:41 +0000 (14:14 -0700)]
Mention that some options are turned on by `-Ofast` in their descriptions [PR97263]

Like was done for -ffast-math in r0-105946-ga570fc16fa8056, we should
document that -Ofast enables -fmath-errno, -funsafe-math-optimizations,
-finite-math-only, -fno-trapping-math in their documentation.

Note this changes the stronger "must not" to be "is not" for -fno-trapping-math
since we do enable it for -Ofast already.

gcc/ChangeLog:

PR middle-end/97263
* doc/invoke.texi(fmath-errno): Document it is turned on
with -Ofast.
(funsafe-math-optimizations): Likewise.
(ffinite-math-only): Likewise.
(fno-trapping-math): Likewise and use less strong language.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 months agoExtend usdot_prodv*qi with vpmaddwd when AVXVNNI/AVX512VNNI is not available.
liuhongt [Mon, 8 Jan 2024 07:13:41 +0000 (15:13 +0800)]
Extend usdot_prodv*qi with vpmaddwd when AVXVNNI/AVX512VNNI is not available.

gcc/ChangeLog:

* config/i386/sse.md (usdot_prodv*qi): Extend to VI1_AVX512
with vpmaddwd when avxvnni/avx512vnni is not available.

2 months agoSupport dot_prod optabs for 64-bit vector.
liuhongt [Wed, 20 Dec 2023 03:43:25 +0000 (11:43 +0800)]
Support dot_prod optabs for 64-bit vector.

gcc/ChangeLog:

PR target/113079
* config/i386/mmx.md (usdot_prodv8qi): New expander.
(sdot_prodv8qi): Ditto.
(udot_prodv8qi): Ditto.
(usdot_prodv4hi): Ditto.
(udot_prodv4hi): Ditto.
(sdot_prodv4hi): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr113079.c: New test.
* gcc.target/i386/pr113079-2.c: New test.
* gcc.target/i386/sse4-pr113079-2.c: New test.

2 months agoOptimize 64-bit vector permutation with punpcklqdq + 128-bit vector pshuf.
liuhongt [Wed, 20 Dec 2023 03:54:43 +0000 (11:54 +0800)]
Optimize 64-bit vector permutation with punpcklqdq + 128-bit vector pshuf.

gcc/ChangeLog:

PR target/113090
* config/i386/i386-expand.cc
(expand_vec_perm_punpckldq_pshuf): New function.
(ix86_expand_vec_perm_const_1): Try
expand_vec_perm_punpckldq_pshuf for sequence of 2
instructions.

gcc/testsuite/ChangeLog:

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

2 months agopru: New validation pass for minrt
Dimitar Dimitrov [Fri, 9 Feb 2024 20:30:28 +0000 (22:30 +0200)]
pru: New validation pass for minrt

Add a new pru-specific pass to validate that the assumptions for the
minimal C runtime are not violated by the user program.

gcc/ChangeLog:

* config/pru/pru-passes.cc (class pass_pru_minrt_check): New
pass.
(pass_pru_minrt_check::execute): New method.
(make_pru_minrt_check): New function.
* config/pru/pru-passes.def (INSERT_PASS_AFTER): Register the
minrt check pass.
* config/pru/pru-protos.h (make_pru_minrt_check): Add
declaration.

gcc/testsuite/ChangeLog:

* g++.target/pru/minrt-1.cc: New test.
* g++.target/pru/minrt-2.cc: New test.
* g++.target/pru/minrt-3.cc: New test.
* g++.target/pru/pru.exp: New test.
* gcc.target/pru/minrt-1.c: New test.
* gcc.target/pru/minrt-2.c: New test.
* gcc.target/pru/minrt-3.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Refactor to use passes definition file
Dimitar Dimitrov [Sat, 9 Mar 2024 20:16:09 +0000 (22:16 +0200)]
pru: Refactor to use passes definition file

Switch to using a passes definition file instead of explicitly
registering the PRU-specific passes in pru.cc.  This would make it
cleaner to add new PRU-specific passes.

There are no functional changes.

gcc/ChangeLog:

* config/pru/pru-passes.cc (class pass_tiabi_check): Rename to
add "pru_" prefix.
(class pass_pru_tiabi_check): Ditto.
(pass_tiabi_check::execute): Ditto.
(pass_pru_tiabi_check::execute): Ditto.
(make_pru_tiabi_check): Ditto.
(pru_register_abicheck_pass): Remove.
* config/pru/pru-protos.h (pru_register_abicheck_pass): Remove.
(make_pru_tiabi_check): Add declaration.
* config/pru/pru.cc (pru_option_override): Remove explicit pass
registration.
* config/pru/t-pru: Register PRU passes definition file.
* config/pru/pru-passes.def: New file.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Use HOST_WIDE_INT_1U macro
Dimitar Dimitrov [Sat, 2 Mar 2024 13:05:12 +0000 (15:05 +0200)]
pru: Use HOST_WIDE_INT_1U macro

Use the HOST_WIDE_INT_1U macro instead of literal 1 when constructing
constants for RTL.

gcc/ChangeLog:

* config/pru/pru.md (lshrdi3): Use HOST_WIDE_INT_1U macro.
(ashldi3): Ditto.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Drop usage of ATTRIBUTE_UNUSED
Dimitar Dimitrov [Tue, 23 Jan 2024 20:03:33 +0000 (22:03 +0200)]
pru: Drop usage of ATTRIBUTE_UNUSED

Remove usage of ATTRIBUTE_UNUSED.  Instead remove the argument's name,
which in C++ means that the argument would not be used.

gcc/ChangeLog:

* config/pru/pru-passes.cc: Drop ATTRIBUTE_UNUSED and remove
argument's name.
* config/pru/pru-pragma.cc (pru_pragma_ctable_entry): Ditto.
* config/pru/pru.cc (pru_function_profiler): Ditto.
(pru_can_eliminate): Ditto.
(pru_rtx_costs): Ditto.
(pru_insert_attributes): Ditto.
(pru_function_value): Ditto.
(pru_libcall_value): Ditto.
(pru_return_in_memory): Ditto.
(pru_builtin_decl): Ditto.
(pru_expand_builtin): Ditto.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Skip register save if function will not return
Dimitar Dimitrov [Sat, 13 Jan 2024 20:29:57 +0000 (22:29 +0200)]
pru: Skip register save if function will not return

There is no need to store callee-saved registers in prologue if the
function would never return.  Size optimization is paramount for the
microcontroller-class PRU.

Some backends save some registers for noreturn functions.  But for PRU
debuggability is a less concern because GDB has not been ported yet
for PRU.

gcc/ChangeLog:

* config/pru/pru.cc (prologue_saved_reg_p): Skip saving
if function will not return.

gcc/testsuite/ChangeLog:

* gcc.target/pru/noreturn-prologue-1.c: New test.
* gcc.target/pru/noreturn-prologue-2.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Add pattern variants for zero extending destination
Dimitar Dimitrov [Fri, 29 Dec 2023 19:22:58 +0000 (21:22 +0200)]
pru: Add pattern variants for zero extending destination

The higher bits in the result of some ALU operations are inherently
always zero when all input operands are smaller than 32-bits.

Add pattern variants to match when the resulting value is zero
extended, so that all operations can be effectively executed in a
single instruction.  For PRU it simply means to use a wider register for
destination.

ALU operations which cannot be presented as zero-extending their
destination are addition, subtraction and logical shift left.  The PRU
ALU performs all operations in 32-bit mode, so the carry-out and
shifted-out bits would violate the assumption that ALU operation was
performed in 16-bit or 8-bit mode, and result was zero-extended.

gcc/ChangeLog:

* config/pru/alu-zext.md (_noz0): New subst attribute.
(<code>_impl): Allow zero-extending the destination.
(<shift_op>): Remove unified pattern
(ashl_impl): New distinct pattern.
(lshr_impl): Ditto.
(alu3_zext_op0_subst): New subst iterator to zero-extend the
destination register.

gcc/testsuite/ChangeLog:

* gcc.target/pru/extzv-1.c: Update to mark the new more
efficient generated code sequence.
* gcc.target/pru/extzv-2.c: Ditto.
* gcc.target/pru/extzv-3.c: Ditto.
* gcc.target/pru/zero_extend-op0.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Optimize the extzv and insv patterns
Dimitar Dimitrov [Sun, 19 Nov 2023 10:20:08 +0000 (12:20 +0200)]
pru: Optimize the extzv and insv patterns

Optimize the generated code for the bit-field extract and insert
patterns:
  - Use bit-set and bit-clear instructions for 1-bit fields.
  - Expand to SImode operations instead of relying on the default
    expansion to word (QI) mode.

gcc/ChangeLog:

* config/pru/pru.md (extzv<mode>): Make it an expand pattern,
handle efficiently zero-positioned bit-fields.
(insv<mode>): New expand pattern.

gcc/testsuite/ChangeLog:

* gcc.target/pru/ashiftrt.c: Minor update due to new (but
equivalent) generated code sequence.
* gcc.target/pru/extzv-1.c: New test.
* gcc.target/pru/extzv-2.c: New test.
* gcc.target/pru/extzv-3.c: New test.
* gcc.target/pru/insv-1.c: New test.
* gcc.target/pru/insv-2.c: New test.
* gcc.target/pru/insv-3.c: New test.
* gcc.target/pru/insv-4.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Implement zero fill for 64-bit registers
Dimitar Dimitrov [Sat, 18 Nov 2023 21:05:09 +0000 (23:05 +0200)]
pru: Implement zero fill for 64-bit registers

Loading a constant zero in a 64-bit register now takes one instead of
two instructions.

gcc/ChangeLog:

* config/pru/pru.md: New pattern alternative for zero-filling
64-bit registers.

gcc/testsuite/ChangeLog:

* gcc.target/pru/mov-0.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agopru: Implement TARGET_ADDRESS_COST
Dimitar Dimitrov [Sun, 22 Oct 2023 11:44:29 +0000 (14:44 +0300)]
pru: Implement TARGET_ADDRESS_COST

Stop relying on the default fallback to TARGET_RTX_COST for PRU's
addressing costs.  Implement TARGET_ADDRESS_COST, in order to allow RTX
cost refactoring in the future without affecting the addressing costs.

No code generation changes are expected by this patch.  No changes were
detected when running embench-iot and building a few real-world firmware
examples.

gcc/ChangeLog:

* config/pru/pru.cc (pru_address_cost): Implement address cost
calculation.
(TARGET_ADDRESS_COST): Define for PRU.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2 months agoUpdate gennews for GCC 14.
Jakub Jelinek [Tue, 7 May 2024 06:48:19 +0000 (08:48 +0200)]
Update gennews for GCC 14.

2024-05-07  Jakub Jelinek  <jakub@redhat.com>

* gennews (files): Add files for GCC 14.

2 months agotree-optimization/114921 - _Float16 -> __bf16 isn't noop fixup
Richard Biener [Mon, 6 May 2024 10:03:09 +0000 (12:03 +0200)]
tree-optimization/114921 - _Float16 -> __bf16 isn't noop fixup

The following further strengthens the check which convert expressions
we allow to vectorize as simple copy by resorting to
tree_nop_conversion_p on the vector components.

PR tree-optimization/114921
* tree-vect-stmts.cc (vectorizable_assignment): Use
tree_nop_conversion_p to identify converts we can vectorize
with a simple assignment.

2 months agoPR target/106060: Improved SSE vector constant materialization on x86.
Roger Sayle [Tue, 7 May 2024 06:14:40 +0000 (07:14 +0100)]
PR target/106060: Improved SSE vector constant materialization on x86.

This patch resolves PR target/106060 by providing efficient methods for
materializing/synthesizing special "vector" constants on x86.  Currently
there are three methods of materializing a vector constant; the most
general is to load a vector from the constant pool, secondly "duplicated"
constants can be synthesized by moving an integer between units and
broadcasting (of shuffling it), and finally the special cases of the
all-zeros vector and all-ones vectors can be loaded via a single SSE
instruction.   This patch handle additional cases that can be synthesized
in two instructions, loading an all-ones vector followed by another SSE
instruction.  Following my recent patch for PR target/112992, there's
conveniently a single place in i386-expand.cc where these special cases
can be handled.

Two examples are given in the original bugzilla PR for 106060.

__m256i should_be_cmpeq_abs ()
{
  return _mm256_set1_epi8 (1);
}

is now generated (with -O3 -march=x86-64-v3) as:

        vpcmpeqd        %ymm0, %ymm0, %ymm0
        vpabsb  %ymm0, %ymm0
        ret

and

__m256i should_be_cmpeq_add ()
{
  return _mm256_set1_epi8 (-2);
}

is now generated as:

        vpcmpeqd        %ymm0, %ymm0, %ymm0
        vpaddb  %ymm0, %ymm0, %ymm0
        ret

2024-05-07  Roger Sayle  <roger@nextmovesoftware.com>
    Hongtao Liu  <hongtao.liu@intel.com>

gcc/ChangeLog
PR target/106060
* config/i386/i386-expand.cc (enum ix86_vec_bcast_alg): New.
(struct ix86_vec_bcast_map_simode_t): New type for table below.
(ix86_vec_bcast_map_simode): Table of SImode constants that may
be efficiently synthesized by a ix86_vec_bcast_alg method.
(ix86_vec_bcast_map_simode_cmp): New comparator for bsearch.
(ix86_vector_duplicate_simode_const): Efficiently synthesize
V4SImode and V8SImode constants that duplicate special constants.
(ix86_vector_duplicate_value): Attempt to synthesize "special"
vector constants using ix86_vector_duplicate_simode_const.
* config/i386/i386.cc (ix86_rtx_costs) <case ABS>: ABS of a
vector integer mode costs with a single SSE instruction.

gcc/testsuite/ChangeLog
PR target/106060
* gcc.target/i386/auto-init-8.c: Update test case.
* gcc.target/i386/avx512fp16-13.c: Likewise.
* gcc.target/i386/pr100865-9a.c: Likewise.
* gcc.target/i386/pr101796-1.c: Likewise.
* gcc.target/i386/pr106060-1.c: New test case.
* gcc.target/i386/pr106060-2.c: Likewise.
* gcc.target/i386/pr106060-3.c: Likewise.
* gcc.target/i386/pr70314.c: Update test case.
* gcc.target/i386/vect-shiftv4qi.c: Likewise.
* gcc.target/i386/vect-shiftv8qi.c: Likewise.

2 months agoc++: Allow IS_FAKE_BASE_TYPE for union types [PR114954]
Nathaniel Shead [Mon, 6 May 2024 03:05:52 +0000 (13:05 +1000)]
c++: Allow IS_FAKE_BASE_TYPE for union types [PR114954]

In some circumstances, unions can also have an __as_base type; we need
to make sure that IS_FAKE_BASE_TYPE correctly recognises this.

PR c++/114954

gcc/cp/ChangeLog:

* cp-tree.h (IS_FAKE_BASE_TYPE): Also apply to unions.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr114954.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2 months agoc++/modules: Fix dangling pointer with imported_temploid_friends
Nathaniel Shead [Fri, 3 May 2024 09:36:17 +0000 (19:36 +1000)]
c++/modules: Fix dangling pointer with imported_temploid_friends

I got notified by Linaro CI and by checking testresults that there seems
to be some occasional failures in tpl-friend-4_b.C on some architectures
and standards modes since r15-59-gb5f6a56940e708.  I haven't been able
to reproduce but looking at the backtrace I suspect the issue is that
we're adding to the 'imported_temploid_friend' map a decl that is
ultimately discarded, which then has its address reused by a later decl
causing a failure in the assert in 'set_originating_module'.

This patch fixes the problem by ensuring 'imported_temploid_friends' is
correctly marked as a GTY root, and that 'duplicate_decls' properly
removes entries from the map for declarations that it frees.

PR c++/114275

gcc/cp/ChangeLog:

* cp-tree.h (remove_defining_module): Declare.
* decl.cc (duplicate_decls): Call remove_defining_module on
to-be-freed newdecl.
* module.cc (imported_temploid_friends): Mark as GTY root...
(init_modules): ...and allocate from ggc.
(trees_in::decl_value): Only track for declarations that won't
be discarded.
(remove_defining_module): New function.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
2 months agoDaily bump.
GCC Administrator [Tue, 7 May 2024 00:18:28 +0000 (00:18 +0000)]
Daily bump.

2 months ago[PATCH 1/1] RISC-V: Add Zfbfmin extension to the -march= option
Xiao Zeng [Mon, 6 May 2024 21:57:37 +0000 (15:57 -0600)]
[PATCH 1/1] RISC-V: Add Zfbfmin extension to the -march= option

This patch would like to add new sub extension (aka Zfbfmin) to the
-march= option. It introduces a new data type BF16.

1 The Zfbfmin extension depend on 'F', and the FLH, FSH, FMV.X.H, and
FMV.H.X instructions as defined in the Zfh extension.

2 The Zfhmin extension includes the following instructions from the
Zfh extension: FLH, FSH, FMV.X.H, FMV.H.X, FCVT.S.H, and FCVT.H.S.

3 Zfhmin extension depend on 'F'.

4 Simply put, just make Zfbfmin dependent on Zfhmin.

Perhaps in the future, we could propose making the FLH, FSH, FMV.X.H, and
FMV.H.X instructions an independent extension to achieve precise dependency
relationships for the Zfbfmin.

You can locate more information about Zfbfmin from below spec doc.

<https://github.com/riscv/riscv-bfloat16/releases/download/v59042fc71c31a9bcb2f1957621c960ed36fac401/riscv-bfloat16.pdf>

gcc/
* common/config/riscv/riscv-common.cc (riscv_implied_info): zfbfmin
implies zfhmin.
(riscv_ext_version_table, riscv_ext_flag_table): Add zfbfmin.
* config/riscv/riscv.opt (ZFBFMIN): Add optoion.

gcc/testsuite/
* gcc.target/riscv/arch-35.c: New test.
* gcc.target/riscv/arch-36.c: New test.
* gcc.target/riscv/predef-34.c: New test.
* gcc.target/riscv/predef-35.c: New test.

2 months agoaix: Fix building fat library for AIX
David Edelsohn [Sun, 5 May 2024 20:17:51 +0000 (16:17 -0400)]
aix: Fix building fat library for AIX

With the change in subdirectories, the code for libgfortran fat libraries
needs to be adjusted to explicitly reference the subdirectory.  AIX
creates fat library archives and the compiler itself can be built as
either 32 bit or 64 bit application and default code generation.  For
the two, alternate versions of the compiler to interoperate, GCC needs
to construct the fat libraries manually.

The Makefile fragment had been trying to leverage as much of the existing
targets and macros as possible.  With the subdirectory change, the
location of single.o is more obscured and cannot be determined without
libtool.  This patch references the location of the real object file
more explicitly.

Utilizing subst seems like overkill and unnecessary obscuration for a single
object file.  Either way, it's digging below the libtool abstraction layer.

This also fixes Fortran bootstrap on AIX.

Bootstrapped on powerpc-ibm-aix7.3.0.0

libgfortran/ChangeLog:

* config/t-aix (all-local, libcaf_single): Explicitly reference
caf/.libs/single.o

Signed-off-by: David Edelsohn <dje.gcc@gmail.com>
2 months agoRISC-V: Add testcase for PR114749.
Robin Dapp [Mon, 6 May 2024 21:51:37 +0000 (15:51 -0600)]
RISC-V: Add testcase for PR114749.

this adds a test case for PR114749.
Going to commit as obvious unless somebody complains.

Regards
 Robin

gcc/testsuite/ChangeLog:

PR tree-optimization/114749

* gcc.target/riscv/rvv/autovec/pr114749.c: New test.

2 months ago[RISC-V] Add support for _Bfloat16
Xiao Zeng [Mon, 6 May 2024 21:39:12 +0000 (15:39 -0600)]
[RISC-V] Add support for _Bfloat16

1 At point <https://github.com/riscv/riscv-bfloat16>,
  BF16 has already been completed "post public review".

2 LLVM has also added support for RISCV BF16 in
  <https://reviews.llvm.org/D151313> and
  <https://reviews.llvm.org/D150929>.

3 According to the discussion <https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/367>,
  this use __bf16 and use DF16b in riscv_mangle_type like x86.

Below test are passed for this patch
    * The riscv fully regression test.

gcc/ChangeLog:

* config/riscv/iterators.md: New mode iterator HFBF.
* config/riscv/riscv-builtins.cc (riscv_init_builtin_types):
Initialize data type _Bfloat16.
* config/riscv/riscv-modes.def (FLOAT_MODE): New.
(ADJUST_FLOAT_FORMAT): New.
* config/riscv/riscv.cc (riscv_mangle_type): Support for BFmode.
(riscv_scalar_mode_supported_p): Ditto.
(riscv_libgcc_floating_mode_supported_p): Ditto.
(riscv_init_libfuncs): Set the conversion method for BFmode and
HFmode.
(riscv_block_arith_comp_libfuncs_for_mode): Set the arithmetic
and comparison libfuncs for the mode.
* config/riscv/riscv.md (mode" ): Add BF.
(movhf): Support for BFmode.
(mov<mode>): Ditto.
(*movhf_softfloat): Ditto.
(*mov<mode>_softfloat): Ditto.

libgcc/ChangeLog:

* config/riscv/sfp-machine.h (_FP_NANFRAC_B): New.
(_FP_NANSIGN_B): Ditto.
* config/riscv/t-softfp32: Add support for BF16 libfuncs.
* config/riscv/t-softfp64: Ditto.
* soft-fp/floatsibf.c: For si -> bf16.
* soft-fp/floatunsibf.c: For unsi -> bf16.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/bf16_arithmetic.c: New test.
* gcc.target/riscv/bf16_call.c: New test.
* gcc.target/riscv/bf16_comparison.c: New test.
* gcc.target/riscv/bf16_float_libcall_convert.c: New test.
* gcc.target/riscv/bf16_integer_libcall_convert.c: New test.

Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
2 months agoRISC-V: Document -mcmodel=large
Palmer Dabbelt [Mon, 6 May 2024 21:34:26 +0000 (15:34 -0600)]
RISC-V: Document -mcmodel=large

  This slipped through the cracks.  Probably also NEWS-worthy.

gcc/ChangeLog:

* doc/invoke.texi (RISC-V): Add -mcmodel=large.

2 months agoSo another constant synthesis improvement.
Jeff Law [Mon, 6 May 2024 21:27:43 +0000 (15:27 -0600)]
So another constant synthesis improvement.

In this patch we're looking at cases where we'd like to be able to use
lui+slli, but can't because of the sign extending nature of lui on
TARGET_64BIT.  For example: 0x8001100000020UL.  The trunk currently generates 4
instructions for that constant, when it can be done with 3 (lui+slli.uw+addi).

When Zba is enabled, we can use lui+slli.uw as the slli.uw masks off the bits
32..63 before shifting, giving us the precise semantics we want.

I strongly suspect we'll want to do the same for a set of constants with
lui+add.uw, lui+shNadd.uw, so you'll see the beginnings of generalizing support
for lui followed by a "uw" instruction.

The new test just tests the set of cases that showed up while exploring a
particular space of the constant synthesis problem.  It's not meant to be
exhaustive (failure to use shadd when profitable).

gcc/

* config/riscv/riscv.cc (riscv_integer_op): Add field tracking if we
want to use a "uw" instruction variant.
(riscv_build_integer_1): Initialize the new field in various places.
Use lui+slli.uw for some constants.
(riscv_move_integer): Handle slli.uw.

gcc/testsuite/

* gcc.target/riscv/synthesis-2.c: New test.

2 months agoaarch64: Fix gcc.target/aarch64/sve/loop_add_6.c for LLP64 targets
Andrew Pinski [Mon, 6 May 2024 19:20:17 +0000 (12:20 -0700)]
aarch64: Fix gcc.target/aarch64/sve/loop_add_6.c for LLP64 targets

Even though the aarch64-mingw32 support has not been committed yet,
we should fix some of the testcases. In this case gcc.target/aarch64/sve/loop_add_6.c
is easy to fix. We should use __SIZETYPE__ instead of `unsigned long` for the variables
that will be used for pointer plus.

Committed as obvious after a quick test on aarch64-linux-gnu.

gcc/testsuite/ChangeLog:

PR testsuite/114177
* gcc.target/aarch64/sve/loop_add_6.c: Use __SIZETYPE__ instead
of `unsigned long` for index and offset variables.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 months agoUpdate the C FE routine "add_flexible_array_elts_to_size" C++ FE routine "layout_var_...
Qing Zhao [Mon, 6 May 2024 16:28:01 +0000 (16:28 +0000)]
Update the C FE routine "add_flexible_array_elts_to_size" C++ FE routine "layout_var_decl" to handle the cases when the DECL is union.

PR c/53548

Add testing cases to test the _bos for flexible array members in unions
or alone in structures.

gcc/c/ChangeLog:

PR c/53548
* c-decl.cc (add_flexible_array_elts_to_size): Handle the cases
when the DECL is union.

gcc/cp/ChangeLog:

PR c/53548
* decl.cc (layout_var_decl): Handle the cases when the DECL is
union with a flexible array member initializer.

gcc/testsuite/ChangeLog:

PR c/53548
* c-c++-common/fam-in-union-alone-in-struct-bos-1.c: New test.
* c-c++-common/fam-in-union-alone-in-struct-bos.c: New test.

2 months agoAdd testing cases for flexible array members in unions and alone in structures.
Qing Zhao [Mon, 6 May 2024 16:27:09 +0000 (16:27 +0000)]
Add testing cases for flexible array members in unions and alone in structures.

PR c/53548

gcc/testsuite/ChangeLog:

PR c/53548
* c-c++-common/fam-in-union-alone-in-struct-1.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-2.c: New testcase.
* c-c++-common/fam-in-union-alone-in-struct-3.c: New testcase.

2 months agoC and C++ FE changes to support flexible array members in unions and alone in structu...
Qing Zhao [Mon, 6 May 2024 16:26:19 +0000 (16:26 +0000)]
C and C++ FE changes to support flexible array members in unions and alone in structures. Adjust testcases for flexible array member in union and alone in structure extension.

PR c/53548

gcc/c/ChangeLog:

PR c/53548
* c-decl.cc (finish_struct): Change errors to pedwarns for the cases
flexible array members in union or alone in structures.

gcc/cp/ChangeLog:

PR c/53548
* class.cc (diagnose_flexarrays): Change error to pdewarn for the case
flexible array members alone in structures.
* decl.cc (grokdeclarator): Change error to pdewarn for the case
flexible array members in unions.

gcc/ChangeLog:

PR c/53548
* stor-layout.cc (place_union_field): Use zero sizes for flexible array
member fields.

gcc/testsuite/ChangeLog:

PR c/53548
* c-c++-common/builtin-clear-padding-3.c: Adjust testcase.
* g++.dg/ext/flexary12.C: Likewise.
* g++.dg/ext/flexary19.C: Likewise.
* g++.dg/ext/flexary2.C: Likewise.
* g++.dg/ext/flexary3.C: Likewise.
* g++.dg/ext/flexary36.C: Likewise.
* g++.dg/ext/flexary4.C: Likewise.
* g++.dg/ext/flexary5.C: Likewise.
* g++.dg/ext/flexary8.C: Likewise.
* g++.dg/torture/pr64280.C: Likewise.
* gcc.dg/20050620-1.c: Likewise.
* gcc.dg/940510-1.c: Likewise.

2 months agoAllow flexible array members in unions and alone in structures [PR53548]
Qing Zhao [Mon, 6 May 2024 16:25:04 +0000 (16:25 +0000)]
Allow flexible array members in unions and alone in structures [PR53548]

The request for GCC to accept that the C99 flexible array member can be
in a union or alone in a structure has been made a long time ago around 2012
for supporting several practical cases including glibc.

A GCC PR has been opened for such request at that time:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53548

However, this PR was closed as WONTFIX around 2015 due to the following reason:

"there is an existing extension that makes the requested functionality possible"
i.e GCC fully supported that the zero-length array can be in a union or alone
in a structure for a long time. (though I didn't see any official documentation
on such extension)

It's reasonable to close PR53548 at that time since zero-length array extension
can be used for such purpose.

However, since GCC13, in order to improve the C/C++ security, we introduced
-fstrict-flex-arrays=n to gradually eliminate the "fake flexible array"
usages from C/C++ source code. As a result, zero-length arrays eventually
will be replaced by C99 flexiable array member completely.

Therefore, GCC needs to explicitly allow such extensions directly for C99
flexible arrays, since flexable array member in unions or alone in structs
are common code patterns in active use by the Linux kernel (and other projects).

For example, these do not error by default with GCC:

union one {
  int a;
  int b[0];
};

union two {
  int a;
  struct {
    struct { } __empty;
    int b[];
  };
};

But these do:

union three {
  int a;
  int b[];
};

struct four {
  int b[];
}

Clang has supported such extensions since March, 2024
https://github.com/llvm/llvm-project/pull/84428

GCC should also support such extensions. This will allow for
a seamless transition for code bases away from zero-length arrays without
losing existing code patterns.

gcc/ChangeLog:

PR c/53548
* doc/extend.texi: Add documentation for Flexible Array Members in
Unions and Flexible Array Members alone in Structures.

2 months agoAVR: ipa/92606 - Don't optimize PROGMEM data against non-PROGMEM.
Georg-Johann Lay [Fri, 3 May 2024 16:47:50 +0000 (18:47 +0200)]
AVR: ipa/92606 - Don't optimize PROGMEM data against non-PROGMEM.

ipa/92606: Inter-procedural analysis optimizes data across
address-spaces and PROGMEM.  As of v14, the PROGMEM part is
still not fixed (and there is still no target hook as proposed
in PR92932).  Just disable respective bogus optimization.

PR ipa/92606
gcc/
* config/avr/avr.cc (avr_option_override): Set
flag_ipa_icf_variables = 0.
gcc/testsuite/
* gcc.target/avr/torture/pr92606.c: New test.

2 months agocontrib/gcc-changelog/git_check_commit.py: Implement --num-commits
Ken Matsui [Wed, 28 Feb 2024 21:00:23 +0000 (13:00 -0800)]
contrib/gcc-changelog/git_check_commit.py: Implement --num-commits

This patch implements a --num-commits (-n) flag for shorthand for
the range of hash~N..hash commits.

contrib/ChangeLog:

* gcc-changelog/git_check_commit.py: Implement --num-commits.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2 months agoOpenMP: Fix for ICE in tree-nested.cc.
Sandra Loosemore [Mon, 22 Apr 2024 18:24:25 +0000 (18:24 +0000)]
OpenMP: Fix for ICE in tree-nested.cc.

Use gimple_omp_target_clauses() instead of gimple_omp_taskreg_clauses()
when stmt is GIMPLE_OMP_TARGET, to avoid an as_a<> ICE.  The code
immediately following this is already conditionalized in the same way.

gcc/ChangeLog
* tree-nested.cc (convert_tramp_reference_stmt): Use the correct
accessor for GIMPLE_OMP_TARGET clauses.

2 months agotree-optimization/100923 - re-do VN with contextual PTA info fix
Richard Biener [Wed, 28 Feb 2024 09:08:31 +0000 (10:08 +0100)]
tree-optimization/100923 - re-do VN with contextual PTA info fix

The following implements the gist of the PR100923 fix in a leaner
(and more complete) way by realizing that all ao_ref_init_from_vn_reference
uses need to have an SSA name in the base valueized with availability
in mind.  Instead of re-valueizing the whole chain of operands we can
simply only and always valueize the SSA name we put in the base.

This handles also two omitted places in vn_reference_lookup_3.

PR tree-optimization/100923
* tree-ssa-sccvn.cc (ao_ref_init_from_vn_reference): Valueize
base SSA_NAME.
(vn_reference_lookup_3): Adjust vn_context_bb around calls
to ao_ref_init_from_vn_reference.
(vn_reference_lookup_pieces): Revert original PR100923 fix.
(vn_reference_lookup): Likewise.

2 months agoComplete ao_ref_init_from_vn_reference for all refs
Richard Biener [Tue, 27 Feb 2024 12:55:15 +0000 (13:55 +0100)]
Complete ao_ref_init_from_vn_reference for all refs

This makes sure we can create ao_refs from all VN operands we create.

* tree-ssa-sccvn.cc (ao_ref_init_from_vn_reference): Add
TARGET_MEM_REF support.  Handle more bases.

2 months agoada: Allow use of writable parameters inside function with side-effects
Piotr Trojanek [Thu, 4 Jan 2024 16:37:06 +0000 (17:37 +0100)]
ada: Allow use of writable parameters inside function with side-effects

Writable parameters can be used as global outputs inside functions with
side-effects.

gcc/ada/

* sem_prag.adb (Collect_Global_Item): Handle functions with
side-effects.

2 months agoada: Cleanup collecting of implicit outputs
Piotr Trojanek [Thu, 4 Jan 2024 16:10:47 +0000 (17:10 +0100)]
ada: Cleanup collecting of implicit outputs

Move handling of IN parameters to where both IN and IN OUT parameters
are handled. This makes the code marginally more efficient and
symmetrical to handling of implicit inputs.

gcc/ada/

* sem_prag.adb (Collect_Global_Item): Move code.

2 months agoada: Support writable parameters in Depends with side-effects
Piotr Trojanek [Thu, 4 Jan 2024 14:01:55 +0000 (15:01 +0100)]
ada: Support writable parameters in Depends with side-effects

Functions with side-effects can modify writable parameters of mode IN,
so these parameters must be allowed to appear in their Depends aspects.

gcc/ada/

* sem_prag.adb (Find_Role): Handle functions with side-effects
like procedures.

2 months agoada: Excess finalization on return of call to dispatching constructor
Gary Dismukes [Thu, 4 Jan 2024 00:34:33 +0000 (00:34 +0000)]
ada: Excess finalization on return of call to dispatching constructor

The compiler expands a too-early finalization call for the result
object of an extended return statement that returns a call to a
dispatching constructor function for a limited interface type,
resulting in premature (and extra) finalization of the result.
The temporary object that the compiler creates to hold the result
of the build-in-place call loses the fact that it comes from a
return, and the wrong BIP allocation form may be passed in the
call to the dispatching constructor, and the later code for dealing
with finalization in Exp_Ch7.Build_Finalizer incorrectly finalizes
the result object.

gcc/ada/

* exp_ch6.adb
(Make_Build_In_Place_Iface_Call_In_Object_Declaration): Set the
Is_Return_Object flag on the entity of the temp object created to
hold the BIP call result, from the flag on the passed-in object
declaration's entity. Update copyright notice to 2024.

2 months agoada: Give error for reference to nonvisible library unit
Bob Duff [Wed, 3 Jan 2024 21:32:51 +0000 (16:32 -0500)]
ada: Give error for reference to nonvisible library unit

This patch fixes a bug where the compiler would allow
a name X to refer to a library unit that is not visible.
In particular, this happens when the name X occurs in the
private part of a library package, and the parent of that
package contains an instantiation of a generic package, and the
spec of that generic package has "private with X;",
but there is no "private with X;" or "with X;" that applies
to the place where the name X occurs.

Also misc cleanup.

gcc/ada/

* sem_ch10.adb (Expand_With_Clause): Misc cleanup.
(Install_Private_With_Clauses): Avoid installing a private
with_clause that comes from an instantiated generic
(it is marked as Implicit_With, but doesn't come from a parent
with). Fix typo in comment, and other minor cleanups.

2 months agoada: Tweak discriminant source locations
Ronan Desplanques [Wed, 3 Jan 2024 11:09:03 +0000 (12:09 +0100)]
ada: Tweak discriminant source locations

This patch changes the source location information for the default
expressions of discrimants to better represent the fact that they're
evaluated at the point of object declaration, in the cases where
a Build_Default_Subtype optimization is performed. This fixes a
regression with CodePeer diagnostics introduced by a recent change
around Build_Default_Subtype optimizations.

gcc/ada/

* sem_util.adb (Build_Default_Subtype): Tweak source location
information.

2 months agoada: Do not attempt to generate finalization actions with restricted profile
Eric Botcazou [Fri, 22 Dec 2023 11:46:29 +0000 (12:46 +0100)]
ada: Do not attempt to generate finalization actions with restricted profile

These actions are not supported with this profile, but we were nevertheless
attempting to generate them for protected objects.

gcc/ada/

* exp_ch7.adb (Build_Finalizer.Process_Declarations): Do not call
Processing_Actions for simple protected objects if the profile is
restricted.
* exp_util.adb (Requires_Cleanup_Actions): Do not return True for
simple protected objects if the profile is restricted.

2 months agoada: Small cleanup in C/C++ front-end interface
Eric Botcazou [Thu, 21 Dec 2023 21:56:16 +0000 (22:56 +0100)]
ada: Small cleanup in C/C++ front-end interface

The fe.h header file is supposed to contain only the declarations needed
by the code in the gcc-interface repository.

gcc/ada/

* fe.h: Remove unused declarations and add 'extern' to others.

no-issue-check

2 months agoada: Deconstruct support for abstract states with Relaxed_Initialization
Piotr Trojanek [Thu, 21 Dec 2023 16:31:51 +0000 (17:31 +0100)]
ada: Deconstruct support for abstract states with Relaxed_Initialization

GNATprove newer implemented support for abstract states with aspect
Relaxed_Initialization, so the frontend support is now deconstructed.

gcc/ada/

* einfo-utils.adb (Is_Relaxed_Initialization_State): Remove.
* einfo-utils.ads (Is_Relaxed_Initialization_State): Remove.
* einfo.ads: Remove description of removed aspect.
* fe.h (Is_Relaxed_Initialization_State): Remove.
* sem_prag.adb (Analyze_Abstract_State): Remove support for
Relaxed_Initialization.
* sem_util.adb (Has_Relaxed_Initialization): Likewise.
* sem_util.ads (Has_Relaxed_Initialization): Likewise.

2 months agoada: Spurious reference warning on qualified expression
Justin Squirek [Thu, 21 Dec 2023 18:41:15 +0000 (18:41 +0000)]
ada: Spurious reference warning on qualified expression

Incremental improvement/clean up.

gcc/ada/

* sem_warn.adb (Within_Postcondition): Add coverage for
Preconditions

2 months agoada: Spurious reference warning on qualified expression
Justin Squirek [Thu, 21 Dec 2023 18:38:38 +0000 (18:38 +0000)]
ada: Spurious reference warning on qualified expression

Incremental improvement/clean up.

gcc/ada/

* sem_warn.adb (Within_Postcondition): Add/modify comments to
document various cases.

2 months agoada: Spurious reference warning on qualified expression
Justin Squirek [Thu, 21 Dec 2023 18:35:22 +0000 (18:35 +0000)]
ada: Spurious reference warning on qualified expression

Incremental improvement/clean up.

gcc/ada/

* sem_warn.adb (Within_Postcondition): Renamed to
Within_Contract_Or_Predicate.

2 months agoada: Spurious reference warning on qualified expression
Justin Squirek [Thu, 21 Dec 2023 18:31:27 +0000 (18:31 +0000)]
ada: Spurious reference warning on qualified expression

This patch fixes an error in the compiler whereby an assignment to an out
formal (whose type requires a predicate check) can lead to spurious
"value may be referenced before it has a value" warnings when the RHS is a
qualified expression.

gcc/ada/

* sem_warn.adb (Within_Postcondition): Add case to ignore
references within generated predicate function calls.

2 months agoada: Fix RM reference in comment
Ronan Desplanques [Thu, 21 Dec 2023 11:39:23 +0000 (12:39 +0100)]
ada: Fix RM reference in comment

The RM 2.2(15) that the comment mentioned before this patch doesn't
exist. It's pretty clear that the comment meant to refer to
RM 2.2(14) instead.

gcc/ada/

* hostparm.ads: Fix reference to RM clause.

2 months agoada: Make a couple of comment tweaks
Eric Botcazou [Thu, 21 Dec 2023 11:01:06 +0000 (12:01 +0100)]
ada: Make a couple of comment tweaks

This removes a reference to a mechanism that didn't make it into the final
implementation and completes the description of another.

gcc/ada/

* libgnat/s-finpri.ads (Finalize_Master): Remove obsolete reference
in the description.
(Finalize_Object): Document the effects of repeated calls.

2 months agoada: Rework processing of special objects needing finalization
Eric Botcazou [Wed, 20 Dec 2023 16:39:10 +0000 (17:39 +0100)]
ada: Rework processing of special objects needing finalization

This reworks the processing of special objects needing finalization in the
new implementation.  These special objects, i.e. return object in extended
return statements and transient objects, cannot be automatically handled by
the post-processing phase because they have additional requirements, either
conditional finalization for the former or immediate finalization for the
latter and, therefore, a specific processing during expansion is needed for
them before the post-processing phase can complete the work.

The previous scheme used to do minimal processing during expansion, leaving
the bulk of the work to the post-processing phase. Unfortunately this scheme
turned out not to be stable for Expression_With_Actions nodes under copying
by means of New_Copy_Tree or equivalent devices. The new scheme moves a bit
more processing to the expansion, namely the generation of the attachment to
the master node, whose result can then be naturally copied by New_Copy_Tree.

A side effect is to further simplify the implementation of Build_Finalizer
in Exp_Ch7, which has one fewer special case to deal with.

gcc/ada/

* einfo.ads (Finalization_Master_Node_Or_Object): Rename into...
(Finalization_Master_Node): ...this and adjust description.
* exp_ch4.adb (Process_Transient_In_Expression): Attach the object
to its master node here.
* exp_ch7.ads (Attach_Object_To_Master_Node): New declaration.
* exp_ch7.adb (Attach_Object_To_Master_Node): New procedure.
(Build_Finalizer.Process_Declarations): Examine the type of a
variable to spot master nodes.
(Build_Finalizer.Process_Object_Declaration): Look only at the
object and deal specifically with the case of a master node.
(Build_Finalizer.Build_BIP_Cleanup_Stmts): Move to child function
of Attach_Object_To_Master_Node.
(Build_Finalizer.Make_Address_For_Finalize): Move to...
(Insert_Actions_In_Scope_Around.Process_Transient_In_Scope): Attach
the object to its master node here.
(Make_Address_For_Finalize): ...here.
(Make_Master_Node_Declaration): Adjust to above renaming and set
Finalization_Master_Node only on the object.
(Make_Suppress_Object_Finalize_Call): Adjust to above renaming and
attach the object to its master node here.
* exp_util.adb (Requires_Cleanup_Actions): Examine the type of a
variable to spot master nodes.
* gen_il-fields.ads (Opt_Field_Enum): Adjust to above renaming.
* gen_il-gen-gen_entities.adb (Allocatable_Kind): Likewise.
* rtsfind.ads (RE_Id): Add RE_Chain_Node_To_Master.
(RE_Unit_Table): Add entry for  RE_Chain_Node_To_Master.
* libgnat/s-finpri.ads (Chain_Node_To_Master): New declaration.
* libgnat/s-finpri.adb (Chain_Node_To_Master): New procedure.
(Attach_Object_To_Master): Call it.
(Finalize_Master): Do not raise Program_Error on null addresses.
(Finalize_Object): Add assertion that the address is not null.

2 months agoada: Replace references to PO_Simple by Protected_Objects in comments
Eric Botcazou [Wed, 20 Dec 2023 15:27:09 +0000 (16:27 +0100)]
ada: Replace references to PO_Simple by Protected_Objects in comments

The child unit was renamed a while ago.

gcc/ada/

* libgnarl/s-taprob.ads (Protection): Add cross-reference to the
counterpart in System.Tasking.Protected_Objects.Entries.
* libgnarl/s-taskin.ads (Locking Rules): Replace PO_Simple by
Protected_Objects.
* libgnarl/s-tpoben.ads (Protection_Entries): Likewise.

2 months agoada: Fix wrong Finalization_Size for No_Heap_Finalization objects
Eric Botcazou [Sat, 16 Dec 2023 10:34:48 +0000 (11:34 +0100)]
ada: Fix wrong Finalization_Size for No_Heap_Finalization objects

When an access type is subject to the No_Heap_Finalization pragma, no header
is added in front of objects allocated through it, and the value returned by
Finalization_Size is defined to be the size of this header.

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Finalization_Size>:
Return 0 if the prefix is a dereference of an access value subject
to the No_Heap_Finalization pragma.

2 months agoada: Fix spurious warning emission
Ronan Desplanques [Tue, 19 Dec 2023 16:13:20 +0000 (17:13 +0100)]
ada: Fix spurious warning emission

This patch fixes a bug where GNAT would emit incorrect warnings
about obsolescent syntax for array aggregates with generics and
particular arrangements of Ada version pragmas.

This patch also removes a syntactic field that was introduced to
support the emission of this warning, but is no longer required.

gcc/ada/

* exp_imgv.adb (Append_Table_To): Remove reference to removed
field.
* gen_il-fields.ads: Remove Is_Enum_Array_Aggregate field.
* gen_il-gen-gen_nodes.adb: Likewise.
* sem_aggr.adb: Tweak warning emission condition.
* sinfo.ads: Remove documentation for Is_Enum_Array_Aggregate.

2 months agoada: Replace redundant conditions with assertions
Piotr Trojanek [Tue, 19 Dec 2023 09:23:55 +0000 (10:23 +0100)]
ada: Replace redundant conditions with assertions

Fix warnings from the CodePeer. The code structure is essentially:

  if A and B then ...
  elsif not A and not B then ...
  elsif A then ...
  elsif B then ...  --  this condition is redundant
  end if;

and it causes CodePeer to say "exception is raised in a conditional
branch", which most likely means that the condition is redundant.

gcc/ada/

* make.adb (Scan_Make_Arg): Remove redundant condition.
* switch-b.adb (Scan_Debug_Switches): Likewise.
* switch-c.adb (Scan_Front_End_Switches): Likewise.

2 months agoada: Fix detection of (Un)Hide_Info pragma in GNATprove mode
Yannick Moy [Tue, 19 Dec 2023 09:52:38 +0000 (10:52 +0100)]
ada: Fix detection of (Un)Hide_Info pragma in GNATprove mode

Spec or body may not be in a list for subunit.

gcc/ada/

* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Add guard.

2 months agoada: Fix missing associated node for packed array itypes
Piotr Trojanek [Mon, 18 Dec 2023 13:31:52 +0000 (14:31 +0100)]
ada: Fix missing associated node for packed array itypes

After decoration, itypes should have its associated node set.

gcc/ada/

* exp_pakd.adb (Create_Packed_Array_Impl_Type): Set associated
node for the packed array itype.
* exp_util.adb (Possible_Side_Effect_In_SPARK): Remove
workaround for a missing associated node.

2 months agoada: Don't propagate convention to internal subprograms
Richard Kenner [Sun, 17 Dec 2023 12:47:44 +0000 (07:47 -0500)]
ada: Don't propagate convention to internal subprograms

AI95-117 requires that all new primitives of a tagged type must
inherit the convention of the full view of the type. However, we need
not do this for primitives that are internally-generated, such as for
finalization. There are issues with GNAT LLVM when primitives have
convention C since the UC from that subprogram type to the type used
in the dispatch table will generate a warning. We're not doing
anything here about the case where the convention C is explicit or
there are user-specified primitives on a type with convention C, but
let's not make the problem worse by putting convention C on internal
subprograms.

gcc/ada/

* freeze.adb (Freeze_Entity): When changing the convention of
primitive to match that of the type, only do this for user-specified
primitives.

2 months agoada: Fix memory leak in 'Image
Bob Duff [Fri, 15 Dec 2023 21:59:43 +0000 (16:59 -0500)]
ada: Fix memory leak in 'Image

Fix memory leak in 'Image by managing the secondary stack
in scopes that call the new Ada 2020 'Image, which calls 'Put_Image
and then Get, which returns on the secondary stack.

gcc/ada/

* exp_put_image.adb (Build_Image_Call): Call Set_Uses_Sec_Stack on
the current scope. We don't do this at all call sites, because
there are three; better to do it here.

2 months agoada: Extend Round attribute to ordinary fixed point types
Eric Botcazou [Sat, 16 Dec 2023 12:20:06 +0000 (13:20 +0100)]
ada: Extend Round attribute to ordinary fixed point types

The attribute is only defined by the language for decimal fixed point
types (RM 3.5.10(12)) but it could be useful to have it for ordinary
fixed point types too because conversions from floating point truncate
in both cases.

gcc/ada/

* sem_attr.adb (Analyze_Attribute) <Attribute_Round>: Also accept it
for ordinary fixed point types.
* doc/gnat_rm/implementation_defined_attributes.rst (Round): New.
* gnat_rm.texi: Regenerate.

2 months agoada: Fix non-idiomatic construct
Eric Botcazou [Fri, 15 Dec 2023 18:07:44 +0000 (19:07 +0100)]
ada: Fix non-idiomatic construct

gcc/ada/

* exp_ch3.adb (Expand_Freeze_Class_Wide_Type): Use No instead of
not Present.

2 months agoada: Adjust source location for degenerate scope master
Eric Botcazou [Fri, 15 Dec 2023 12:08:38 +0000 (13:08 +0100)]
ada: Adjust source location for degenerate scope master

When the finalization scope master degenerates into a simple master node,
the latter must inherit the source location that the former would have had.

gcc/ada/

* exp_ch7.adb (Build_Finalizer.Process_Object_Declaration): Adjust
the Sloc of the master node declaration in the degenerate case.

2 months agoada: Prevent inlining in GNATprove for memory leaks
Yannick Moy [Wed, 13 Dec 2023 16:40:03 +0000 (17:40 +0100)]
ada: Prevent inlining in GNATprove for memory leaks

In some cases, inlining a call in GNATprove could lead to
missing a memory leak. Recognize such cases and do not inline
such calls.

gcc/ada/

* inline.adb (Call_Can_Be_Inlined_In_GNATprove_Mode):
Add case to prevent inlining of call.
* inline.ads: Likewise.
* sem_res.adb (Resolve_Call): Update comment and message.

2 months agoada: Partial implementation of redesign of support for object finalization
Eric Botcazou [Thu, 21 Sep 2023 21:27:44 +0000 (23:27 +0200)]
ada: Partial implementation of redesign of support for object finalization

This set of changes is a partial reimplemention of the support for Ada
finalization in the GNAT compiler and run-time library, based on the
redesign done by Hristian Kirtchev in February 2022.  It only affects
the scope-based finalization of objects and does not touch the support
for finalization of dynamically allocated objects.

It also does not modify the internal architecture of this support in the
front-end but only changes its output, i.e. the expanded code.  In other
words, the code-based dispatching scheme in finalizers and the hook-based
approach for transient objects are replaced by finalization scope masters
and master nodes, which maintain a list of objects needing finalization,
but the expansion of the code that builds these masters is still performed
mainly during a dedicated post-processing phase.

gcc/ada/

* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-finpri$(objext).
* contracts.adb (Add_Call_Helper): Append freeze actions to the
class-wide type rather than the specific tagged type.
* einfo.ads (Finalization_Master_Node_Or_Node): Document.
(Status_Flag_Or_Transient_Decl): Remove.
* exp_attr.adb (Expand_N_Attribute_Reference) <Address>: Do not
adjust a return object of a class-wide interface type.
* exp_ch3.adb  (Expand_Freeze_Class_Wide_Type): Add test that
Finalize_Address is not already present as a condition for calling
Make_Finalize_Address_Body.
(Expand_Freeze_Record_Type): Call Make_Finalize_Address_Body for
class-wide types of both regular tagged types and interface types.
* exp_ch4.adb (Process_Transients_In_Expression): Replace the use
of hooks with the use of master nodes.
* exp_ch6.adb (Build_Flag_For_Function): Delete.
(Expand_N_Extended_Return_Statement): Create a master node for the
return object if it does not exist.  At the end of the statement,
generate a call to Suppress_Object_Finalize.
(Expand_Non_Function_Return): Likewise just before the return.
* exp_ch7.ads (Make_Master_Node_Declaration): Declare.
(Make_Suppress_Object_Finalize_Call): Likewise.
* exp_ch7.adb (Build_Finalization_Master): Defer generating the
call to Set_Finalize_Address until freezing if the Finalize_Address
procedure has not been analyzed yet.
(Build_Finalizer): Reimplement the expansion using a finalization
scope master per finalizer.
(Insert_Actions_In_Scope_Around): Replace finalization hooks by
master nodes and calls to the Finalize_Object.
(Make_Master_Node_Declaration): New procedure.
(Make_Suppress_Object_Finalize_Call): Likewise.
* exp_util.ads (Build_Transient_Object_Statements): Delete.
* exp_util.adb (Build_Transient_Object_Statements): Likewise.
(Requires_Cleanup_Actions): Remove obsolete code and return true
for master nodes.
* gen_il-fields.ads (Opt_Field_Enum): Add
Finalization_Master_Node_Or_Object and
remove Status_Flag_Or_Transient_Decl.
* gen_il-gen-gen_entities.adb (Allocatable_Kind): Likewise.
* rtsfind.ads (RTU_Id): Add System_Finalization_Primitives.
(RE_Id): Add entities of System_Finalization_Primitives.
(RE_Unit_Table): Add entries for them.
* sem_ch3.adb (Analyze_Object_Declaration): For an array whose type
has an unconstrained first subtype and a controlled component, set
the Is_Constr_Array_Subt_With_Bounds flag.
* libgnat/s-finpri.ads: New file.
* libgnat/s-finpri.adb: Likewise.

2 months agoada: Do not inline in GNATprove the subprograms with (Un)Hide_Info
Yannick Moy [Wed, 13 Dec 2023 14:38:59 +0000 (15:38 +0100)]
ada: Do not inline in GNATprove the subprograms with (Un)Hide_Info

The annotations Hide_Info and Unhide_Info in GNATprove are meant to
give special visibility in the corresponding scope to the precise definition
of some entities. Hence, such scopes should not be inlined in GNATprove.

gcc/ada/

* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Adapt checking.

2 months agolibgfortran: Fix libgfortran.so versioning on Solaris with subdirs
Rainer Orth [Mon, 6 May 2024 07:31:11 +0000 (09:31 +0200)]
libgfortran: Fix libgfortran.so versioning on Solaris with subdirs

The move of libgfortran objects to subdirectories completely broke the
creation of libgfortran.so on Solaris.  Since the gfortran.ver-sun rule
doesn't support that structure, no libtool objects are found, thus no
symbols exported from libgfortran.so, causing every link to fail.

This patch fixes this by allowing for the new structure.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11.

2024-05-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libgfortran:
* Makefile.am [LIBGFOR_USE_SYMVER_SUN] (gfortran.ver-sun): Handle
objects in subdirs.
* Makefile.in: Regenerate.

2 months agoexpmed: TRUNCATE value1 if needed in store_bit_field_using_insv
YunQiang Su [Sun, 28 Apr 2024 16:33:44 +0000 (00:33 +0800)]
expmed: TRUNCATE value1 if needed in store_bit_field_using_insv

PR target/113179.

In `store_bit_field_using_insv`, we just use SUBREG if value_mode
>= op_mode, while in some ports, a sign_extend will be needed,
such as MIPS64:
  If either GPR rs or GPR rt does not contain sign-extended 32-bit
  values (bits 63..31 equal), then the result of the operation is
  UNPREDICTABLE.

The problem happens for the code like:
  struct xx {
        int a:4;
        int b:24;
        int c:3;
        int d:1;
  };

  void xx (struct xx *a, long long b) {
        a->d = b;
  }

In the above code, the hard register contains `b`, may be note well
sign-extended.

gcc/
PR target/113179
* expmed.cc(store_bit_field_using_insv): TRUNCATE value1 if
needed.

gcc/testsuite
PR target/113179
* gcc.target/mips/pr113179.c: New tests.

2 months agoconfig-ml.in: Fix multi-os-dir search
YunQiang Su [Sun, 5 May 2024 15:12:37 +0000 (23:12 +0800)]
config-ml.in: Fix multi-os-dir search

When building multilib libraries, CC/CXX etc are set with an option
-B*/lib/, instead of -B<something>/lib/<multi-os-directory>.
This will make some trouble in some case, for example building
cross toolchain based on Debian's cross packages:

  If we have libc6-dev-i386-amd64-cross packages installed on
  a non-x86 machine. This package will have the files in
  /usr/x86_4-linux-gnu/lib32.  The fellow configure will fail
  when build libgcc for i386, with complains the libc is not
  i386 ones:
     ../configure --enable-multilib --enable-multilib \
            --target=x86_64-linux-gnu

Let's insert a "-B*/lib/`CC ${flags} --print-multi-os-directory`"
before "-B*/lib/".

This patch is based on the patch used by Debian now.

ChangeLog

* config-ml.in: Insert an -B option with multi-os-dir into
compiler commands used to build libraries.

2 months agoDaily bump.
GCC Administrator [Mon, 6 May 2024 00:16:49 +0000 (00:16 +0000)]
Daily bump.

2 months agoFortran: fix issues with class(*) assignment [PR114827]
Harald Anlauf [Mon, 29 Apr 2024 17:52:52 +0000 (19:52 +0200)]
Fortran: fix issues with class(*) assignment [PR114827]

gcc/fortran/ChangeLog:

PR fortran/114827
* trans-array.cc (gfc_alloc_allocatable_for_assignment): Take into
account _len of unlimited polymorphic entities when calculating
the effective element size for allocation size and array span.
Set _len of lhs to _len of rhs.
* trans-expr.cc (trans_class_assignment): Take into account _len
of unlimited polymorphic entities for allocation size.

gcc/testsuite/ChangeLog:

PR fortran/114827
* gfortran.dg/asan/unlimited_polymorphic_34.f90: New test.

2 months agoUpdate libbid according to the latest Intel Decimal Floating-Point Math Library.
liuhongt [Wed, 27 Mar 2024 00:20:13 +0000 (08:20 +0800)]
Update libbid according to the latest Intel Decimal Floating-Point Math Library.

The Intel Decimal Floating-Point Math Library is available as open-source on Netlib[1].

[1] https://www.netlib.org/misc/intel/.

libgcc/config/libbid/ChangeLog:

* bid128_fma.c (add_and_round): Fix bug: the result
of (+5E+368)*(+10E-34)+(-10E+369) was returning
-9999999999999999999999999999999999E+336 instead of expected
result -1000000000000000000000000000000000E+337.
(bid128_ext_fma): Ditto.
(bid64qqq_fma): Ditto.
* bid128_noncomp.c: Change return type of bid128_class from
int to class_t.
* bid128_round_integral.c: Add default case to avoid compiler
warning.
* bid128_string.c (bid128_to_string): Replace 0x30 with '0'
for zero digit.
(bid128_from_string): Ditto.
* bid32_to_bid128.c (bid128_to_bid32): Fix Bug. In addition
to the INEXACT flag, the UNDERFLOW flag needs to be set (and
was not) when converting an input such as
+6931674235302037148946035460357709E+1857 to +1000000E-101
* bid32_to_bid64.c (bid64_to_bid32): fix Bug, In addition to
the INEXACT flag, the UNDERFLOW flag needs to be set (and was
not) when converting an input such as +9999999000000001E-111
to +1000000E-101. Furthermore, significant bits of NaNs are
set correctly now. For example,  0x7c00003b9aca0000 was
returning 0x7c000002 instead of 0x 7c000100.
* bid64_noncomp.c: Change return type of bid64_class from int
to class_t.
* bid64_round_integral.c (bid64_round_integral_exact): Add
default case to avoid compiler warning.
* bid64_string.c (bid64_from_string): Fix bug for rounding
up. The input string "10000000000000000" was returning
+1000000000000001E+1 instead of +1000000000000000E+1.
* bid64_to_bid128.c (bid128_to_bid64): Fix bug, in addition to
the INEXACT flag, the UNDERFLOW flag needs to be set (and was
not) when converting an input such as
+9999999999999999999999999999999999E-417 to
+1000000000000000E-398.
* bid_binarydecimal.c (bid32_to_binary64): Fix bug for
conversion between binary and bid types. For example,
0x7c0F4240 was returning 0x7FFFA12000000000 instead of
expected double precision 0x7FF8000000000000.
(binary64_to_bid32): Ditto.
(binary80_to_bid32): Ditto.
(binary128_to_bid32): Ditto.
(binary80_to_bid64): Ditto.
(binary128_to_bid64): Ditto.
* bid_conf.h (BID_HIGH_128W): New macro.
(BID_LOW_128W): Ditto.
* bid_functions.h (__ENABLE_BINARY80__): Ditto.
(ALIGN): Ditto.
* bid_inline_add.h (get_add128): Add default case to avoid compiler
warning.
* bid_internal.h (get_BID64): Ditto.
(fast_get_BID64_check_OF): Ditto.
(ALIGN): New macro.

Co-authored-by: Anderson, Cristina S <cristina.s.anderson@intel.com>
Co-authored-by: Akkas, Ahmet <ahmet.akkas@intel.com>
Co-authored-by: Cornea, Marius <marius.cornea@intel.com>
2 months agoRemove m_nloops field from loop_versioning
Andrew Pinski [Sun, 28 Apr 2024 01:54:43 +0000 (18:54 -0700)]
Remove m_nloops field from loop_versioning

This is a small cleanup of loop_versioning where m_nloops
is only used in the constructor so we can remove the whole
field.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* gimple-loop-versioning.cc (loop_versioning): Remove m_nloops field.
(loop_versioning::loop_versioning): Remove initialization of
m_nloops field and move it to be a local variable.
(loop_versioning::analyze_blocks): Fix formating.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 months agoDaily bump.
GCC Administrator [Sun, 5 May 2024 00:16:48 +0000 (00:16 +0000)]
Daily bump.

2 months agoAdd prange entries in gimple-range-op.cc.
Aldy Hernandez [Wed, 20 Mar 2024 10:27:21 +0000 (11:27 +0100)]
Add prange entries in gimple-range-op.cc.

gcc/ChangeLog:

* gimple-range-op.cc (class cfn_pass_through_arg1): Add overloads
for prange operations.
(cfn_strlen): Same.

2 months agoImplement operator_ge for prange....
Aldy Hernandez [Wed, 20 Mar 2024 10:15:03 +0000 (11:15 +0100)]
Implement operator_ge for prange....

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_ge::fold_range): New.
(operator_ge::op1_range): New.
(operator_ge::op2_range): New.
(operator_ge::op1_op2_relation): New.
(operator_ge::pointers_handled_p): New.

2 months agoImplement operator_gt for prange.
Aldy Hernandez [Wed, 20 Mar 2024 10:10:03 +0000 (11:10 +0100)]
Implement operator_gt for prange.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_gt::fold_range): New.
(operator_gt::op1_range): New.
(operator_gt::op2_range): New.
(operator_gt::op1_op2_relation): New.
(operator_gt::pointers_handled_p): New.

2 months agoImplement operator_le for prange.
Aldy Hernandez [Wed, 20 Mar 2024 10:07:30 +0000 (11:07 +0100)]
Implement operator_le for prange.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_le::fold_range): New.
(operator_le::op1_range): New.
(operator_le::op2_range): New.
(operator_le::op1_op2_relation): New.
(operator_le::pointers_handled_p): New.

2 months agoImplement operator_lt for prange.
Aldy Hernandez [Wed, 20 Mar 2024 10:03:24 +0000 (11:03 +0100)]
Implement operator_lt for prange.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (max_limit): New.
(min_limit): New.
(build_lt): New.
(build_le): New.
(build_gt): New.
(build_ge): New.
(operator_lt::fold_range): New.
(operator_lt::op1_range): New.
(operator_lt::op2_range): New.
(operator_lt::op1_op2_relation): New.
(operator_lt::pointers_handled_p): New.

2 months agoImplement operator_equal for prange.
Aldy Hernandez [Wed, 20 Mar 2024 09:54:39 +0000 (10:54 +0100)]
Implement operator_equal for prange.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_equal::fold_range): New.
(operator_equal::op1_range): New.
(operator_equal::op2_range): New.
(operator_equal::op1_op2_relation): New.
(operator_equal::pointers_handled_p): New.

2 months agoImplement operator_not_equal for prange.
Aldy Hernandez [Wed, 20 Mar 2024 09:49:11 +0000 (10:49 +0100)]
Implement operator_not_equal for prange.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_not_equal::fold_range): New.
(operator_not_equal::op1_range): New.
(operator_not_equal::op2_range): New.
(operator_not_equal::op1_op2_relation): New.
(operator_not_equal::pointers_handled_p): New.

2 months agoImplement operator_bitwise_or for prange.
Aldy Hernandez [Wed, 20 Mar 2024 09:29:50 +0000 (10:29 +0100)]
Implement operator_bitwise_or for prange.

We seem to have a range-op entry for pointer bitwise OR that we've
inherited from the original VRP implementation, but it never gets
used.  If this is not valid gimple, we can safely remove this entry.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_bitwise_or::pointers_handled_p): New.

2 months agoImplement operator_bitwise_and for prange.
Aldy Hernandez [Wed, 20 Mar 2024 09:23:31 +0000 (10:23 +0100)]
Implement operator_bitwise_and for prange.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_bitwise_and::fold_range): New.
(operator_bitwise_and::pointers_handled_p): New.

2 months agoImplement operator_pointer_diff for prange.
Aldy Hernandez [Wed, 20 Mar 2024 09:12:47 +0000 (10:12 +0100)]
Implement operator_pointer_diff for prange.

gcc/ChangeLog:

* range-op-ptr.cc
(operator_pointer_diff::op1_op2_relation_effect): New.
(operator_pointer_diff::pointers_handled_p): New.

2 months agoImplement pointer_plus_operator for prange.
Aldy Hernandez [Wed, 20 Mar 2024 09:04:41 +0000 (10:04 +0100)]
Implement pointer_plus_operator for prange.

gcc/ChangeLog:

* range-op-ptr.cc (class pointer_plus_operator): Add overloaded declarations
for pointer variants.
(pointer_plus_operator::fold_range): New.
(pointer_plus_operator::op2_range): New.
(pointer_plus_operator::pointers_handled_p): New.

2 months agoImplement operator_addr_expr for prange.
Aldy Hernandez [Wed, 20 Mar 2024 08:51:33 +0000 (09:51 +0100)]
Implement operator_addr_expr for prange.

gcc/ChangeLog:

* range-op-mixed.h: Add overloaded declarations for pointer variants.
* range-op-ptr.cc (operator_addr_expr::op1_range): New.
(operator_addr_expr::pointers_handled_p): New.

This page took 0.12118 seconds and 5 git commands to generate.