]> gcc.gnu.org Git - gcc.git/log
gcc.git
17 months agolibstdc++: Disable broken std::format for floating-point types [PR108221]
Jonathan Wakely [Thu, 5 Jan 2023 14:04:32 +0000 (14:04 +0000)]
libstdc++: Disable broken std::format for floating-point types [PR108221]

If we don't have std::to_chars for floating-point types (either because
float and double are not IEEE format, or size_t is 16-bit) then we can't
use them with std::format. This causes a bootstrap failure since
std/c++20/tzdb.cc was added to the library, because <chrono> now
includes <format>.

This change just disables formatting support for those types. This is
not a proper fix, but solves the bootstrap failure for now.

libstdc++-v3/ChangeLog:

PR libstdc++/108221
* include/std/format (basic_format_arg) [!__cpp_lib_to_chars]:
Disable visiting floating-point types.

17 months agoRevert "aarch64: Make existing V2HF be usable."
Tamar Christina [Fri, 6 Jan 2023 12:57:50 +0000 (12:57 +0000)]
Revert "aarch64: Make existing V2HF be usable."

This reverts commit 2cba118e538ba0b7582af7f9fb5ba2dfbb772f8e.

17 months agodocs: fix Var documentation for .opt files
Martin Liska [Wed, 28 Dec 2022 09:16:58 +0000 (10:16 +0100)]
docs: fix Var documentation for .opt files

The Var documentation was somehow wrongly split into 2 pieces.

PR middle-end/107966

gcc/ChangeLog:

* doc/options.texi: Fix Var documentation in internal manual.

17 months agolibstdc++: Fix deadlock in debug iterator increment [PR108288]
Jonathan Wakely [Thu, 5 Jan 2023 16:23:51 +0000 (16:23 +0000)]
libstdc++: Fix deadlock in debug iterator increment [PR108288]

With -fno-elide-constructors the debug iterator post-increment and
post-decrement operators are susceptible to deadlock. They take a mutex
lock and then return a temporary, which also attempts to take a lock to
attach itself to the sequence. If the return value and *this happen to
collide and use the same mutex from the pool, then you get a deadlock
trying to lock a mutex that is already held by the current thread.

The solution is to construct the return value before taking the lock.
The copy constructor and pre-inc/pre-dec operators already manage locks
correctly, without deadlock, so just implement post-inc/post-dec in the
conventional way, taking a copy then modifying *this, then returning the
copy.

libstdc++-v3/ChangeLog:

PR libstdc++/108288
* include/debug/safe_iterator.h (_Safe_iterator::operator++(int))
(_Safe_iterator::operator--(int)): Do not hold lock around
construction of return value.

17 months agotestsuite: Add testcases from PR108292 and PR108308
Jakub Jelinek [Fri, 6 Jan 2023 09:52:34 +0000 (10:52 +0100)]
testsuite: Add testcases from PR108292 and PR108308

These PRs were for now fixed by reversion of the r13-4977
patch, but so that the problems don't reappear during stage 1,
I'm adding testcase coverage from those PRs.

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

PR target/108292
PR target/108308
* gcc.c-torture/execute/pr108292.c: New test.
* gcc.target/i386/pr108292.c: New test.
* gcc.dg/pr108308.c: New test.

17 months agoconfigure: remove dependencies on gmp and mpfr when gdb is disabled
Clément Chigot [Tue, 3 Jan 2023 13:24:43 +0000 (14:24 +0100)]
configure: remove dependencies on gmp and mpfr when gdb is disabled

Since 91e0d22025e0bf2af2e364cb7214a05512a0c431, the configure checks
about GMP and MPFR for gdb builds have been moved to the toplevel
configure.
However, it doesn't take into account the --disable-gdb option. Meaning
that a build without gdb will require these libraries even if not
needed.

ChangeLog:

* configure.ac: Skip GMP and MPFR when --disable-gdb is
provided.
* configure: Regenerate.

17 months agocontrib: add 'contrib' to default dirs in update-copyright.py
Martin Liska [Fri, 6 Jan 2023 07:45:24 +0000 (08:45 +0100)]
contrib: add 'contrib' to default dirs in update-copyright.py

contrib/ChangeLog:

* update-copyright.py: Add contrib as a default dir.

17 months agoPR-108294 soname bump for modula2 runtime libraries.
v [Fri, 6 Jan 2023 04:50:09 +0000 (04:50 +0000)]
PR-108294 soname bump for modula2 runtime libraries.

The soname for the Modula-2 runtime libraries for the compiler based on
GCC 12 is 17 and didn't change for GCC 13.  This patch bumps the version
to 18.

libgm2/ChangeLog:

* configure: Regenerate.
* configure.ac (libtool_VERSION): Bump to 18:0:0.

Signed-off-by: <gaiusmod2@gmail.com>
17 months agoDaily bump.
GCC Administrator [Fri, 6 Jan 2023 00:17:35 +0000 (00:17 +0000)]
Daily bump.

17 months ago[Committed] PR rtl-optimization/108292: Revert "Improve ix86_expand_int_movcc to...
Roger Sayle [Thu, 5 Jan 2023 19:49:45 +0000 (19:49 +0000)]
[Committed] PR rtl-optimization/108292: Revert "Improve ix86_expand_int_movcc to allow condition (mask) sharing"

This reverts commit d0558f420b2a5692fd38ac76ffa97ae6c1726ed9.

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

gcc/ChangeLog
PR rtl-optimization/108292
* config/i386/i386-expand.cc (ix86_expand_int_movcc): Revert
previous changes.

gcc/testsuite/ChangeLog
PR rtl-optimization/108292
* gcc.target/i386/cmov10.c: Remove test case.

17 months agoc++: class-head parsing and CPP_TEMPLATE_ID access [PR108275]
Patrick Palka [Thu, 5 Jan 2023 19:21:34 +0000 (14:21 -0500)]
c++: class-head parsing and CPP_TEMPLATE_ID access [PR108275]

When tentatively parsing what is really an elaborated-type-specifier
containing a template-id first as a class-specifier, we may form a
CPP_TEMPLATE_ID token that later gets reused by the fallback parse if
the tentative parse fails.  These special tokens also capture the access
checks that have been deferred while parsing the template-id.  But here
we form such a token when the access check state is dk_no_check, and so
the token captures no access checks.  This effectively bypasses access
checking for the template-id during the subsequent parse as an
elaborated-type-specifier.

This patch fixes this by using dk_deferred instead of dk_no_check when
parsing the class name of a class-head.

PR c++/108275

gcc/cp/ChangeLog:

* parser.cc (cp_parser_class_head): Use dk_deferred instead of
dk_no_check when parsing the class name.

gcc/testsuite/ChangeLog:

* g++.dg/parse/access14.C: New test.

17 months agoFix atomic operations on PA-RISC 2.0 processors.
John David Anglin [Thu, 5 Jan 2023 18:15:18 +0000 (18:15 +0000)]
Fix atomic operations on PA-RISC 2.0 processors.

PA-RISC 2.0 supports out-of-order execution for loads and stores.
Thus, we need to synchonize memory accesses.

This change revises the lock releases in __exchange_and_add and
__atomic_add to use an ordered store with release semantics.  We
also use an ordered load in the inner spin loop.

We use the "ldcw,co" instruction instead of "ldcw" when compiled
for PA 2.0.  Most PA 2.0 processors are coherent and can execute
the ldcw instruction in cache for improved performance.

Finally, the inner spin loop is revised to immediately branch to
the ldcw instruction when it detects the lock is free.

2023-01-05  John David Anglin  <danglin@gcc.gnu.org>

libstdc++-v3/ChangeLog:

* config/cpu/hppa/atomicity.h (_PA_LDCW_INSN): Define.
(__exchange_and_add): Use _PA_LDCW_INSN.  Use ordered store for
lock release.  Revise loop.
(__atomic_add): Likewise.

17 months agomodula-2: Remove uses of scalb*() and significand*() [PR107631]
Iain Sandoe [Wed, 4 Jan 2023 21:03:24 +0000 (21:03 +0000)]
modula-2: Remove uses of scalb*() and significand*() [PR107631]

The scalb*() functions are obsolete in Posix from 2004 and removed in
2008.

The significand*() functions are glibc-only and considered there to be
obsolescent (not supported for types such as _Float128).

We can remove them from Modula-2 since they are not required for ISO
support, but we need to provide an implementation of significand* for
the "fraction()" functions.

PR modula2/107631

gcc/m2/ChangeLog:

* gm2-gcc/m2builtins.cc: Remove scalb, scalbf, scalbl,
significand, significandf, significandl.
* gm2-libs/Builtins.def (significand): Likewise.
* gm2-libs/Builtins.mod: Likewise.
* target-independent/Builtins.texi: Likewise.
* gm2-libs-iso/LowLong.mod: Implement fraction with scalbn*() and
ilogb*().
* gm2-libs-iso/LowReal.mod: Likewise.
* gm2-libs-iso/LowShort.mod: Likewise.

17 months agolibstdc++: Fix <chrono> printers for Python 2 [PR108212]
Jonathan Wakely [Thu, 5 Jan 2023 13:41:21 +0000 (13:41 +0000)]
libstdc++: Fix <chrono> printers for Python 2 [PR108212]

The datetime.timezone.utc singleton doesn't exist in Python 2, but we
can create it ourselves by deriving from datetime.tzinfo.

libstdc++-v3/ChangeLog:

PR libstdc++/108212
* python/libstdcxx/v6/printers.py (_utc_timezone): New global
variable.
(StdChronoTimePointPrinter::to_string): Use it.

17 months agolibstdc++: Reduce size of std::bind_front(empty_type) result [PR108290]
Jonathan Wakely [Thu, 5 Jan 2023 11:35:35 +0000 (11:35 +0000)]
libstdc++: Reduce size of std::bind_front(empty_type) result [PR108290]

libstdc++-v3/ChangeLog:

