Commit Graph

197899 Commits

Author SHA1 Message Date
Piotr Trojanek
6147feb54c 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.
2023-01-05 15:30:02 +01:00
Marc Poulhiès
07facb98ed 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.
2023-01-05 15:30:01 +01:00
Eric Botcazou
3f7776ea33 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.
2023-01-05 15:30:01 +01:00
Eric Botcazou
133a8e6339 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.
2023-01-05 15:30:01 +01:00
Eric Botcazou
229f5150ad ada: Fix pasto in comment
gcc/ada/

	* exp_ch3.adb (Expand_N_Object_Declaration): Fix pasto in comment.
2023-01-05 15:30:01 +01:00
Ronan Desplanques
a124b52631 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.
2023-01-05 15:30:00 +01:00
Javier Miranda
9ef547a7a9 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.
2023-01-05 15:30:00 +01:00
Joao Azevedo
e45bef1ec6 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.
2023-01-05 15:30:00 +01:00
Eric Botcazou
59d1681bf3 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.
2023-01-05 15:30:00 +01:00
Eric Botcazou
f0bed52ec9 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.
2023-01-05 15:29:59 +01:00
Ronan Desplanques
90d3cd03b3 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.
2023-01-05 15:29:59 +01:00
Marc Poulhiès
912d1e184a 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.
2023-01-05 15:29:59 +01:00
Justin Squirek
2aa5f94243 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.
2023-01-05 15:29:59 +01:00
Eric Botcazou
8313c5f600 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.
2023-01-05 15:29:58 +01:00
Steve Baird
0776fec155 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.
2023-01-05 15:29:58 +01:00
Bob Duff
0a8824f702 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.
2023-01-05 15:29:58 +01:00
Eric Botcazou
d990f34e93 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.
2023-01-05 15:29:57 +01:00
Bob Duff
46924ad780 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.
2023-01-05 15:29:57 +01:00
Gaius Mulley
a24888388b 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>
2023-01-05 14:13:43 +00:00
Iain Sandoe
dd77b04999 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.
2023-01-05 12:48:25 +00:00
Iain Sandoe
2421470867 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.
2023-01-05 12:48:00 +00:00
Jakub Jelinek
29c3218618 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.
2023-01-05 11:57:30 +01:00
Tejas Joshi
72ce780a49 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.
2023-01-05 11:17:47 +05:30
Jonathan Wakely
56be197076 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.
2023-01-05 00:46:00 +00:00
Jonathan Wakely
b1ad748754 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.
2023-01-05 00:46:00 +00:00
Jonathan Wakely
e36e57b032 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.
2023-01-05 00:46:00 +00:00
GCC Administrator
faccda2768 Daily bump. 2023-01-05 00:17:41 +00:00
Patrick Palka
238e292cf5 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.
2023-01-04 14:12:25 -05:00
Jakub Jelinek
fc349931ad 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.
2023-01-04 18:42:31 +01:00
Jan Hubicka
edc038863d 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.
2023-01-04 18:04:42 +01:00
Iain Sandoe
96cba8ebe5 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().
2023-01-04 15:33:16 +00:00
Iain Sandoe
ec6d1fc09f 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.
2023-01-04 14:54:41 +00:00
Iain Sandoe
751c2d9a46 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.
2023-01-04 14:53:07 +00:00
Iain Sandoe
e15e8d430c 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.
2023-01-04 14:51:59 +00:00
Iain Sandoe
181afe5ca6 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.
2023-01-04 14:50:58 +00:00
Gaius Mulley
8e7fc26f8a 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>
2023-01-04 12:52:15 +00:00
Jonathan Wakely
1530a9b1f4 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().
2023-01-04 11:53:49 +00:00
Jakub Jelinek
ebc4491194 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.
2023-01-04 12:16:22 +01:00
Jakub Jelinek
345dffd0d4 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.
2023-01-04 10:54:38 +01:00
Jakub Jelinek
8692b15ae7 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.
2023-01-04 10:52:49 +01:00
Hu, Lin1
44baa34157 Initial Emeraldrapids Support
gcc/ChangeLog:

	* common/config/i386/cpuinfo.h (get_intel_cpu): Handle Emeraldrapids.
	* common/config/i386/i386-common.cc: Add Emeraldrapids.
2023-01-04 09:45:01 +08:00
Hu, Lin1
9e74b7ec0b i386: Remove Meteorlake's family_model
gcc/ChangeLog:

	* common/config/i386/cpuinfo.h (get_intel_cpu): Remove case 0xb5
	for meteorlake.
2023-01-04 09:44:20 +08:00
GCC Administrator
0f8fbb57a8 Daily bump. 2023-01-04 00:17:22 +00:00
David Edelsohn
e098c5d105 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.
2023-01-03 13:53:21 -05:00
Sandra Loosemore
0425ae780f 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.
2023-01-03 17:49:23 +00:00
Florian Weimer
8fdef16cd5 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.
2023-01-03 16:47:32 +01:00
Florian Weimer
455acc4351 Revert "Compute a table of DWARF register sizes at compile"
This reverts commit 3b6cac2b44.
2023-01-03 16:47:31 +01:00
Florian Weimer
d010efbfb8 Revert "Define __LIBGCC_DWARF_REG_SIZES_CONSTANT__ if DWARF register size is constant"
This reverts commit 97bbdb726a.
2023-01-03 16:47:31 +01:00
Florian Weimer
96127a4100 Revert "libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments"
This reverts commit cb775ecd6e.
2023-01-03 16:47:31 +01:00
Siddhesh Poyarekar
b3009222b7 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>
2023-01-03 10:24:30 -05:00