PR libstdc++/108290
* include/std/functional (_Bind_front): Add no_unique_address
attribute to data members.
* testsuite/20_util/function_objects/bind_front/107784.cc: Check
size of call wrappers with empty types for targets and bound
arguments.

17 months agogccrs: avoid printing to stderr in selftest::rust_flatten_list
David Malcolm [Thu, 5 Jan 2023 15:01:38 +0000 (10:01 -0500)]
gccrs: avoid printing to stderr in selftest::rust_flatten_list

gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-item.cc (selftest::rust_flatten_list):
Remove output to stderr.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
17 months agogccrs: add selftest-rust-gdb and selftest-rust-valgrind "make" targets
David Malcolm [Thu, 5 Jan 2023 15:01:37 +0000 (10:01 -0500)]
gccrs: add selftest-rust-gdb and selftest-rust-valgrind "make" targets

Add "make" targets to make it easy to run the rust selftests under gdb
and under valgrind via:
  make selftest-rust-gdb
and
  make selftest-rust-valgrind
respectively.

gcc/rust/ChangeLog:
* Make-lang.in (selftest-rust-gdb): New.
(selftest-rust-valgrind): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
17 months agoada: Minor tweak to test added in previous change
Eric Botcazou [Sat, 24 Dec 2022 19:29:14 +0000 (20:29 +0100)]
ada: Minor tweak to test added in previous change

This changes the test to use the common idion of the codebase.

gcc/ada/

* exp_util.adb (Make_CW_Equivalent_Type) <Has_Tag_Of_Type>: Tweak.

17 months agoada: Clean up interface handling in Expand_N_Object_Declaration
Eric Botcazou [Wed, 21 Dec 2022 11:41:50 +0000 (12:41 +0100)]
ada: Clean up interface handling in Expand_N_Object_Declaration

The code performing the expansion of objects with (class-wide) interface
type in Expand_N_Object_Declaration is fairly low-level, fiddling with the
homonym and entity chains, which is unnecessary.

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): Rewrite the end of the
handling of objects with (class-wide) interface type by using the
same idiom as the other cases generating a renaming.
* exp_util.adb (Is_Displacement_Of_Object_Or_Function_Result): Tweak
pattern matching code and exclude special return objects.
(Requires_Cleanup_Actions): Adjust comment.
* exp_ch7.adb (Build_Finalizer): Likewise.

17 months agoada: Flag renaming-as-spec as a body to inline
Piotr Trojanek [Tue, 20 Dec 2022 16:39:04 +0000 (17:39 +0100)]
ada: Flag renaming-as-spec as a body to inline

For GNAT the frontend is only inlining subprograms with explicit specs,
including specs completed with renaming-as-body. For GNATprove the
frontend must also inline renamings acting as specs. Otherwise, we will
try to build a body-to-inline with code that is can't handle unusual
subprogram renamings, e.g. those of the form "object.call".

gcc/ada/

* freeze.adb (Build_Renamed_Body): Rewrite subprogram renaming to
subprogram declaration early and then set the Body_To_Inling flag.

17 months agoada: Remove unhelpful special case for renamed bodies in GNATprove mode
Piotr Trojanek [Tue, 20 Dec 2022 15:27:30 +0000 (16:27 +0100)]
ada: Remove unhelpful special case for renamed bodies in GNATprove mode

This patch reverts a special-case related to inlining of renamed bodies
in GNATprove mode. Its idea was that inlining is decided in routine
Cannot_Inline, which is called much later. This didn't quite work,
because in the meantime the renamed body was prepared to inlining in
Build_Body_To_Inline, which was not designed to handle renamed bodies.

gcc/ada/

* freeze.adb (Build_Renamed_Body): Revert a special case for
GNATprove; remove unnecessary initialization of a local variable.

17 months agoada: Fix nested generic instantiation
Marc Poulhiès [Wed, 21 Dec 2022 09:29:38 +0000 (10:29 +0100)]
ada: Fix nested generic instantiation

Previous fix for generic instantiation was not precise enough and could
wrongly assume the instantiation node to be an N_Expanded_Name.

gcc/ada/

* sem_ch12.adb (Instantiate_Package_Body): Better filtering when
installing parent on the scope stack.

17 months agoada: Do not use decimal approximation in -gnatRj output
Eric Botcazou [Sat, 17 Dec 2022 12:16:35 +0000 (13:16 +0100)]
ada: Do not use decimal approximation in -gnatRj output

This avoids an unnecessary loss of precision for real values.

gcc/ada/

* repinfo.ads (The JSON output format): Document change.
* urealp.adb (UR_Write_To_JSON): Output a fraction instead of a
decimal approximation.

17 months agoada: Optimize class-wide objects initialized with function calls
Eric Botcazou [Mon, 19 Dec 2022 10:47:38 +0000 (11:47 +0100)]
ada: Optimize class-wide objects initialized with function calls

This optimizes the implementation of class-wide objects initialized with
function calls in the non-interface case, by avoiding an unnecessary copy
operation and/or a dispatching call to the _Size primitive when possible.

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): New local variable
Func_Id holding the function for a special return object.
Use a direct renaming in the class-wide case when the initializing
expression is a captured function call, except for a special return
object when the two functions do not return on the same stack.
Apply the accessibility check for class-wide special return objects.
* exp_util.adb (Make_CW_Equivalent_Type) <Has_Tag_Of_Type>: New.
Do not force a dispatching call to the primitive operation _Size if
the expression is known to statically have the tag of its type.

17 months agoada: Fix pasto in comment
Eric Botcazou [Tue, 20 Dec 2022 11:35:53 +0000 (12:35 +0100)]
ada: Fix pasto in comment

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): Fix pasto in comment.

17 months agoada: Fix spurious emissions of -gnatwj warning
Ronan Desplanques [Mon, 19 Dec 2022 17:37:19 +0000 (18:37 +0100)]
ada: Fix spurious emissions of -gnatwj warning

Before this patch, the compiler would erroneously emit a warning
about the use of parentheses for array aggregates being discouraged
in some situations. Those situations were the ones where array
aggregates were used as generic actuals when instantiating generic
packages defined in the runtime library.

This patch fixes this issue by looking at the Ada version explicitly
specified by the user instead of the Ada_Version flag which is
always set to the latest Ada version when compiling code from the
runtime library.

gcc/ada/

* sem_aggr.adb (Resolve_Array_Aggregate): Tweak conditions for
warning about use of parentheses for array aggregates.

17 months agoada: INOX: prototype RFC on String Interpolation
Javier Miranda [Fri, 4 Nov 2022 13:22:05 +0000 (13:22 +0000)]
ada: INOX: prototype RFC on String Interpolation

This patch incorporates a prototype for a new string literal syntax
which supports the use of "string interpolation," where the names
of variables or expressions can be used directly within the string
literal, such that the value of the variable or the expression is
"interpolated" directly into the value of the enclosing string
upon use at run-time.

gcc/ada/

* scans.ads (Tok_Left_Curly_Bracket, Tok_Right_Curly_Bracket)
(Tok_Left_Interpolated_String): Placed in no category since they
don't fit well in the existing categories. Fix typo in comment.
(Inside_Interpolated_String_Literal): New scan state variable.
* scng.adb (Slit): Scan interpolated string literals,
continuations of interpolated string literals and escaped
characters found in interpolated string literals.
(Scan): Handle consecutive interpolated expressions. Handle ending
delimiter placed immediately after an interpolated expression.
Handle string literal placed after interpolated expression. Handle
left and right curly brackets; when extensions are not allowed
they are treated as left and right paren; when extensions are
allowed they are handled as delimiters of interpolated string
literals.
* sinfo.ads (N_Interpolated_String_Literal): New node.
* gen_il-gen-gen_nodes.adb (N_Interpolated_String_Literal): Define
N_String_Literal node.
* gen_il-types.ads (Opt_Type_Enum): Define N_String_Literal as
concrete node type.
* par-ch2.adb (P_Interpolated_String_Literal): New subprogram.
* par-ch4.adb (P_Simple_Expression): Handle '}' as expression
terminator when scanning an interpolated expression; disable error
recovery machinery for binary operator when we are processing an
interpolated string literal and reach the expression terminator
'}'.
(P_Primary): Call P_Interpolated_String_Literal when the opening
interpolated-string-literal delimiter is found (that is, the left
curly bracket '{').
* par-tchk.adb (T_Right_Curly_Bracket): New subprogram.
* par.adb (P_Interpolated_String_Literal): New declaration.
(T_Right_Curly_Bracket): New declaration.
* sem.adb (Analyze): Call Analyze_Interpolated_String_Literal.
* sem_ch2.ads (Analyze_Interpolated_String_Literal): New
subprogram
* sem_ch2.adb (Analyze_Interpolated_String_Literal): Likewise.
* sem_util.adb (Is_User_Defined_Literal): Complete mapping of
literal aspects adding that interpolated string literals have no
correspondence with any aspect.
* sem_res.adb (Resolve_Interpolated_String_Literal): New
subprogram.
(Has_Applicable_User_Defined_Literal): Complete mapping of literal
aspects adding that interpolated string literals have no
correspondency with any aspect.
* expander.adb (Expand): Add call to
Expand_N_Interpolated_String_Literal.
* exp_util.adb (Insert_Actions): Handle
N_Interpolated_String_Literal nodes; that is, continue climbing.
* exp_ch2.ads (Expand_N_Interpolated_String_Literal): New
subprogram.
* exp_ch2.adb (Expand_N_Interpolated_String_Literal): Likewise.
* exp_put_image.adb (Build_Elementary_Put_Image_Call): Add missing
conversion to force dispatching call. Required to handle calls to
descendants.
(Build_String_Put_Image_Call): Do not output string delimiters
when the put_image call is part of an interpolated string literal.
* rtsfind.ads (RTU_Id): Add RE_Set_Trim_Leading_Spaces.
* sprint.adb (Sprint_Node): Output interpolated string contents.
* libgnat/a-stbubo.adb (Get_UTF_8): Add default value for
Trim_Leading_White_Spaces component in aggregate.
(Buffer_Type_Implementation): Update Trim_Leading_White_Spaces.
* libgnat/a-stbuun.adb (Get_UTF_8): Likewise.
(Buffer_Type_Implementation): Likewise.
* libgnat/a-sttebu.ads (Set_Trim_Leading_Spaces): New subprogram.
(Trim_Leading_Spaces): New subprogram.
(Root_Buffer_Type): Adding Trim_Leading_While_Spaces component.
* libgnat/a-sttebu.adb (procedure Set_Trim_Leading_Spaces): New
subprogram.
(Trim_Leading_Space): New subprogram.
(Put_UTF_8): Handle Trim_Leading_White_Spaces.
(New_Line): Likewise.
* libgnat/s-putima.ads (Put_Image_String): Adding formal
(with_delimiters).
(Put_Image_Wide_String): Likewise.
(Put_Image_Wide_Wide_String): Likewise.
* libgnat/s-putima.adb (Put_Image_String): Adding support for new
formal.
(Put_Image_Wide_String): Likewise.
(Put_Image_Wide_Wide_String): Likewise.

17 months agoada: Update gnatpp documentation with --layout switch
Joao Azevedo [Thu, 1 Dec 2022 15:55:11 +0000 (15:55 +0000)]
ada: Update gnatpp documentation with --layout switch

Update legacy switches.

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: add gnatpp --layout
switch and update legacy switches.

17 months agoada: Further adjust freezing for expansion of contracts
Eric Botcazou [Fri, 16 Dec 2022 15:32:15 +0000 (16:32 +0100)]
ada: Further adjust freezing for expansion of contracts

This further adjusts a test deciding whether to freeze an entity coming from
an outer scope in an inner scope based on language rules, to the presence of
the new internal subprogram generated because of post-conditions.

gcc/ada/

* freeze.adb (Freeze_Entity): For the purpose of deciding whether to
freeze an entity coming from an outer scope in an inner scope, treat
the internal subprogram generated because of post-conditions as also
coming from source if the original subprogram itself does.

17 months agoada: Simplify new expansion of contracts
Eric Botcazou [Thu, 15 Dec 2022 18:33:45 +0000 (19:33 +0100)]
ada: Simplify new expansion of contracts

We can now use an extended return statement in all cases since it no longer
generates an extra copy for nonlimited by-reference types.

gcc/ada/

* contracts.adb (Build_Subprogram_Contract_Wrapper): Generate an
extended return statement in all cases.
(Expand_Subprogram_Contract): Adjust comment.

17 months agoada: Adjust handling of "%g" in GNAT.Formatted_String
Ronan Desplanques [Wed, 14 Dec 2022 14:10:44 +0000 (15:10 +0100)]
ada: Adjust handling of "%g" in GNAT.Formatted_String

The way the "%g" specifier was handled by GNAT.Formatted_String
before this patch was very different from the behavior of C's printf.
This patch makes the handling of "%g" in GNAT.Formatted_String closer
to the behavior described in the specification of the C language.

gcc/ada/

* libgnat/g-forstr.adb (F_Kind): Rename enumeration literal.
(P_Flt_Format): Adjust handling of "%g".
(Determine_Notation_And_Aft): New procedure.
(Decimal_Exponent): New function.
(Increment_Integral_Part): New procedure.
(Remove_Extraneous_Decimal_Digit): New procedure.
(Trim_Fractional_Part): New procedure.
* libgnat/g-forstr.ads: Change description of "%g" specifier.

17 months agoada: Fix generic instantiation of sibling package
Marc Poulhiès [Thu, 15 Dec 2022 10:32:19 +0000 (11:32 +0100)]
ada: Fix generic instantiation of sibling package

The compiler would crash because it is failing at setting up the scope
stack correctly for a generic instantiation of a sibling package within
a child package instance. In this case, the parent instance isn't
explicitly referenced and it must be found differently.

gcc/ada/

* sem_ch12.adb (Instantiate_Package_Body): Correctly find the
parent instance to place on the scope stack.

17 months agoada: Spurious error on Lock_Free protected type with discriminants
Justin Squirek [Mon, 5 Dec 2022 22:05:44 +0000 (22:05 +0000)]
ada: Spurious error on Lock_Free protected type with discriminants

This patch corrects an issue in the compiler whereby unprefixed discriminants
appearing in protected subprograms were unable to be properly resolved -
leading to spurious resolution errors.

gcc/ada/

* sem_ch8.adb (Set_Entity_Or_Discriminal): Verify we are actually
resetting the entity field of a non-prefixed discriminant
reference.

17 months agoada: Revert to constrained allocation for string concatenation
Eric Botcazou [Thu, 15 Dec 2022 13:47:44 +0000 (14:47 +0100)]
ada: Revert to constrained allocation for string concatenation

Using an unconstrained allocation is less efficient in the general case.

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): New local variable used
throughout instead of testing Is_Special_Return_Object every time.
Do not rename an OK_To_Rename object for a special return object.
* exp_ch4.adb (Expand_Concatenate): Revert to constrained allocation
if the result is allocated on the secondary stack.

17 months agoada: Better error message for bad Discard_Names configuration pragma
Steve Baird [Wed, 14 Dec 2022 17:54:08 +0000 (09:54 -0800)]
ada: Better error message for bad Discard_Names configuration pragma

When a pragma Discard_Names is used as a configuration pragma, it does not
take an argument. If an argument is given, the resulting error message was
incorrect and confusing.

gcc/ada/

* sem_prag.adb (Analyze_Pragma): Fix Is_Configuration_Pragma
function to handle case where the pragma's parent is an
N_Aspect_Specification node. In analyzing a Discard_Names pragma,
do not assume that a nonzero number of arguments implies that the
pragma is not a configuration pragma; that assumption only holds
for legal programs.

17 months agoada: Update doc for -gnatw_q
Bob Duff [Wed, 14 Dec 2022 18:16:03 +0000 (13:16 -0500)]
ada: Update doc for -gnatw_q

The -gnatw_q switch turns on warnings for noncomposing "="
operators. This patch updates the doc to refer to relevant
RM paragraphs.

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Add RM references.
* gnat_ugn.texi: Regenerate.

17 months agoada: Fix finalization issues in extended return statements
Eric Botcazou [Wed, 14 Dec 2022 14:16:21 +0000 (15:16 +0100)]
ada: Fix finalization issues in extended return statements

The first issue pertains to return objects of (class-wide) interface types,
which need to be adjusted if the type is not inherently limited.  The second
issue is for return objects of non-class-wide types that are initialized by
a function call, which can use a direct renaming only if the object doing
the capture of the function call is flagged by Is_Related_To_Func_Return.
The third one is that, in the second case, we may need to reassign the tag.

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): For a special return
object of an interface type that is not inherently limited, make
a call to the Adjust primitive after doing the copy.  For a special
return object of a non-class-wide type initialized by a function
call, use a direct renaming only if the object doing the capture
is flagged by Is_Related_To_Func_Return.  For a special return
object using a direct renaming, reassign the tag, if need be.
* exp_ch6.adb (Expand_Simple_Function_Return): Fix comment.
* exp_util.adb (Is_Related_To_Func_Return): Accept both regular and
renaming object declarations for return objects.

17 months agoada: Fix incorrect warning about unreferenced packed arrays
Bob Duff [Mon, 12 Dec 2022 20:31:05 +0000 (15:31 -0500)]
ada: Fix incorrect warning about unreferenced packed arrays

This patch fixes a bug in which a reference to a renaming of a
component of a packed array was not counted as a reference,
and thus caused incorrect warnings about unreferenced objects.

gcc/ada/

* sem_ch5.adb (Analyze_Assignment): Fix the bug by checking
Original_Node. The renaming might be elsewhere, but the (original)
reference is right here.
* errout.adb: Remove pragma Unreferenced which was added because
of the above bug.
* einfo.ads: Misc cleanup.
* lib.adb: Likewise.
* lib.ads: Likewise.

17 months agoAdd missing declarations to gcc/m2/gm2-libs-min/M2RTS.{def,mod}
Gaius Mulley [Thu, 5 Jan 2023 14:13:43 +0000 (14:13 +0000)]
Add missing declarations to gcc/m2/gm2-libs-min/M2RTS.{def,mod}

This patch adds two missing procedures to
gcc/m2/gm2-libs-min/M2RTS.{def,mod} required for linking.  The
patch also includes test code, changes to
gcc/testsuite/lib/gm2.exp and an expect tcl script to test the
min libraries.

gcc/m2/ChangeLog:

* gm2-libs-min/M2RTS.def (ConstructModules): New procedure
declaration.
(DeconstructModules): New procedure declaration.
* gm2-libs-min/M2RTS.mod (ConstructModules): New procedure
dummy implementation.
(DeconstructModules): New procedure dummy implementation.

gcc/testsuite:

* lib/gm2.exp (gm2_init_minx): New procedure.
(gm2_init_min): New procedure calls gm2_init_min with
dialect flags.
* gm2/link/min/pass/tiny.mod: New test case.
* gm2/link/min/pass/link-min-pass.exp: New file.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
17 months agomodula-2, driver: Implement handling for -static-libgm2.
Iain Sandoe [Sun, 1 Jan 2023 20:47:42 +0000 (20:47 +0000)]
modula-2, driver: Implement handling for -static-libgm2.

This was unimplemented so far.

gcc/ChangeLog:

* common.opt: Add -static-libgm2.
* config/darwin.h (LINK_SPEC): Handle static-libgm2.
* doc/gm2.texi: Document static-libgm2.
* gcc.cc (driver_handle_option): Allow static-libgm2.

gcc/m2/ChangeLog:

* gm2spec.cc (lang_specific_driver): Handle static-libgm2.
* lang.opt: Add static-libgm2.

17 months agomodula-2, driver: Handle static-libstd++ for targets without static/dynamic
Iain Sandoe [Thu, 22 Dec 2022 19:00:13 +0000 (19:00 +0000)]
modula-2, driver: Handle static-libstd++ for targets without static/dynamic

The follows the pattern used in C++ and D drivers to pass -static-libstdc++
onto the target driver to allow spec substitution of static libraries.

NOTE: The handling of Bstatic/dynamic and the possible use of static libgm2
libraries is unimplemented in this driver so far.

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

* gm2spec.cc (lang_specific_driver): Pass -static-libstdc++ on to
the target driver if the linker does not support Bstatic/dynamic.

17 months agoopenmp: Fix up finish_omp_target_clauses [PR108286]
Jakub Jelinek [Thu, 5 Jan 2023 10:57:30 +0000 (11:57 +0100)]
openmp: Fix up finish_omp_target_clauses [PR108286]

The comment in the loop says that we shouldn't add a map clause if such
a clause exists already, but the loop was actually using OMP_CLAUSE_DECL
on any clause.  Target construct can have various clauses which don't
have OMP_CLAUSE_DECL at all (e.g. nowait, device or if) or clause
where it means something different (e.g. privatization clauses, allocate,
depend).

So, only check OMP_CLAUSE_DECL on OMP_CLAUSE_MAP clauses.

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

PR c++/108286
* semantics.cc (finish_omp_target_clauses): Ignore clauses other than
OMP_CLAUSE_MAP.

* testsuite/libgomp.c++/pr108286.C: New test.

17 months agoAdd AMD znver4 instruction reservations
Tejas Joshi [Tue, 8 Nov 2022 18:40:59 +0000 (00:10 +0530)]
Add AMD znver4 instruction reservations

This adds znver4 automata units and reservations separately from other
znver automata, avoiding the insn-automata.cc size blow-up.

gcc/ChangeLog:

* common/config/i386/i386-common.cc (processor_alias_table):
Use CPU_ZNVER4 for znver4.
* config/i386/i386.md: Add znver4.md.
* config/i386/znver4.md: New.

17 months agolibstdc++: Support single components in name of chrono::current_zone() [PR108211]
Jonathan Wakely [Wed, 4 Jan 2023 20:49:59 +0000 (20:49 +0000)]
libstdc++: Support single components in name of chrono::current_zone() [PR108211]

We currently only handle the case where /etc/localtime is a symlink to a
path like ".../Etc/UTC" and fail for ".../UTC". This makes both work.

libstdc++-v3/ChangeLog:

PR libstdc++/108211
* src/c++20/tzdb.cc (chrono::current_zone()): Check for zone
using only last component of the name.

17 months agolibstdc++: Only use std::atomic<tzdb_list::_Node*> if lock free [PR108228]
Jonathan Wakely [Wed, 4 Jan 2023 16:45:14 +0000 (16:45 +0000)]
libstdc++: Only use std::atomic<tzdb_list::_Node*> if lock free [PR108228]

This fixes linker errors for hppa-hp-hpux11.11 due to an undefined weak
symbol and the use of atomic operations that require libatomic.

The weak symbol can simply be defined, which we already do for darwin.

The std::atomic<_Node*> is only an optimization, so can be avoided for
targets where the underlying atomic ops aren't available without help
from libatomic. The accesses to the std::atomic<_Node*> can be
abstracted behind a new API for getting and setting the cached value,
and then the atomics can be used conditionally.

libstdc++-v3/ChangeLog:

PR libstdc++/108228
PR libstdc++/108235
* config/abi/pre/gnu.ver: Move zoneinfo_dir_override export to
the latest symbol version.
* src/c++20/tzdb.cc (USE_ATOMIC_SHARED_PTR): Define to 0 if
atomic<_Node*> is not always lock free.
(USE_ATOMIC_LIST_HEAD): New macro.
[__hpux__] (__gnu_cxx::zoneinfo_dir_override()): Provide
definition of weak symbol.
(tzdb_list::_Node::_S_head): Rename to _S_head_cache.
(tzdb_list::_Node::_S_list_head): New function for accessing
list head efficiently.
(tzdb_list::_Node::_S_cache_list_head): New function for
updating _S_list_head.

17 months agolibstdc++: Fix std::chrono::hh_mm_ss with unsigned rep [PR108265]
Jonathan Wakely [Wed, 4 Jan 2023 16:43:51 +0000 (16:43 +0000)]
libstdc++: Fix std::chrono::hh_mm_ss with unsigned rep [PR108265]

libstdc++-v3/ChangeLog:

PR libstdc++/108265
* include/std/chrono (hh_mm_ss): Do not use chrono::abs if
duration rep is unsigned.
* testsuite/std/time/hh_mm_ss/1.cc: Check unsigned rep.

17 months agoDaily bump.
GCC Administrator [Thu, 5 Jan 2023 00:17:41 +0000 (00:17 +0000)]
Daily bump.

17 months agoc++: mark_single_function and SFINAE [PR108282]
Patrick Palka [Wed, 4 Jan 2023 19:12:25 +0000 (14:12 -0500)]
c++: mark_single_function and SFINAE [PR108282]

We typically ignore mark_used failure when in a non-SFINAE context for
sake of better error recovery.  But in mark_single_function we're
instead ignoring mark_used failure in a SFINAE context, which ends up
causing the second static_assert here to incorrectly fail.

PR c++/108282

gcc/cp/ChangeLog:

* decl2.cc (mark_single_function): Ignore mark_used failure
only in a non-SFINAE context rather than in a SFINAE one.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-requires34.C: New test.

17 months agoc++: Error recovery in merge_default_template_args [PR108206]
Jakub Jelinek [Wed, 4 Jan 2023 17:42:31 +0000 (18:42 +0100)]
c++: Error recovery in merge_default_template_args [PR108206]

We ICE on the following testcase during error recovery, both new_parm
and old_parm are error_mark_node, the ICE is on
          error ("redefinition of default argument for %q+#D", new_parm);
          inform (DECL_SOURCE_LOCATION (old_parm),
                  "original definition appeared here");
where we don't print anything useful for new_parm and ICE trying to
access DECL_SOURCE_LOCATION of old_parm.  I think we shouldn't diagnose
anything when either of the parms is erroneous, GCC 11 before
merge_default_template_args has been added was doing
      if (TREE_VEC_ELT (tmpl_parms, i) == error_mark_node
          || TREE_VEC_ELT (parms, i) == error_mark_node)
        continue;

      tmpl_parm = TREE_VALUE (TREE_VEC_ELT (tmpl_parms, i));
      if (error_operand_p (tmpl_parm))
        return false;
in redeclare_class_template.

2023-01-04  Jakub Jelinek  <jakub@redhat.com>

PR c++/108206
* decl.cc (merge_default_template_args): Return false if either
new_parm or old_parm are erroneous.

* g++.dg/template/pr108206.C: New test.

17 months agoAvoid quadratic behaviour of LTO symbol promotion
Jan Hubicka [Wed, 4 Jan 2023 17:03:53 +0000 (18:03 +0100)]
Avoid quadratic behaviour of LTO symbol promotion

LTO partitioning does renaming of symbols that ends up in same partition
and clash with assembler name.  This is done for "ordinary" symbols (such
as static functions) but also for symbols that are kept only as master
clones holding bodies of functions to be specialized later.
This is done only becuase we stream bodies to named section and clash
in names would mean that ltrans will load wrong body and crash.

Martin recently added bit to stream body for clones that are needed
since this makes it easier to bookeep what summaries are output.  THis
however triggers mass renaming of inline clones that is very slow
and unnecesary since their bodies are never streamed.

Bootstrapped/regtested x86_64-linux, comitted.

gcc/lto/ChangeLog:

2023-01-04  Jan Hubicka  <hubicka@ucw.cz>

* lto-partition.cc (may_need_named_section_p): Clones with no body
need no remaning.

17 months agolibstdc++: Export the __gnu_cxx::zoneinfo_dir_override symbol [PR108228].
Iain Sandoe [Sat, 24 Dec 2022 10:55:09 +0000 (10:55 +0000)]
libstdc++: Export the __gnu_cxx::zoneinfo_dir_override symbol [PR108228].

This symbol needs to be visible in the library interface for Darwin
to override it with a user-provided one.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR libstdc++/108228

libstdc++-v3/ChangeLog:

* config/abi/pre/gnu.ver (GLIBCXX_3.4):
Add __gnu_cxx::zoneinfo_dir_override().

17 months agomodula-2: Fix registration of modules via constructors [PR108183].
Iain Sandoe [Fri, 30 Dec 2022 19:46:13 +0000 (19:46 +0000)]
modula-2: Fix registration of modules via constructors [PR108183].

This reworks the mechanism used for module registration to use init-
time constructors.  The order of registration is not important, the
actual initialization dependency tree will be computed early in the
execution (all that matters is that we have registered before that).

This fixes a potential issue in which the external name known to the
m2 system is of the form _M2_XXXXXX_ctor() but the C++ code was
producing a static variable instance with the same name.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR modula2/108183

gcc/m2/ChangeLog:

* gm2-libs-ch/UnixArgs.cc (_M2_UnixArgs_ctor): Rework to use
an extern "C" function with 'constructor' attribute.
* gm2-libs-ch/dtoa.cc (_M2_dtoa_ctor): Likewise.
* gm2-libs-ch/ldtoa.cc (_M2_ldtoa_ctor): Likewise.

libgm2/ChangeLog:

* libm2cor/KeyBoardLEDs.cc (_M2_KeyBoardLEDs_ctor): Rework to use
an extern "C" function with 'constructor' attribute.
* libm2iso/ErrnoCategory.cc (_M2_ErrnoCategory_ctor): Likewise.
* libm2iso/RTco.cc (_M2_RTco_ctor): Likewise.
* libm2pim/Selective.cc (_M2_Selective_ctor): Likewise.
* libm2pim/SysExceptions.cc (_M2_SysExceptions_ctor): Likewise.
* libm2pim/UnixArgs.cc (_M2_UnixArgs_ctor): Likewise.
* libm2pim/cgetopt.cc (_M2_cgetopt_ctor): Likewise.
* libm2pim/dtoa.cc (_M2_dtoa_ctor): Likewise.
* libm2pim/errno.cc (_M2_errno_ctor): Likewise.
* libm2pim/ldtoa.cc (_M2_ldtoa_ctor): Likewise.
* libm2pim/sckt.cc (_M2_sckt_ctor): Likewise.
* libm2pim/termios.cc (_M2_termios_ctor): Likewise.
* libm2pim/wrapc.c: Add a new line to the file end.

17 months agomodula-2: Module registration constructors need to be visible [PR108259].
Iain Sandoe [Sun, 1 Jan 2023 15:42:03 +0000 (15:42 +0000)]
modula-2: Module registration constructors need to be visible [PR108259].

In the current design the main executable links explicitly to the module
registration construtors that it uses.  This means that they must be
visible in shared libraries.

PR modula2/108259

gcc/m2/ChangeLog:

* gm2-gcc/m2decl.cc (m2decl_DeclareModuleCtor): Make module
registration constructors visible.

17 months agomodula-2, doc: Build dvi, ps and pdf doc in the gcc/doc directory.
Iain Sandoe [Sat, 31 Dec 2022 13:22:56 +0000 (13:22 +0000)]
modula-2, doc: Build dvi, ps and pdf doc in the gcc/doc directory.

This also uses the configured $(TEXI2DVI) and $(TEXI2PDF) to deal with those
targets (since we cannot assume to know what the use might have installed).

gcc/m2/ChangeLog:

* Make-lang.in (dvi, ps, pdf): Build in the gcc/doc directory, also
use the configured tools for texi -> dvi and texi -> pdf.

17 months agoModula-2, testsuite: No 96 bit floating type on Darwin.
Iain Sandoe [Sat, 31 Dec 2022 13:59:41 +0000 (13:59 +0000)]
Modula-2, testsuite: No 96 bit floating type on Darwin.

The realbitscast.mod is currently failing on x86_64 and aarch64
Darwin since they do not have a 96b floating type.  Disable the
type for all Darwin arches.

gcc/testsuite/ChangeLog:

* gm2/iso/pass/realbitscast.mod: Disable REAL96 on Darwin.

17 months agoMAINTAINERS: Add myself as Modula-2 front-end maintainer
Gaius Mulley [Wed, 4 Jan 2023 12:52:15 +0000 (12:52 +0000)]
MAINTAINERS: Add myself as Modula-2 front-end maintainer

Update MAINTAINERS file.

Changelog:

* MAINTAINERS: Add Gaius Mulley as Modula-2 front-end maintainer.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
17 months agolibstdc++: Fix std::array<T, 0>::data() to be a constant expression [PR108258]
Jonathan Wakely [Wed, 4 Jan 2023 11:49:19 +0000 (11:49 +0000)]
libstdc++: Fix std::array<T, 0>::data() to be a constant expression [PR108258]

When I refactored the __array_traits helper I broke this.

libstdc++-v3/ChangeLog:

PR libstdc++/108258
* include/std/array (__array_traits<T, 0>::operator T*()): Add
constexpr.
* testsuite/23_containers/array/element_access/constexpr_c++17.cc: Check
std::array<T, 0>::data().

17 months agovrp: Handle pointers in maybe_set_nonzero_bits [PR108253]
Jakub Jelinek [Wed, 4 Jan 2023 11:16:22 +0000 (12:16 +0100)]
vrp: Handle pointers in maybe_set_nonzero_bits [PR108253]

maybe_set_nonzero_bits calls set_nonzero_bits which asserts that
var doesn't have pointer type.  While we could punt for those
cases, I think we can handle at least some easy cases.
Earlier in maybe_set_nonzero_bits we've checked this is on
(var & cst) == 0
edge and the other edge is __builtin_unreachable, so if cst
is say 3 as in the testcase, we want to turn it into 4 byte alignment
of the pointer.

2023-01-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/108253
* tree-vrp.cc (maybe_set_nonzero_bits): Handle var with pointer
types.

* g++.dg/opt/pr108253.C: New test.

17 months agogeneric-match-head: Don't assume GENERIC folding is done only early [PR108237]
Jakub Jelinek [Wed, 4 Jan 2023 09:54:38 +0000 (10:54 +0100)]
generic-match-head: Don't assume GENERIC folding is done only early [PR108237]

We ICE on the following testcase, because a valid V2DImode
!= comparison is folded into an unsupported V2DImode > comparison.
The match.pd pattern which does this looks like:
/* Transform comparisons of the form (X & Y) CMP 0 to X CMP2 Z
   where ~Y + 1 == pow2 and Z = ~Y.  */
(for cst (VECTOR_CST INTEGER_CST)
 (for cmp (eq ne)
      icmp (le gt)
  (simplify
   (cmp (bit_and:c@2 @0 cst@1) integer_zerop)
    (with { tree csts = bitmask_inv_cst_vector_p (@1); }
     (if (csts && (VECTOR_TYPE_P (TREE_TYPE (@1)) || single_use (@2)))
      (with { auto optab = VECTOR_TYPE_P (TREE_TYPE (@1))
                         ? optab_vector : optab_default;
              tree utype = unsigned_type_for (TREE_TYPE (@1)); }
       (if (target_supports_op_p (utype, icmp, optab)
            || (optimize_vectors_before_lowering_p ()
                && (!target_supports_op_p (type, cmp, optab)
                    || !target_supports_op_p (type, BIT_AND_EXPR, optab))))
        (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
         (icmp @0 { csts; })
         (icmp (view_convert:utype @0) { csts; })))))))))
and that optimize_vectors_before_lowering_p () guarded stuff there
already deals with this problem, not trying to fold a supported comparison
into a non-supported one.  The reason it doesn't work in this case is that
it isn't GIMPLE folding which does this, but GENERIC folding done during
forwprop4 - forward_propagate_into_comparison -> forward_propagate_into_comparison_1
-> combine_cond_expr_cond -> fold_binary_loc -> generic_simplify
and we simply assumed that GENERIC folding happens only before
gimplification.

The following patch fixes that by checking cfun properties instead of
always returning true in those cases.

2023-01-04  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/108237
* generic-match-head.cc: Include tree-pass.h.
(canonicalize_math_p, optimize_vectors_before_lowering_p): Define
to false if cfun and cfun->curr_properties has PROP_gimple_opt_math
resp. PROP_gimple_lvec property set.

* gcc.c-torture/compile/pr108237.c: New test.

17 months agoubsan: Avoid narrowing of multiply for -fsanitize=signed-integer-overflow [PR108256]
Jakub Jelinek [Wed, 4 Jan 2023 09:52:49 +0000 (10:52 +0100)]
ubsan: Avoid narrowing of multiply for -fsanitize=signed-integer-overflow [PR108256]

We shouldn't narrow multiplications originally done in signed types,
because the original multiplication might overflow but the narrowed
one will be done in unsigned arithmetics and will never overflow.

2023-01-04  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/108256
* convert.cc (do_narrow): Punt for MULT_EXPR if original
type doesn't wrap around and -fsanitize=signed-integer-overflow
is on.
* fold-const.cc (fold_unary_loc) <CASE_CONVERT>: Likewise.

* c-c++-common/ubsan/pr108256.c: New test.

17 months agoInitial Emeraldrapids Support
Hu, Lin1 [Thu, 15 Dec 2022 07:51:44 +0000 (15:51 +0800)]
Initial Emeraldrapids Support

gcc/ChangeLog:

* common/config/i386/cpuinfo.h (get_intel_cpu): Handle Emeraldrapids.
* common/config/i386/i386-common.cc: Add Emeraldrapids.

17 months agoi386: Remove Meteorlake's family_model
Hu, Lin1 [Thu, 15 Dec 2022 07:51:18 +0000 (15:51 +0800)]
i386: Remove Meteorlake's family_model

gcc/ChangeLog:

* common/config/i386/cpuinfo.h (get_intel_cpu): Remove case 0xb5
for meteorlake.

17 months agoDaily bump.
GCC Administrator [Wed, 4 Jan 2023 00:17:22 +0000 (00:17 +0000)]
Daily bump.

17 months agotestsuite: AIX
David Edelsohn [Mon, 26 Dec 2022 23:01:29 +0000 (18:01 -0500)]
testsuite: AIX

C++ Modules do not work reliably on AIX.  This patch disables the
modules portion of the testsuite on AIX.

IBM128 float keywords not enabled for AIX, so skip this test.

gcc/testsuite/ChangeLog:

* g++.dg/modules/modules.exp: Skip on AIX.
* gcc.target/powerpc/pr99708.c: Skip on AIX.

17 months agoOpenMP: GC unused SIMD clones
Sandra Loosemore [Tue, 3 Jan 2023 17:46:02 +0000 (17:46 +0000)]
OpenMP: GC unused SIMD clones

SIMD clones are created during the IPA phase when it is not known whether
or not the vectorizer can use them.  Clones for functions with external
linkage are part of the ABI, but local clones can be GC'ed if no calls are
found in the compilation unit after vectorization.

gcc/ChangeLog
* cgraph.h (struct cgraph_node): Add gc_candidate bit, modify
default constructor to initialize it.
* cgraphunit.cc (expand_all_functions): Save gc_candidate functions
for last and iterate to handle recursive calls.  Delete leftover
candidates at the end.
* omp-simd-clone.cc (simd_clone_create): Set gc_candidate bit
on local clones.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Clear
gc_candidate bit when a clone is used.

gcc/testsuite/ChangeLog
* g++.dg/gomp/target-simd-clone-1.C: Tweak to test
that the unused clone is GC'ed.
* gcc.dg/gomp/target-simd-clone-1.c: Likewise.

17 months agolibgcc: Specialize execute_cfa_program in DWARF unwinder for alignments [redo]
Florian Weimer [Tue, 3 Jan 2023 15:47:32 +0000 (16:47 +0100)]
libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments [redo]

The parameters fs->data_align and fs->code_align always have fixed
values for a particular target in GCC-generated code.  Specialize
execute_cfa_program for these values, to avoid multiplications.

gcc/c-family/

* c-cppbuiltin.cc (c_cpp_builtins): Define
__LIBGCC_DWARF_CIE_DATA_ALIGNMENT__.

libgcc/

* unwind-dw2-execute_cfa.h: New file.  Extracted from
the execute_cfa_program function in unwind-dw2.c.
* unwind-dw2.c (execute_cfa_program_generic): New function.
(execute_cfa_program_specialized): Likewise.
(execute_cfa_program): Call execute_cfa_program_specialized
or execute_cfa_program_generic, as appropriate.

17 months agoRevert "Compute a table of DWARF register sizes at compile"
Florian Weimer [Tue, 3 Jan 2023 15:47:31 +0000 (16:47 +0100)]
Revert "Compute a table of DWARF register sizes at compile"

This reverts commit 3b6cac2b44b384cd2091eaeaebeb3478c253a25d.

17 months agoRevert "Define __LIBGCC_DWARF_REG_SIZES_CONSTANT__ if DWARF register size is constant"
Florian Weimer [Tue, 3 Jan 2023 15:47:31 +0000 (16:47 +0100)]
Revert "Define __LIBGCC_DWARF_REG_SIZES_CONSTANT__ if DWARF register size is constant"

This reverts commit 97bbdb726aba76ead550e25061029cf0aa78671b.

17 months agoRevert "libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments"
Florian Weimer [Tue, 3 Jan 2023 15:47:31 +0000 (16:47 +0100)]
Revert "libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments"

This reverts commit cb775ecd6e437de8fdba9a3f173f3787e90e98f2.

17 months agotree-optimization/105043: Object Size Checking docs cleanup
Siddhesh Poyarekar [Thu, 15 Dec 2022 19:24:55 +0000 (14:24 -0500)]
tree-optimization/105043: Object Size Checking docs cleanup

Break the _FORTIFY_SOURCE-specific builtins out into a separate
subsection from Object Size Checking built-ins and mention
_FORTIFY_SOURCE in there so that the link between the object size
checking builtins, the helper builtins (e.g. __builtin___memcpy_chk) and
_FORTIFY_SOURCE is clearer.

gcc/ChangeLog:

PR tree-optimization/105043
* doc/extend.texi (Object Size Checking): Split out into two
subsections and mention _FORTIFY_SOURCE.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
17 months agoImprove ix86_expand_int_movcc to allow condition (mask) sharing.
Roger Sayle [Tue, 3 Jan 2023 13:40:47 +0000 (13:40 +0000)]
Improve ix86_expand_int_movcc to allow condition (mask) sharing.

This patch modifies the way that ix86_expand_int_movcc generates RTL,
to allow the condition mask to be shared/reused between multiple
conditional move sequences.  Such redundancy is common when RTL
if-conversion transforms non-trivial basic blocks.

As a motivating example, consider the new test case:

int a, b, c, d;
int foo(int x)
{
    if (x == 0) {
        a = 3;
        b = 1;
        c = 4;
        d = 1;
    } else {
        a = 5;
        b = 9;
        c = 2;
        d = 7;
    }
    return x;
}

This is currently compiled, with -O2, to:

foo: cmpl $1, %edi
movl %edi, %eax
sbbl %edi, %edi
andl $-2, %edi
addl $5, %edi
cmpl $1, %eax
sbbl %esi, %esi
movl %edi, a(%rip)
andl $-8, %esi
addl $9, %esi
cmpl $1, %eax
sbbl %ecx, %ecx
movl %esi, b(%rip)
andl $2, %ecx
addl $2, %ecx
cmpl $1, %eax
sbbl %edx, %edx
movl %ecx, c(%rip)
andl $-6, %edx
addl $7, %edx
movl %edx, d(%rip)
ret

Notice that the if-then-else blocks have been if-converted into four
conditional move sequences/assignments, each consisting of cmpl, sbbl,
andl and addl.  However, as the conditions are the same, the cmpl and
sbbl instructions used to generate the mask could be shared by CSE.

This patch enables that so that we now generate:

foo:    cmpl    $1, %edi
        movl    %edi, %eax
        sbbl    %edx, %edx
        movl    %edx, %edi
        movl    %edx, %esi
        movl    %edx, %ecx
        andl    $-6, %edx
        andl    $-2, %edi
        andl    $-8, %esi
        andl    $2, %ecx
        addl    $7, %edx
        addl    $5, %edi
        addl    $9, %esi
        addl    $2, %ecx
        movl    %edx, d(%rip)
        movl    %edi, a(%rip)
        movl    %esi, b(%rip)
        movl    %ecx, c(%rip)
        ret

Notice, the code now contains only a single cmpl and a single sbbl,
with result being shared (via movl).

2023-01-03  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/i386/i386-expand.cc (ix86_expand_int_movcc): Rewrite
RTL expansion to allow condition (mask) to be shared/reused,
by avoiding overwriting pseudos and adding REG_EQUAL notes.

gcc/testsuite/ChangeLog
* gcc.target/i386/cmov10.c: New test case.

17 months agoPR target/108229: A minor STV compute_convert_gain tweak on x86.
Roger Sayle [Tue, 3 Jan 2023 13:37:31 +0000 (13:37 +0000)]
PR target/108229: A minor STV compute_convert_gain tweak on x86.

This patch addresses PR target/108229, which is a change in code
generation during the STV pass, due to the recently approved patch
to handle vec_select (reductions) in the vector unit.  The recent
change is innocent, but exposes a latent STV "gain" calculation issue
that is benign (or closely balanced) on most microarchitectures.

The issue is when STV considers converting PLUS with a MEM operand.

On TARGET_64BIT (m=1):
addq 24(%rdi), %rdx // 4 bytes
or with -m32 (m=2)
        addl    24(%esi), %eax // 3 bytes
        adcl    28(%esi), %edx // 3 bytes
is being converted by STV to
        vmovq   24(%rdi), %xmm5 // 5 bytes
        vpaddq  %xmm5, %xmm4, %xmm4 // 4 bytes

The current code in general_scalar_chain::compute_convert_gain
considers that scalar unit addition is replaced with a vector
unit addition (usually about the same cost), but doesn't consider
anything special about MEM operands, assuming that a scalar load
gains/costs nothing compared to a vector load.  We can allow the
backend slightly better fine tuning by including in the gain
calculation that m scalar loads are being replaced by one vector
load, and when optimizing for size including that we're increasing
code size (e.g. an extra vmovq instruction for a MEM operand).

This patch is a win on the CSiBE benchmark when compiled with -Os.

2023-01-03  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR target/108229
* config/i386/i386-features.cc
(general_scalar_chain::compute_convert_gain) <case PLUS>: Consider
the gain/cost of converting a MEM operand.

17 months agoexpr: Fix up store_expr into SUBREG_PROMOTED_* target [PR108264]
Jakub Jelinek [Tue, 3 Jan 2023 11:13:24 +0000 (12:13 +0100)]
expr: Fix up store_expr into SUBREG_PROMOTED_* target [PR108264]

The following testcase ICEs on s390x-linux (e.g. with -march=z13).
The problem is that target is (subreg/s/u:SI (reg/v:DI 66 [ x+-4 ]) 4)
and we call convert_move from temp to the SUBREG_REG of that, expecting
to extend the value properly.  That works nicely if temp has some
scalar integer mode (or partial one), but ICEs when temp has V4QImode
on the assertion that from and to modes have the same bitsize.
store_expr generally allows say store from V4QI to SI target because
they have the same size and if temp is a CONST_INT, we already have code
to convert the constant properly, so the following patch just adds handling
of non-scalar integer modes by converting them to the mode of target
first before convert_move extends them.

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

PR middle-end/108264
* expr.cc (store_expr): For stores into SUBREG_PROMOTED_* targets
from source which doesn't have scalar integral mode first convert
it to outer_mode.

* gcc.dg/pr108264.c: New test.

17 months agocfgrtl: Don't try to redirect asm goto to EXIT [PR108263]
Jakub Jelinek [Tue, 3 Jan 2023 11:12:35 +0000 (12:12 +0100)]
cfgrtl: Don't try to redirect asm goto to EXIT [PR108263]

The following testcase distilled from Linux kernel on ppc64le ICEs,
because fixup_reorder_chain sees a bb with a single fallthru edge
falling into a bb with simple return and decides to redirect
that fallthru edge to EXIT.  That is possible if the bb ending
in the fallthru edge doesn't end with a jump or ends with a normal
unconditional jump, but not when the bb ends with asm goto which can despite
a single fallthru have multiple labels to the fallthrough basic block.

The following patch makes sure we never try to redirect such cases to EXIT.

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

PR rtl-optimization/108263
* cfgrtl.cc (fixup_reorder_chain): Avoid trying to redirect
asm goto to EXIT.

* gcc.dg/pr108263.c: New test.

17 months agoada: Fix unescaped quotes when combining fdiagnostics-format=json and gnatdJ
Ghjuvan Lacambre [Mon, 12 Dec 2022 13:54:47 +0000 (14:54 +0100)]
ada: Fix unescaped quotes when combining fdiagnostics-format=json and gnatdJ

This commit fixes a small bug where GNAT would emit unescaped quotes in
its -fdiagnostics-format=json output when using -gnatdJ and emitting
messages about operator functions (e.g. "=").

gcc/ada/

* errout.adb (Write_JSON_Span): Escape subprogram name.

17 months agoada: output.adb: fix newline being inserted when buffer is full
Ghjuvan Lacambre [Thu, 8 Dec 2022 08:58:28 +0000 (09:58 +0100)]
ada: output.adb: fix newline being inserted when buffer is full

Before this commit, when GNAT needed to emit lines longer than
the buffer, it accidentally inserted a newline in its output when
attempting to flush its buffer.

We fix this by using Flush_Buffer instead of Write_Eol in Write_Char.

gcc/ada/

* output.adb (Write_Buffer): Use Flush_Buffer instead of Write_Eol.

17 months agoada: Fix GNAT.Formatted_String's handling of real values
Ronan Desplanques [Fri, 9 Dec 2022 10:29:02 +0000 (11:29 +0100)]
ada: Fix GNAT.Formatted_String's handling of real values

Before this patch, passing a width and a precision through
arguments with the "*" syntax always failed for real values in
GNAT.Formatted_String's routines.

gcc/ada/

* libgnat/g-forstr.adb (P_Flt_Format): Add "*" syntax handling.

17 months agoada: Fix parsing bug in GNAT.Formatted_String
Ronan Desplanques [Fri, 9 Dec 2022 10:29:02 +0000 (11:29 +0100)]
ada: Fix parsing bug in GNAT.Formatted_String

Before this patch, GNAT.Formatted_String.Formatted_String failed to
handle format strings with two or more specifiers whose widths were
specified with the "*" syntax. This patch makes the parser
correctly reset its bits of state related to width and precision
parsing when needed.

gcc/ada/

* libgnat/g-forstr.adb (P_Int_Format): Fix parsing bug.

17 months agoada: Fix premature finalization of return temporary
Eric Botcazou [Fri, 9 Dec 2022 23:51:10 +0000 (00:51 +0100)]
ada: Fix premature finalization of return temporary

Various parts of the expander and the code generator must have a consistent
view on which temporaries generated for return statements must be finalized
because they are regular temporaries, and which ones must not be since they
are allocated on the return stack directly.  The Is_Related_To_Func_Return
predicate is used for this purpose and needs to be tested consistently.

gcc/ada/

* exp_ch6.adb (Expand_Simple_Function_Return): Make sure that a
captured function call also verifies Is_Related_To_Func_Return.
Do not generate an actual subtype for special return objects.
* exp_util.ads (Is_Related_To_Func_Return): Add commentary.

17 months agoada: Fix format string parsing in GNAT.Formatted_String
Ronan Desplanques [Wed, 7 Dec 2022 16:37:21 +0000 (17:37 +0100)]
ada: Fix format string parsing in GNAT.Formatted_String

Before this patch, format strings ending with "%%" (two consecutive
percent signs) caused GNAT.Formatted_String."-" to give the wrong
output, and cause the various GNAT.Formatted_String."&" to raise
exceptions with misleading error messages.

Also before this patch, a bug in GNAT.Formatted_String."-" caused
characters from the format string to be dropped. Calling
GNAT.Formatted_String."-" on an instance of
GNAT.Formatted_String.Formatted_String caused subsequent uses of
that instance to return wrong results.

In addition to fixing the parsing of format strings, this patch
centralizes the detection of format specifiers in a unique
procedure.

gcc/ada/

* libgnat/g-forstr.adb
(Advance_And_Accumulate_Until_Next_Specifier): New procedure.
("-"): Replace inline code with call to
Advance_And_Accumulate_Until_Next_Specifier.
(Next_Format): likewise.

17 months agoada: Make Apply_Discriminant_Check.Denotes_Explicit_Dereference more robust
Eric Botcazou [Thu, 8 Dec 2022 22:21:58 +0000 (23:21 +0100)]
ada: Make Apply_Discriminant_Check.Denotes_Explicit_Dereference more robust

The predicate implements the rules of the language so it needs to cope with
constructs rewritten by the expander, in particular explicit dereferences
that the expander uses liberally for various purposes.

This change makes the detection of rewritten calls more robust and adds the
detection of rewritten return objects.

gcc/ada/

* checks.adb (Apply_Discriminant_Check.Denotes_Explicit_Dereference):
Return false for artificial dereferences generated by the expander.

17 months agoada: Fix calling convention of foreign functions returning limited type
Eric Botcazou [Thu, 8 Dec 2022 09:51:29 +0000 (10:51 +0100)]
ada: Fix calling convention of foreign functions returning limited type

Such functions use neither Ada 2005's build-in-place mechanism nor Ada 95's
return-by-reference mechanism, but instead the common calling convention of
functions returning a nonlimited by-reference type.

gcc/ada/

* exp_ch6.adb (Is_Build_In_Place_Function): Adjust comment.
* sem_util.adb (Compute_Returns_By_Ref): Do not set Returns_By_Ref
on functions with foreign convention.

17 months agoada: Adapt frontend optimization for aggregate assignment
Marc Poulhiès [Fri, 25 Nov 2022 13:52:04 +0000 (14:52 +0100)]
ada: Adapt frontend optimization for aggregate assignment

The frontend currently relies on gigi to use efficient assignment in
particular cases like:

  Some_Var.all := (others => (others => 0));

gigi would use memset to clear memory pointed to by Some_Var.

In the case of an access with a Designated_Storage_Model aspect with a Copy_To
procedure, memset can't be used directly. Instead of simply disabling this
frontend/gigi optimization and having the frontend emit several assignments, a
temporary is used (through the new Build_Assignment_With_Temporary): gigi can
still memset it, and this temporary is then copied into the original
target (and the regular storage model mechanism handles it).

gcc/ada/

* exp_aggr.adb (Build_Assignment_With_Temporary): New.
(Expand_Array_Aggregate): Tune backend optimization
and insert a temporary in the case of an access with
Designated_Storage_Model aspect.
(Convert_Array_Aggr_In_Allocator): Likewise.

17 months agoada: Another small adjustment to special resolution of membership test
Eric Botcazou [Wed, 7 Dec 2022 16:54:37 +0000 (17:54 +0100)]
ada: Another small adjustment to special resolution of membership test

This goes back to the original implementation but keeps the special size
test with universal_integer to cope with its limited range.

gcc/ada/

* sem_res.adb (Resolve_Membership_Op): Adjust again latest change.

17 months agoada: Make Sem_Util.Is_Aliased_View predicate more robust
Eric Botcazou [Wed, 7 Dec 2022 16:26:27 +0000 (17:26 +0100)]
ada: Make Sem_Util.Is_Aliased_View predicate more robust

The predicate implements the rules of the language so it needs to cope with
constructs rewritten by the expander, in particular explicit dereferences
that the expander uses liberally for various purposes.

This change makes the detection of rewritten calls more robust, plugging an
existing loophole for specific objects and exposing a missing propagation of
the Is_Aliased flag for certain build-in-place objects, as well as adds the
detection of rewritten return objects.

It also contains a small enhancement to Set_Debug_Info_Defining_Id aimed at
making it easier to debug the generated code by means of -gnatD.

gcc/ada/

* sem_util.ads (Set_Debug_Info_Defining_Id): Adjust comment.
* sem_util.adb (Is_Aliased_View) <N_Explicit_Dereference>: Return
false for more artificial dereferences generated by the expander.
(Set_Debug_Info_Defining_Id): Set Debug_Info_Needed unconditionally
in -gnatD mode.
* exp_ch6.adb (Replace_Renaming_Declaration_Id): Also preserve the
Is_Aliased flag.

17 months agoada: GNAT UGN: Adjust wording in "Platform-specific Information" chapter
Joel Brobecker [Tue, 6 Dec 2022 05:21:57 +0000 (09:21 +0400)]
ada: GNAT UGN: Adjust wording in "Platform-specific Information" chapter

The wording of the introduction paragraph specified an incomplete
list of OSes. Rather than trying to update the list, this commit
changes the text to make it more general. For those parts of
this chapter which only apply to specific OSes, the documentation
is written in a way that it is clear which OS it applies to.

gcc/ada/

* doc/gnat_ugn/platform_specific_information.rst
(_Platform_Specific_Information): Minor rewording of intro text.
* gnat_ugn.texi: Regenerate.

17 months agoada: Fix detection of function calls in object declarations
Eric Botcazou [Tue, 6 Dec 2022 23:56:43 +0000 (00:56 +0100)]
ada: Fix detection of function calls in object declarations

The current code has relied on Original_Node to detect rewritten function
calls in object declarations but that's not robust enough in the presence
of function calls written in object notation.

gcc/ada/

* exp_util.ads (Is_Captured_Function_Call): Declare.
* exp_util.adb (Is_Captured_Function_Call): New predicate.
* exp_ch3.adb (Expand_N_Object_Declaration): Use it to detect a
rewritten function call as the initializing expression.
* exp_ch6.adb (Expand_Simple_Function_Return): Use it to detect a
rewritten function call as the returned expression.

17 months agoada: Simplify [Small_]Integer_Type_For
Bob Duff [Tue, 6 Dec 2022 16:37:27 +0000 (11:37 -0500)]
ada: Simplify [Small_]Integer_Type_For

Make Small_Integer_Type_For call Integer_Type_For,
so they share most of the code.

Remove Standard_Long_Integer from consideration,
because that's different on different machines (32- or 64-bit).
Standard_Integer or Standard_Long_Long_Integer will be
chosen.

gcc/ada/

* exp_util.adb (Integer_Type_For): Assertion and comment.
(Small_Integer_Type_For): Remove some code and call
Integer_Type_For instead.
* sem_util.ads (Rep_To_Pos_Flag): Improve comments. "Standard_..."
seems overly pedantic here.
* exp_attr.adb (Succ, Pred): Clean up: make the code as similar as
possible.
* exp_ch4.adb: Minor: named notation.

17 months agoada: Cannot reference ghost entity in class-wide precondition
Javier Miranda [Mon, 28 Nov 2022 09:15:54 +0000 (09:15 +0000)]
ada: Cannot reference ghost entity in class-wide precondition

gcc/ada/

* ghost.adb (Is_OK_Declaration): A reference to a Ghost entity may
appear within the class-wide precondition of a helper subprogram.
This context is treated as suitable because it was already
verified when we were analyzing the original class-wide
precondition.

17 months agoada: Fix support of Default_Component_Value aspect on derived types
Eric Botcazou [Mon, 5 Dec 2022 21:31:50 +0000 (22:31 +0100)]
ada: Fix support of Default_Component_Value aspect on derived types

The support of the Default_Component_Value aspect on derived constrained
array types is broken because of a couple of issues: 1) the derived types
incorrectly inherit the initialization procedure of the ancestor types
and 2) the propagation of the aspect does not work for constrained array
types (unlike for unconstrained array types).

gcc/ada/

* exp_tss.adb (Base_Init_Proc): Do not return the Init_Proc of the
ancestor type for a derived array type.
* sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): Factor out the
common processing done on representation items.
For Default_Component_Value and Default_Value, look into the first
subtype to find out the representation items.

17 months agoDaily bump.
GCC Administrator [Tue, 3 Jan 2023 00:17:09 +0000 (00:17 +0000)]
Daily bump.

17 months agoi386: correct division modeling in lujiazui.md
Alexander Monakov [Fri, 9 Dec 2022 17:47:55 +0000 (20:47 +0300)]
i386: correct division modeling in lujiazui.md

Model the divider in Lujiazui processors as a separate automaton to
significantly reduce the overall model size. This should also result
in improved accuracy, as pipe 0 should be able to accept new
instructions while the divider is occupied.

It is unclear why integer divisions are modeled as if pipes 0-3 are all
occupied. I've opted to keep a single-cycle reservation of all four
pipes together, so GCC should continue trying to pack instructions
around a division accordingly.

Currently top three symbols in insn-automata.o are:

106102 r lujiazui_core_check
106102 r lujiazui_core_transitions
196123 r lujiazui_core_min_issue_delay

This patch shrinks all lujiazui tables to:

3 r lujiazui_decoder_min_issue_delay
20 r lujiazui_decoder_transitions
32 r lujiazui_agu_min_issue_delay
126 r lujiazui_agu_transitions
304 r lujiazui_div_base
352 r lujiazui_div_check
352 r lujiazui_div_transitions
1152 r lujiazui_core_min_issue_delay
1592 r lujiazui_agu_translate
1592 r lujiazui_core_translate
1592 r lujiazui_decoder_translate
1592 r lujiazui_div_translate
3952 r lujiazui_div_min_issue_delay
9216 r lujiazui_core_transitions

This continues the work on reducing i386 insn-automata.o size started
with similar fixes for division and multiplication instructions in
znver.md.

gcc/ChangeLog:

PR target/87832
* config/i386/lujiazui.md (lujiazui_div): New automaton.
(lua_div): New unit.
(lua_idiv_qi): Correct unit in the reservation.
(lua_idiv_qi_load): Ditto.
(lua_idiv_hi): Ditto.
(lua_idiv_hi_load): Ditto.
(lua_idiv_si): Ditto.
(lua_idiv_si_load): Ditto.
(lua_idiv_di): Ditto.
(lua_idiv_di_load): Ditto.
(lua_fdiv_SF): Ditto.
(lua_fdiv_SF_load): Ditto.
(lua_fdiv_DF): Ditto.
(lua_fdiv_DF_load): Ditto.
(lua_fdiv_XF): Ditto.
(lua_fdiv_XF_load): Ditto.
(lua_ssediv_SF): Ditto.
(lua_ssediv_load_SF): Ditto.
(lua_ssediv_V4SF): Ditto.
(lua_ssediv_load_V4SF): Ditto.
(lua_ssediv_V8SF): Ditto.
(lua_ssediv_load_V8SF): Ditto.
(lua_ssediv_SD): Ditto.
(lua_ssediv_load_SD): Ditto.
(lua_ssediv_V2DF): Ditto.
(lua_ssediv_load_V2DF): Ditto.
(lua_ssediv_V4DF): Ditto.
(lua_ssediv_load_V4DF): Ditto.

17 months agolibgcc: Specialize execute_cfa_program in DWARF unwinder for alignments
Florian Weimer [Mon, 2 Jan 2023 15:18:02 +0000 (16:18 +0100)]
libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments

The parameters fs->data_align and fs->code_align always have fixed
values for a particular target in GCC-generated code.  Specialize
execute_cfa_program for these values, to avoid multiplications.

gcc/c-family/

* c-cppbuiltin.cc (c_cpp_builtins): Define
__LIBGCC_DWARF_CIE_DATA_ALIGNMENT__.

libgcc/

* unwind-dw2-execute_cfa.h: New file.  Extracted from
the execute_cfa_program function in unwind-dw2.c.
* unwind-dw2.c (execute_cfa_program_generic): New function.
(execute_cfa_program_specialized): Likewise.
(execute_cfa_program): Call execute_cfa_program_specialized
or execute_cfa_program_generic, as appropriate.

17 months agoDefine __LIBGCC_DWARF_REG_SIZES_CONSTANT__ if DWARF register size is constant
Florian Weimer [Mon, 2 Jan 2023 15:18:02 +0000 (16:18 +0100)]
Define __LIBGCC_DWARF_REG_SIZES_CONSTANT__ if DWARF register size is constant

And use that to speed up the libgcc unwinder.

gcc/

* debug.h (dwarf_reg_sizes_constant): Declare.
* dwarf2cfi.cc (dwarf_reg_sizes_constant): New function.

gcc/c-family/

* c-cppbuiltin.cc (__LIBGCC_DWARF_REG_SIZES_CONSTANT__):
Define if constant is known.

libgcc/

* unwind-dw2.c (dwarf_reg_size): New function.
(_Unwind_GetGR, _Unwind_SetGR, _Unwind_SetGRPtr)
(_Unwind_SetSpColumn, uw_install_context_1): Use it.
(uw_init_context_1): Do not initialize dwarf_reg_size_table
if not in use.

17 months agoCompute a table of DWARF register sizes at compile
Florian Weimer [Mon, 2 Jan 2023 15:18:02 +0000 (16:18 +0100)]
Compute a table of DWARF register sizes at compile

The sizes are compile-time constants.  Create a vector with them,
so that they can be inspected at compile time.

gcc/

* dwarf2cfi.cc (init_return_column_size): Remove.
(init_one_dwarf_reg_size): Adjust.
(generate_dwarf_reg_sizes): New function.  Extracted
from expand_builtin_init_dwarf_reg_sizes.
(expand_builtin_init_dwarf_reg_sizes): Call
generate_dwarf_reg_sizes.
* target.def (init_dwarf_reg_sizes_extra): Adjust
hook signature.
* config/msp430/msp430.cc
(msp430_init_dwarf_reg_sizes_extra): Adjust.
* config/rs6000/rs6000.cc
(rs6000_init_dwarf_reg_sizes_extra): Likewise.
* doc/tm.texi: Update.

17 months agoAda,Darwin: Do not link libgcc statically on Darwin 8 and 9 [PR108202].
Iain Sandoe [Thu, 22 Dec 2022 17:32:59 +0000 (17:32 +0000)]
Ada,Darwin: Do not link libgcc statically on Darwin 8 and 9 [PR108202].

Normally, GCC executables are built with -static-libstdc++ -static-libgcc
on Darwin.  This is fine in most cases, because GCC executables typically
do no use exceptions.   However gnat1 does use exceptions and also pulls
in system libraries that are linked against the installed shared libgcc
which contains the system unwinder.  This means that gnat1 effectively has
two unwinder instances (which does not work reliably since the unwinders
have global state).

A recent change in the initialization of FDEs has made this a hard error
now on Darwin versions (8 and 9) with libgcc installed in /usr/lib (gnat1
now hangs when an exception is thrown).

The solution is to link libgcc dynamically, picking up the installed
system version.  To do this we strip -static-libgcc from the link flags.

PR ada/108202

gcc/ada/ChangeLog:

* gcc-interface/Make-lang.in (GCC_LINKERFLAGS, GCC_LDFLAGS):
Versions of ALL_LINKERFLAGS, LDFLAGS with -Werror and
-static-libgcc filtered out for Darwin8 and 9 (-Werror is filtered
out for other hosts).

17 months agoUpdate copyright years.
Jakub Jelinek [Mon, 2 Jan 2023 08:46:13 +0000 (09:46 +0100)]
Update copyright years.

17 months agoUpdate copyright years.
Jakub Jelinek [Mon, 2 Jan 2023 08:37:43 +0000 (09:37 +0100)]
Update copyright years.

17 months agoUpdate Copyright year in ChangeLog files
Jakub Jelinek [Mon, 2 Jan 2023 08:36:59 +0000 (09:36 +0100)]
Update Copyright year in ChangeLog files

2022 -> 2023

17 months agoUpdate copyright dates.
Jakub Jelinek [Mon, 2 Jan 2023 08:26:59 +0000 (09:26 +0100)]
Update copyright dates.

Manual part of copyright year updates.

2023-01-02  Jakub Jelinek  <jakub@redhat.com>

gcc/
* gcc.cc (process_command): Update copyright notice dates.
* gcov-dump.cc (print_version): Ditto.
* gcov.cc (print_version): Ditto.
* gcov-tool.cc (print_version): Ditto.
* gengtype.cc (create_file): Ditto.
* doc/cpp.texi: Bump @copying's copyright year.
* doc/cppinternals.texi: Ditto.
* doc/gcc.texi: Ditto.
* doc/gccint.texi: Ditto.
* doc/gcov.texi: Ditto.
* doc/install.texi: Ditto.
* doc/invoke.texi: Ditto.
gcc/ada/
* gnat_ugn.texi: Bump @copying's copyright year.
* gnat_rm.texi: Likewise.
gcc/d/
* gdc.texi: Bump @copyrights-d year.
gcc/fortran/
* gfortranspec.cc (lang_specific_driver): Update copyright notice
dates.
* gfc-internals.texi: Bump @copying's copyright year.
* gfortran.texi: Ditto.
* intrinsic.texi: Ditto.
* invoke.texi: Ditto.
gcc/go/
* gccgo.texi: Bump @copyrights-go year.
libgomp/
* libgomp.texi: Bump @copying's copyright year.
libitm/
* libitm.texi: Bump @copying's copyright year.
libquadmath/
* libquadmath.texi: Bump @copying's copyright year.

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