Eric Botcazou [Tue, 16 Feb 2021 08:00:11 +0000 (09:00 +0100)]
[Ada] Fix type mismatch warnings during LTO bootstrap #2
gcc/ada/
* init.c (__gnat_raise_program_error): Fix parameter type.
(Raise_From_Signal_Handler): Likewise and mark as no-return.
* raise-gcc.c (__gnat_others_value): Fix type.
(__gnat_all_others_value): Likewise.
(__gnat_unhandled_others_value): Likewise.
* seh_init.c (Raise_From_Signal_Handler): Fix parameter type.
* libgnat/a-except.ads (Raise_From_Signal_Handler): Use convention C
and new symbol name, move declaration to...
(Raise_From_Controlled_Operation): Minor tweak.
* libgnat/a-except.adb (Raise_From_Signal_Handler): ...here.
* libgnat/a-exexpr.adb (bool): New C compatible boolean type.
(Is_Handled_By_Others): Use it as return type for the function.
Eric Botcazou [Wed, 27 Jan 2021 06:58:17 +0000 (07:58 +0100)]
[Ada] Fix type mismatch warnings during LTO bootstrap #1
gcc/ada/
* errout.ads (Set_Identifier_Casing): Add pragma Convention C.
* eval_fat.ads (Rounding_Mode): Likewise.
(Machine): Add WARNING comment line.
* exp_code.ads (Clobber_Get_Next): Add pragma Convention C.
* fe.h (Compiler_Abort): Fix return type.
(Set_Identifier_Casing): Change type of parameters.
(Clobber_Get_Next): Change return type.
* gcc-interface/trans.c (gnat_to_gnu) <N_Code_Statement>: Add cast.
Eric Botcazou [Thu, 4 Feb 2021 09:27:48 +0000 (10:27 +0100)]
[Ada] Small cleanup in C header file
gcc/ada/
* atree.h (Parent): Remove duplicate declaration.
(Get_1_Bit_Field): Also use INLINE specifier in the declaration,
fix formatting and use gcc_unreachable for the default case.
(Get_2_Bit_Field): Likewise.
(Get_4_Bit_Field): Likewise.
(Get_8_Bit_Field): Likewise.
(Get_32_Bit_Field): Likewise.
(Get_32_Bit_Field_With_Default): Likewise.
Bob Duff [Wed, 3 Feb 2021 10:31:16 +0000 (05:31 -0500)]
[Ada] Variable-sized node types
gcc/ada/
* atree.ads, atree.adb: Major rewrite to support variable-sized
node types. Add pragmas Suppress and Assertion_Policy. We now
have an extra level of indirection: Node_Offsets is a table
mapping Node_Ids to the offset of the start of each node in
Slots. Slots is a table containing one or more contiguous slots
for each node. Each slot is a 32-bit unchecked union that can
contain any mixture of 1, 2, 4, 8, and 32-bit fields that fits.
The old low-level getters and setters (e.g. Flag123) are
removed.
* gen_il-fields.ads, gen_il-gen-gen_entities.adb,
gen_il-gen-gen_nodes.adb, gen_il-gen.adb, gen_il-gen.ads,
gen_il-main.adb, gen_il-types.ads, gen_il-utils.adb,
gen_il-utils.ads, gen_il.adb, gen_il.ads: New gen_il program
that generates various Ada and C++ files. In particular, the
following files are generated by gen_il: einfo-entities.adb
einfo-entities.ads, gnatvsn.ads, nmake.adb, nmake.ads,
seinfo.ads, seinfo_tables.adb, seinfo_tables.ads,
sinfo-nodes.adb, sinfo-nodes.ads, einfo.h, and sinfo.h.
* sinfo-utils.adb, sinfo-utils.ads, einfo-utils.adb,
einfo-utils.ads: New files containing code that needs to refer
to Sinfo.Nodes and Einfo.Entities. This code is mostly moved
here from Sinfo and Einfo to break cycles.
* back_end.adb: Pass node_offsets_ptr and slots_ptr to gigi,
instead of nodes_ptr and flags_ptr. The Nodes and Flags tables
no longer exist. (Note that gigi never used the Flags table.)
* sinfo-cn.ads (Change_Identifier_To_Defining_Identifier,
Change_Character_Literal_To_Defining_Character_Literal,
Change_Operator_Symbol_To_Defining_Operator_Symbol): Turn N into
an IN formal.
* sinfo-cn.adb: Update. Add assertions, which can be removed at
some point. Rewrite to use higher-level facilities. Make sure
vanishing fields are zeroed out. Add with/use for new packages.
* sem_util.adb: Remove "Assert(False)" immediately followed by
"raise Program_Error". Use higher-level facilities such as
Walk_Sinfo_Fields instead of depending on low-level Set_FieldN
routines that no longer exist. Use Get_Comes_From_Source_Default
instead of Default_Node.Comes_From_Source (Default_Node no
longer exists). Use Set_Basic_Convention instead of
Basic_Set_Convention. Add with/use for new packages.
* sem_util.ads: The Convention field had getter Convention and
setter Basic_Set_Convention. Make that more uniform: there is
now a field called Basic_Convention, with Basic_Convention and
Set_Basic_Convention as getter/setter, and write Convention and
Set_Convention here.
* nlists.adb: Rewrite to use abstractions, rather then depending
on low-level implementation details of Atree. Necessary because
those details have changed. Add with/use for new packages.
* sem_ch12.adb: Use higher-level facilities such as
Walk_Sinfo_Fields instead of depending on low-level Set_FieldN
routines that no longer exist. Add with/use for new packages.
* exp_cg.adb, sem_ch10.adb, sem_ch4.adb, sem_eval.adb,
sem_prag.adb, sem_warn.adb: Change expanded names to refer to
the new packages for things that moved. Add with/use for new
packages.
* sem_ch3.adb: Likewise. Reinitialize vanishing fields.
* exp_disp.adb: Likewise. Remove failing assertion.
* sinfo.ads, einfo.ads: Remove code that is now generated into
Sinfo.Nodes and Einfo.Entities.
* sinfo.adb, einfo.adb: Replace bodies with "pragma No_Body;".
We should delete these at some point, but No_Body makes make
files easier. Some code is moved to Sinfo.Nodes, Einfo.Entities,
Sinfo.Utils, and Einfo.Utils. Some is no longer necessary.
* treepr.adb: Rewrite to use new tables. We no longer need
treeprs.ads.
* treepr.ads: Add comment.
* types.ads: Move types Component_Alignment_Kind and
Float_Rep_Kind here.
* atree.h: Major update to match atree.ads changes. Add slot
types, for use by getters/setters.
* types.h: Move types Component_Alignment_Kind and
Float_Rep_Kind here.
* fe.h: Rewrite to deal with code that has changed or moved from
Atree, Sinfo, Einfo.
* nlists.h: Move some code to fe.h.
* alloc.ads: Split Nodes_* constants into Node_Offsets and
Slots, because Atree has two separate tables. Increase values.
Remove Nodes_Release_Threshold. Improve comment.
* debug.adb, gnat1drv.adb: Remove obsolete gnatd.A and gnatd.N
switches. Add with/use for new packages.
* opt.ads: Minor comment fix.
* aspects.adb, checks.adb, comperr.adb, contracts.adb,
cstand.adb, debug_a.adb, errout.adb, eval_fat.adb, exp_aggr.adb,
exp_atag.adb, exp_attr.adb, exp_ch11.adb, exp_ch12.adb,
exp_ch13.adb, exp_ch2.adb, exp_ch3.adb, exp_ch4.adb,
exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch8.adb, exp_ch9.adb,
exp_code.adb, exp_dbug.adb, exp_dist.adb, exp_fixd.adb,
exp_imgv.adb, exp_intr.adb, exp_pakd.adb, exp_prag.adb,
exp_put_image.adb, exp_sel.adb, exp_smem.adb, exp_spark.adb,
exp_strm.adb, exp_tss.adb, exp_unst.adb, exp_util.adb,
exp_util.ads, expander.adb, freeze.adb, frontend.adb,
get_targ.ads, ghost.adb, gnat_cuda.adb, impunit.adb, inline.adb,
itypes.adb, itypes.ads, layout.adb, lib.adb, lib-load.adb,
lib-writ.adb, lib-xref.adb, lib-xref.ads,
lib-xref-spark_specific.adb, live.adb, par.adb, par_sco.adb,
pprint.adb, repinfo.adb, restrict.adb, rtsfind.adb, scil_ll.adb,
scn.adb, sem.adb, sem.ads, sem_aggr.adb, sem_attr.adb,
sem_aux.adb, sem_case.adb, sem_cat.adb, sem_ch11.adb,
sem_ch13.adb, sem_ch2.adb, sem_ch5.adb, sem_ch6.adb,
sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_dim.adb,
sem_disp.adb, sem_dist.adb, sem_elab.adb, sem_elim.adb,
sem_intr.adb, sem_mech.adb, sem_res.adb, sem_scil.adb,
sem_smem.adb, sem_type.adb, set_targ.ads, sinput.adb,
sinput-l.adb, sprint.adb, style.adb, styleg.adb, tbuild.adb,
tbuild.ads, uname.adb: Add with/use for new packages.
* libgnat/a-stoubu.adb, libgnat/a-stouut.adb: Simplify to ease
bootstrap.
* libgnat/a-stobfi.adb, libgnat/a-stoufi.adb (Create_File,
Create_New_File): Create file in binary format, to avoid
introducing unwanted text conversions on Windows. Simplify to
ease bootstrap.
* libgnat/a-stteou__bootstrap.ads: New.
* ceinfo.adb, csinfo.adb, nmake.adt, treeprs.adt, xeinfo.adb,
xnmake.adb, xsinfo.adb, xtreeprs.adb: Delete.
* Make-generated.in: Build and run the gen_il program to
generate files. The files are generated in the ada/gen_il
subdirectory, and then moved up to ada. We rely on gnatmake (as
opposed to make) to build the gen_il program efficiently (i.e.
don't do anything if the sources didn't change).
* gcc-interface/Makefile.in (ADAFLAGS): Add -gnatU.
(GNATMAKE_OBJS): Add new object files.
(GENERATED_FILES_FOR_TOOLS): New variable.
(../stamp-tools): Create a link for all
GENERATED_FILES_FOR_TOOLS.
* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add new object
files. Remove ada/treeprs.o.
(GNATBIND_OBJS): Add new object files.
(ada.mostlyclean): Remove ada/sdefault.adb and add
ada/stamp-gen_il.
(ada.maintainer-clean): Remove ada/treeprs.ads.
(update-sources): Remove obsolete target.
(ada_generated_files): Rename to...
(ADA_GENERATED_FILES): ... this. Add new source files. Add
comment.
* gcc-interface/trans.c: Remove obsolete Nodes_Ptr and
Flags_ptr. Add Node_Offsets_Ptr and Slots_Ptr, which point to
the corresponding tables in Atree.
* gcc-interface/gigi.h (gigi): New parameters for initializing
Node_Offsets_Ptr and Slots_Ptr.
* gcc-interface/decl.c: Numeric_Kind,
Discrete_Or_Fixed_Point_Kind, and Record_Kind were
nonhierarchical, and were therefore removed for simplicity.
Replace uses with calls to Is_In_... functions.
gnattools/
* Makefile.in (GENERATED_FILES_FOR_TOOLS): New variable.
($(GCC_DIR)/stamp-tools): Walk it for the first copy operation.
Ed Schonberg [Tue, 2 Feb 2021 15:13:52 +0000 (10:13 -0500)]
[Ada] Spurious error with component of unchecked_union type
gcc/ada/
* exp_ch4.adb (Unconstrained_UU_In_Component_Declaration): A
component declaration whose subtype indication is an entity name
without an explicit constraint is an Unchecked_Union type only
if the entity has an unconstrained nominal subtype (record type
or private type) whose parent type is an Unchecked_Union.
Piotr Trojanek [Fri, 29 Jan 2021 11:16:17 +0000 (12:16 +0100)]
[Ada] Attribute Address is not an interfering context in SPARK
gcc/ada/
* sem_res.adb (Flag_Object): Ignore prefixes of attribute
Address.
Yannick Moy [Tue, 2 Feb 2021 11:31:04 +0000 (12:31 +0100)]
[Ada] Generate warning for negative literal of a modular type
gcc/ada/
* opt.ads: Update comment for Warn_On_Suspicious_Modulus_Value.
* sem_res.adb (Resolve_Unary_Op): Generate warning.
* usage.adb: Refine doc for -gnatw.m/M switch.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Update doc on -gnatw.m switch.
* gnat_ugn.texi: Regenerate.
Piotr Trojanek [Fri, 29 Jan 2021 10:45:36 +0000 (11:45 +0100)]
[Ada] Cleanup code for flagging object references in interfering contexts
gcc/ada/
* sem_res.adb (Flag_Object): Replace chained IF with a CASE;
remove repeated calls to Entity; do not traverse into
N_Identifier and N_Expanded_Name, because only need to examine
their Entity field anyway.
Piotr Trojanek [Fri, 29 Jan 2021 18:34:39 +0000 (19:34 +0100)]
[Ada] Remove End_Interp_List from the overloaded resolution API
gcc/ada/
* sem_ch4.adb (Analyze_Call): Remove call to End_Interp_List.
(Process_Overloaded_Indexed_Component): Remove call to
End_Interp_List.
* sem_util.adb (Insert_Explicit_Dereference): Remove call to
End_Interp_List.
* sem_type.ads (End_Interp_List): Remove.
* sem_type.adb (Add_Entry): The guard against duplicate entries
is now checked before other conditions, so that EXIT statements
do not bypass this guard.
(End_Interp_List): Remove.
Ed Schonberg [Mon, 1 Feb 2021 18:12:57 +0000 (13:12 -0500)]
[Ada] Crash on imported object with deep initialization and No_Aborts
gcc/ada/
* exp_util.adb (Remove_Init_Call): If a simple initialization
call is present, and the next statement is an initialization
block (that contains a call to a Deep_ Initialize routine),
remove the block as well, and insert the first initialization
call in it, in case it is needed for later relocation.
Gary Dismukes [Sat, 30 Jan 2021 01:03:34 +0000 (20:03 -0500)]
[Ada] Remove some ??? comments
gcc/ada/
* errout.ads (Size_Too_Small_Message): Remove low-value ???
comment.
* exp_util.ads: Remove ??? in part of overall package comments
and restructure comment to clarify.
(Duplicate_Subexpr): Remove ??? comment that seems unnecessary.
* sem_ch3.ads (Analyze_Declarations): Remove two parenthesized
??? comments and add more description of the procedure's
actions.
(Get_Discriminant_Value): Remove ??? comment requesting more
documentation, expanding description of the function's actions.
* sem_disp.ads (Check_Operation_From_Incomplete_Type): Add more
semantic description of the procedure and remove ??? comment
requesting such.
(Propagate_Tag): Refine comment to indicate meaning of formal
parameters and generally improve the spec comment (and remove
??? comment asking about the parameters).
Arnaud Charlet [Fri, 29 Jan 2021 15:57:39 +0000 (10:57 -0500)]
[Ada] Computation of Shift_Left and large signed values
gcc/ada/
* sem_eval.adb (Fold_Shift): Fix computation of Shift_Left
resulting in negative signed values.
Eric Botcazou [Tue, 26 Jan 2021 11:10:45 +0000 (12:10 +0100)]
[Ada] Fix signature mismatch for Defining_Entity
gcc/ada/
* sem_util.ads (Defining_Entity): Remove Empty_On_Errors parameter.
(Defining_Entity_Or_Empty): New function.
* sem_util.adb (Defining_Entity): Move bulk of implementation to...
(Defining_Entity_Or_Empty): ...here. Do not raise Program_Error.
(Innermost_Master_Scope_Depth): Call Defining_Entity_Or_Empty.
Justin Squirek [Wed, 20 Jan 2021 17:09:19 +0000 (12:09 -0500)]
[Ada] Implement aspect No_Controlled_Parts
gcc/ada/
* aspects.ads: Add entries to register
Aspect_No_Controlled_Parts.
* freeze.adb (Check_No_Controlled_Parts_Violations): Added to
check requirements of aspect No_Controlled_Parts after a type
has been frozen.
(Freeze_Entity): Add call to
Check_No_Controlled_Parts_Violations.
(Find_Aspect_No_Controlled_Parts): Created to obtain the aspect
specification for No_Controlled_Parts on a given type when
present.
(Find_Aspect_No_Controlled_Parts_Value): Protect against invalid
value.
(Has_Aspect_No_Controlled_Parts): Created as a prediate function
to check if No_Controlled_Parts has been specified on a type for
Get_Anacestor_Types_With_Specification.
(Get_Aspect_No_Controlled_Parts_Value): Created to obtain the
value of the aspect No_Controlled_Parts when specified on a
given type.
(Get_Generic_Formal_Types_In_Hierarchy): Created to collect
formal types in a given type's hierarchy.
(Get_Types_With_Aspect_In_Hierarchy): Created to collect types
in a given type's hierarchy with No_Controlled_Parts specified.
* sem_ch13.adb (Analyze_One_Aspect): Add processing for
No_Controlled_Parts, and fix error in check for allowed pragmas
for formal types.
(Check_Expr_Is_OK_Static_Expression): Created to enforce
checking of static expressions in the same vein as
Analyze_Pragma.Check_Expr_OK_Static_Expression.
* sem_util.adb (Collect_Types_In_Hierarchy): Created to collect
types in a given type's hierarchy that match a given predicate
function.
* sem_util.ads: Fix typo.
* snames.ads-tmpl: Add entry for No_Controlled_Parts.
Eric Botcazou [Mon, 25 Jan 2021 18:22:39 +0000 (19:22 +0100)]
[Ada] Raise Constraint_Error for Compose and Scaling if Machine_Overflows
gcc/ada/
* libgnat/s-fatgen.adb (Scaling): Raise Constraint_Error in the
overflow case when T'Machine_Overflows is True.
Bob Duff [Mon, 25 Jan 2021 15:18:08 +0000 (10:18 -0500)]
[Ada] Minor efficiency improvement in containers
gcc/ada/
* libgnat/a-conhel.adb (TC_Check): Move the Assert into the
'if'.
Frederic Konrad [Fri, 6 Nov 2020 18:59:51 +0000 (19:59 +0100)]
[Ada] sigtramp: fix powerpc64 against -fPIC
gcc/ada/
* sigtramp-vxworks-target.inc: Use a local label for the TOC.
Claire Dross [Mon, 25 Jan 2021 14:30:22 +0000 (15:30 +0100)]
[Ada] Move Has_Inferable_Discriminants to Sem_Util
gcc/ada/
* exp_ch4.adb (Has_Inferable_Discriminants): Moved to Sem_Util.
* sem_util.ads, sem_util.adb (Has_Inferable_Discriminants):
Moved from Exp_Ch4.
Ed Schonberg [Sun, 24 Jan 2021 18:18:28 +0000 (13:18 -0500)]
[Ada] Spurious error on protected call in inherited postcondition
gcc/ada/
* exp_util.adb (Build_Class_Wide_Expression, Replace_Entity):
Add guard to verify that the enclosing pragma is a precondition.
Uros Bizjak [Fri, 7 May 2021 09:15:07 +0000 (11:15 +0200)]
i386: Do not emit mask compares for mode sizes < 16 [PR100445]
Recent addition of v*cond* patterns for MMXMODEI modes allows 64bit MMX
modes to enter ix86_expand_sse_cmp. ix86_use_mask_cmp_p was not prepared
to reject mode sizes < 16, resulting in ICE due to unavailability of 64bit
masked PCOM instructions.
2021-05-07 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/100445
* config/i386/i386-expand.c (ix86_use_mask_cmp_p):
Return false for mode sizes < 16.
gcc/testsuite/
PR target/100445
* gcc.target/i386/pr100445-1.c: New test.
Jakub Jelinek [Fri, 7 May 2021 08:37:52 +0000 (10:37 +0200)]
i386: Fix up 8-byte vcond* with -mxop [PR100445]
ix86_expand_sse_movcc has special TARGET_XOP handling and the recent
addition of support of v*cond* patterns for MMXMODEI modes results in
ICEs because the expected pattern doesn't exist. We can handle it
using 128-bit vpcmov (if we ignore the upper 64 bits like we ignore in
other TARGET_MMX_WITH_SSE support).
2021-05-07 Jakub Jelinek <jakub@redhat.com>
PR target/100445
* config/i386/mmx.md (*xop_pcmov_<mode>): New define_insn.
* gcc.target/i386/pr100445.c: New test.
GCC Administrator [Fri, 7 May 2021 00:16:33 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Thu, 6 May 2021 23:20:35 +0000 (23:20 +0000)]
preprocessor: Fix pp-number lexing of digit separators [PR83873, PR97604]
When the preprocessor lexes preprocessing numbers in lex_number, it
accepts digit separators in more cases than actually permitted in
pp-numbers by the standard syntax.
One thing this accepts is adjacent digit separators; there is some
code to reject those later, but as noted in bug 83873 it fails to
cover the case of adjacent digit separators within a floating-point
exponent. Accepting adjacent digit separators only results in a
missing diagnostic, not in valid code being rejected or being accepted
with incorrect semantics, because the correct lexing in such a case
would have '' start the following preprocessing tokens, and no valid
preprocessing token starts '' while ' isn't valid on its own as a
preprocessing token either. So this patch fixes that case by moving
the error for adjacent digit separators to lex_number (allowing a more
specific diagnostic than if '' were excluded from the pp-number
completely).
Other cases inappropriately accepted involve digit separators before
'.', 'e+', 'e-', 'p+' or 'p-' (or corresponding uppercase variants).
In those cases, as shown by the test digit-sep-pp-number.C added, this
can result in valid code being wrongly rejected as a result of too
many characters being included in the pp-number. So this case is
fixed by terminating the pp-number at the correct character according
to the standard. That test also covers the case where a digit
separator was followed by an identifier-nondigit that is not a
nondigit (e.g. a UCN); that case was already handled correctly.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
libcpp/
PR c++/83873
PR preprocessor/97604
* lex.c (lex_number): Reject adjacent digit separators here. Do
not allow digit separators before '.' or an exponent with sign.
* expr.c (cpp_classify_number): Do not check for adjacent digit
separators here.
gcc/testsuite/
PR c++/83873
PR preprocessor/97604
* g++.dg/cpp1y/digit-sep-neg-2.C,
g++.dg/cpp1y/digit-sep-pp-number.C: New tests.
* g++.dg/cpp1y/digit-sep-line-neg.C, g++.dg/cpp1y/digit-sep-neg.C:
Adjust expected messages.
Jonathan Wakely [Thu, 6 May 2021 14:28:55 +0000 (15:28 +0100)]
libstdc++: Improve static assert messages
The message used for static assertions should be phrased so that it's
unambiguous whether the condition should be true or false. The message
should definitely not state the negative condition.
libstdc++-v3/ChangeLog:
* include/bits/stl_algobase.h (__copy_move, __copy_move_backward):
Improve static_assert messages.
* testsuite/25_algorithms/copy/58982.cc: Adjust expected output.
* testsuite/25_algorithms/copy_n/58982.cc: Likewise.
Martin Jambor [Wed, 5 May 2021 08:41:41 +0000 (10:41 +0200)]
ipa-sra: Do not bail out when callers cannot be cloned
IPA-SRA fails to produce (very simple) edge summaries when a caller
cannot be cloned or its signature cannot be changed which makes it
less powerful for no good reason. This patch fixes that problem.
gcc/ChangeLog:
2021-04-12 Martin Jambor <mjambor@suse.cz>
* ipa-sra.c (ipa_sra_dump_all_summaries): Dump edge summaries even
when there is no function summary.
(ipa_sra_summarize_function): produce edge summaries even when
bailing out early.
gcc/testsuite/ChangeLog:
2021-04-12 Martin Jambor <mjambor@suse.cz>
* gcc.dg/ipa/ipa-sra-1.c (main): Revert change done by
05193687dde, make the argv again pointer to an array.
Tom Tromey [Thu, 29 Apr 2021 00:47:15 +0000 (18:47 -0600)]
go: use htab_eq_string in godump
This changes godump to use the new htab_eq_string function.
gcc
* godump.c (string_hash_eq): Remove.
(go_finish): Use htab_eq_string.
Tom Tromey [Thu, 29 Apr 2021 00:46:44 +0000 (18:46 -0600)]
gcc: use htab_eq_string
This changes one spot in GCC to use the new htab_eq_string function.
gcc
* gengtype-state.c (read_state): Use htab_eq_string.
(string_eq): Remove.
Tom Tromey [Thu, 29 Apr 2021 00:44:48 +0000 (18:44 -0600)]
libiberty: add htab_eq_string
The libiberty hash table includes a helper function for strings, but
no equality function. Consequently, this equality function has been
reimplemented a number of times in both the gcc and binutils-gdb
source trees. This patch adds the function to the libiberty hash
table, as a step toward the goal of removing all the copies.
One change to gcc is included here. Normally I would have put this in
the next patch, but gensupport.c used the most natural name for its
reimplementation of this function, and this can't coexist with the
extern function in libiberty.
include
* hashtab.h (htab_eq_string): Declare.
libiberty
* hashtab.c (htab_eq_string): New function.
gcc
* gensupport.c (htab_eq_string): Remove.
Bernd Edlinger [Tue, 12 Jan 2021 15:27:53 +0000 (16:27 +0100)]
Add line debug info for virtual thunks
There is no debug info when the DECL_IGNORED_P flag
is set. But sometimes we have the line info of the
function decl, as in the case of on virtual thunks.
So instead of no line info at all, we emit at least
the location of the function decl.
On the other side, there are DECL_IGNORED_P functions
which do not have any source line info at all.
Remove those from the debug_range info, to make it
clear for the debugger that the line info for these
functions is invalid. This has the effect that the
debugger will not step into the function without
debug info.
2021-05-06 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR ipa/97937
* debug.h (gcc_debug_hooks): Add set_ignored_loc function pointer.
* dwarf2out.h (dw_fde_node::ignored_debug): New data item.
* dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Add dummy
set_ignored_loc callbacks.
* debug.c (do_nothing_debug_hooks): Likewise.
* vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
* dwarf2out.c (text_section_used, cold_text_section_used): Remove.
(in_text_section_p, last_text_label, last_cold_label,
switch_text_ranges, switch_cold_ranges): New data items.
(dwarf2out_note_section_used): Remove.
(dwarf2out_begin_prologue): Set fde->ignored_debug and
in_text_section_p.
(mark_ignored_debug_section): New helper function.
(dwarf2out_end_epilogue, dwarf2out_switch_text_section): Call
mark_ignored_debug_section.
(dwarf2_debug_hooks): Use dwarf2out_set_ignored_loc.
(dwarf2_lineno_debug_hooks): Use dummy for set_ignored_loc.
(size_of_aranges): Adjust formula for multi-part text ranges size.
(output_aranges): Output multi-part text ranges.
(dwarf2out_set_ignored_loc): New callback function.
(dwarf2out_finish): Output multi-part text ranges.
(dwarf2out_c_finalize): Clear new data items.
* final.c (final_start_function_1): Call set_ignored_loc callback.
(final_scan_insn_1): Likewise.
* ggc-page.c (gt_ggc_mx): New helper function.
* stringpool.c (gt_pch_nx): Likewise.
Eric Botcazou [Thu, 6 May 2021 14:26:55 +0000 (16:26 +0200)]
Fix PR testsuite/100454
gcc/testsuite/
* gnat.dg/opt93.adb: Compile only for LP64 targets.
Robin Dapp [Thu, 6 May 2021 13:55:47 +0000 (15:55 +0200)]
testsuite: Add s390 to vect_*_cvt checks.
This patch adds s390 to vect_*_cvt checks in target-supports.exp.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp: Add s390 checks for vect conversions.
Robin Dapp [Thu, 6 May 2021 13:52:48 +0000 (15:52 +0200)]
testsuite: Add vect_floatint_cvt to gcc.dg/vect/pr56541.c
pr56541.c converts a float vector to an int (bool) vector. Add
vect_floatint_cvt in order to select the right targets.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/pr56541.c: Add vect_floatint_cvt.
Paul Thomas [Thu, 6 May 2021 13:41:33 +0000 (14:41 +0100)]
Fortran: Assumed and explicit size class arrays [PR46691/99819].
2021-05-06 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran/ChangeLog
PR fortran/46691
PR fortran/99819
* class.c (gfc_build_class_symbol): Remove the error that
disables assumed size class arrays. Class array types that are
not deferred shape or assumed rank are given a unique name and
placed in the procedure namespace.
* trans-array.c (gfc_trans_g77_array): Obtain the data pointer
for class arrays.
(gfc_trans_dummy_array_bias): Suppress the runtime error for
extent violations in explicit shape class arrays because it
always fails.
* trans-expr.c (gfc_conv_procedure_call): Handle assumed size
class actual arguments passed to non-descriptor formal args by
using the data pointer, stored as the symbol's backend decl.
gcc/testsuite/ChangeLog
PR fortran/46691
PR fortran/99819
* gfortran.dg/class_dummy_6.f90: New test.
* gfortran.dg/class_dummy_7.f90: New test.
Patrick Palka [Thu, 6 May 2021 13:11:44 +0000 (09:11 -0400)]
libstdc++: Implement LWG 3533 changes to foo_view::iterator::base()
libstdc++-v3/ChangeLog:
* include/std/ranges (filter_view::_Iterator::base): Make the
const& overload unconstrained and return a const reference as
per LWG 3533. Make unconditionally noexcept.
(transform_view::_Iterator::base): Likewise.
(elements_view::_Iterator::base): Likewise.
Patrick Palka [Thu, 6 May 2021 13:11:42 +0000 (09:11 -0400)]
libstdc++: Implement LWG 3391 changes to move/counted_iterator::base()
libstdc++-v3/ChangeLog:
* include/bits/stl_iterator.h (move_iterator::base): Make the
const& overload unconstrained and return a const reference as
per LWG 3391. Make unconditionally noexcept.
(counted_iterator::base): Likewise.
* testsuite/24_iterators/move_iterator/lwg3391.cc: New test.
* testsuite/24_iterators/move_iterator/move_only.cc: Adjust
has_member_base concept to decay-copy the result of base().
Richard Biener [Thu, 6 May 2021 09:17:58 +0000 (11:17 +0200)]
refactor SSA rewriting timevars
This avoids too deep stacks of timevars during incremental
SSA rewrite and basically use TV_TREE_INTO_SSA for all into-SSA
rewrite work and TV_TREE_SSA_INCREMENTAL for update_ssa.
2021-05-06 Richard Biener <rguenther@suse.de>
* timevar.def (TV_TREE_INSERT_PHI_NODES): Remove.
(TV_TREE_SSA_REWRITE_BLOCKS): Likewise.
(TV_TREE_INTO_SSA): New.
* tree-into-ssa.c (insert_phi_nodes): Do not account separately.
(rewrite_blocks): Likewise.
(pass_data_build_ssa): Account to TV_TREE_INTO_SSA.
Jonathan Wakely [Thu, 6 May 2021 12:40:53 +0000 (13:40 +0100)]
libstdc++: Fix definition of std::remove_cvref_t
I originally defined std::remove_cvref_t in terms of the internal
__remove_cvref_t trait, to avoid instantiating the remove_cvref class
template. However, as described in P1715R0 that is observable by users
and is thus non-conforming.
This defines remove_cvref_t as specified in the standard.
libstdc++-v3/ChangeLog:
* include/std/type_traits (remove_cvref_t): Define in terms of
remove_cvref.
* testsuite/20_util/remove_cvref/value.cc: Check alias.
Jonathan Wakely [Thu, 6 May 2021 08:33:41 +0000 (09:33 +0100)]
Revert "libstdc++: Use unsigned char argument to std::isdigit"
This reverts commit
d0d6ca019717305df0ef41e3fe1da48f7f561fac.
Jakub Jelinek [Thu, 6 May 2021 12:05:06 +0000 (14:05 +0200)]
phiopt: Use gphi *phi instead of gimple *phi some more
Various functions in phiopt are also called with a gphi * but use
gimple * argument for it.
2021-05-06 Jakub Jelinek <jakub@redhat.com>
* tree-ssa-phiopt.c (value_replacement, minmax_replacement,
abs_replacement, xor_replacement,
cond_removal_in_popcount_clz_ctz_pattern,
replace_phi_edge_with_variable): Change type of phi argument from
gimple * to gphi *.
Richard Biener [Thu, 6 May 2021 09:29:25 +0000 (11:29 +0200)]
Avoid update_ssa quadraticness in loop splitting
We already take care to not apply loop splitting to IL produced
by splitting so we should be able to delay updating SSA and
loop-closed SSA that was left broken after loop versioning
until after we processed all opportunities.
2021-05-06 Richard Biener <rguenther@suse.de>
* tree-ssa-loop-split.c (split_loop): Delay updating SSA form.
Output an opt-info message.
(do_split_loop_on_cond): Likewise.
(tree_ssa_split_loops): Update SSA form here.
Richard Biener [Thu, 6 May 2021 07:44:49 +0000 (09:44 +0200)]
Fix IPA SRA removal of DECL_BY_REFERENCE return
While doing bogus call LHS removal I noticed that cloning with
dropping a return value creates a bogus replacement for a
DECL_BY_REFERENCE DECL_RESULT, resulting in MEM_REFs of
aggregates rather than pointers. The following fixes this
latent issue.
2021-05-06 Richard Biener <rguenther@suse.de>
* tree-inline.c (tree_function_versioning): Fix DECL_BY_REFERENCE
return variable removal.
Christophe Lyon [Thu, 6 May 2021 09:05:52 +0000 (09:05 +0000)]
testsuite: gcc.c-torture/execute/ieee/cdivchkld.c needs fmaxl
The new test gcc.c-torture/execute/ieee/cdivchkld.c needs fmaxl(),
which may not be available, for instance on aarch64-elf with newlib.
As discussed in the PR, requiring c99_runtime enables to skip the test
in this case.
2021-05-06 Christophe Lyon <christophe.lyon@linaro.org>
PR testsuite/100355
gcc/testsuite/
* gcc.c-torture/execute/ieee/cdivchkld.x: New.
Marius Hillenbrand [Tue, 4 May 2021 11:30:05 +0000 (13:30 +0200)]
IBM Z: Fix error checking for builtin vec_permi
The builtin vec_permi is peculiar in that its immediate operand is
encoded differently than the immediate operand that is backing the
builtin. This fixes the check for the immediate operand, adding a
regression test in the process.
This partially reverts commit
3191c1f4488d1f7563b563d7ae2a102a26f16d82
2021-05-06 Marius Hillenbrand <mhillen@linux.ibm.com>
gcc/ChangeLog:
* config/s390/s390-builtins.def (O_M5, O1_M5, ...): Remove unused macros.
(s390_vec_permi_s64, s390_vec_permi_b64, s390_vec_permi_u64)
(s390_vec_permi_dbl, s390_vpdi): Use the O3_U2 type for the immediate
operand.
* config/s390/s390.c (s390_const_operand_ok): Remove unused
values.
gcc/testsuite/ChangeLog:
* gcc.target/s390/zvector/imm-range-error-1.c: Fix test for
__builtin_s390_vpdi.
* gcc.target/s390/zvector/vec-permi.c: New test for builtin
vec_permi.
Jakub Jelinek [Thu, 6 May 2021 08:15:40 +0000 (10:15 +0200)]
phiopt: Optimize (x <=> y) cmp z [PR94589]
genericize_spaceship genericizes i <=> j to approximately
({ int c; if (i == j) c = 0; else if (i < j) c = -1; else c = 1; c; })
for strong ordering and
({ int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; c; })
for partial ordering.
The C++ standard supports then == or != comparisons of that against
strong/partial ordering enums, or </<=/==/!=/>/>= comparisons of <=> result
against literal 0.
In some cases we already optimize that but in many cases we keep performing
all the 2 or 3 comparisons, compute the spaceship value and then compare
that.
The following patch recognizes those patterns if the <=> operands are
integral types or floating point (the latter only for -ffast-math) and
optimizes it to the single comparison that is needed (plus adds debug stmts
if needed for the spaceship result).
There is one thing I'd like to address in a follow-up: the pr94589-2.C
testcase should be matching just 12 times each, but runs
into operator>=(partial_ordering, unspecified) being defined as
(_M_value&1)==_M_value
rather than _M_value>=0. When not honoring NaNs, the 2 case should be
unreachable and so (_M_value&1)==_M_value is then equivalent to _M_value>=0,
but is not a single use but two uses. I'll need to pattern match that case
specially.
2021-05-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/94589
* tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Call
spaceship_replacement.
(cond_only_block_p, spaceship_replacement): New functions.
* gcc.dg/pr94589-1.c: New test.
* gcc.dg/pr94589-2.c: New test.
* gcc.dg/pr94589-3.c: New test.
* gcc.dg/pr94589-4.c: New test.
* g++.dg/opt/pr94589-1.C: New test.
* g++.dg/opt/pr94589-2.C: New test.
* g++.dg/opt/pr94589-3.C: New test.
* g++.dg/opt/pr94589-4.C: New test.
Richard Biener [Wed, 5 May 2021 08:15:27 +0000 (10:15 +0200)]
ipa/100373 - fix emutls lowering compare-debug issue
emutls figured that tls uses in debug-insns need lowering but
that obviously has effects on code-generation as can be seen
in the following IL diff with the new testcase:
<bb 2> [local count:
1073741824]:
- a = 0;
+ # DEBUG BEGIN_STMT
_4 = __builtin___emutls_get_address (&__emutls_v.b);
+ # DEBUG D#1 => *_4
+ # DEBUG d => (long int) D#1
+ # DEBUG BEGIN_STMT
+ a = 0;
+ # DEBUG BEGIN_STMT
*_4 = 0;
return;
where it figured the debug use of b in the original
<bb 2> [local count:
1073741824]:
# DEBUG BEGIN_STMT
# DEBUG D#1 => b
# DEBUG d => (long int) D#1
# DEBUG BEGIN_STMT
a = 0;
needs lowering (it maybe does when we want to produce perfect
debug but that's just bad luck).
The following patch fixes this by avoiding to create a new
emutls address when visiting debug stmts and instead resets them.
Another option might be to simply not lower debug stmt uses
but I have no way to verify actual debug info for this.
2021-05-05 Richard Biener <rguenther@suse.de>
PR ipa/100373
* tree-emutls.c (gen_emutls_addr): Pass in whether we're
dealing with a debug use and only query existing addresses
if so.
(lower_emutls_1): Avoid splitting out addresses for debug
stmts, reset the debug stmt when we fail to find existing
lowered addresses.
(lower_emutls_phi_arg): Set wi.stmt.
* gcc.dg/pr100373.c: New testcase.
Javier Miranda [Sun, 24 Jan 2021 18:57:18 +0000 (13:57 -0500)]
[Ada] ACATS 4.1R-c611a04: Class-wide preconditions in dispatching calls
gcc/ada/
* exp_disp.adb (Build_Class_Wide_Check): Extending the
functionality of this routine to climb to the ancestors
searching for the enclosing overridden dispatching primitive
that has a class-wide precondition to generate the check.
Piotr Trojanek [Sun, 24 Jan 2021 15:02:49 +0000 (16:02 +0100)]
[Ada] Avoid repeated analysis of constraint ranges
gcc/ada/
* sem_ch3.adb (Constraint_Index): Remove redundant problematic
analysis.
Arnaud Charlet [Sun, 24 Jan 2021 14:08:14 +0000 (09:08 -0500)]
[Ada] Assert failure on E_Enumeration_Literal and front-end unnesting
gcc/ada/
* exp_unst.adb (Note_Uplevel_Bound): Exclude
E_Enumeration_Literal.
Arnaud Charlet [Fri, 22 Jan 2021 13:55:13 +0000 (08:55 -0500)]
[Ada] Bad expansion with -gnato2 and if expression
gcc/ada/
* exp_ch4.adb (Expand_N_If_Expression):
Apply_Arithmetic_Overflow_Check will not deal with
Then/Else_Actions so skip minimizing overflow checks if any
actions are present.
Boris Yakobowski [Thu, 21 Jan 2021 17:43:27 +0000 (18:43 +0100)]
[Ada] In CodePeer mode, use regular-exception handling
gcc/ada/
* gnat1drv.adb (Adjust_Global_Switches): Simplify logic.
Arnaud Charlet [Thu, 21 Jan 2021 09:28:16 +0000 (04:28 -0500)]
[Ada] AI12-0411: Add "bool" to Interfaces.C
gcc/ada/
* libgnat/i-c.ads (bool): New type.
* libgnat/i-cexten.ads, libgnat/i-cexten__128.ads (bool): Now
a subtype of Interfaces.C.bool.
* libgnarl/s-interr__vxworks.adb (Interrupt_Manager): Qualify
False.
* libgnarl/s-interr.adb, libgnarl/s-interr__hwint.adb,
libgnarl/s-tasini.adb, libgnarl/s-tasren.adb,
libgnarl/s-tassta.adb, libgnarl/s-tpobmu.adb,
libgnarl/s-tpobop.adb, libgnarl/s-tpopmo.adb: Replace
Assert (False) by Assert (Standard.False).
Ghjuvan Lacambre [Thu, 21 Jan 2021 12:29:51 +0000 (13:29 +0100)]
[Ada] Explain meaning of Non_Std_Executable
gcc/ada/
* make.adb (Compute_Executable): Document parameter.
Eric Botcazou [Thu, 21 Jan 2021 12:12:50 +0000 (13:12 +0100)]
[Ada] Do not second-guess the hardware for underflow handling of Scaling
gcc/ada/
* libgnat/s-fatgen.adb (Scaling): Use single handling of
underflow. Add pragma Annotate.
Ghjuvan Lacambre [Wed, 13 Jan 2021 17:03:15 +0000 (18:03 +0100)]
[Ada] Make Is_OK_Static_Subtype use Is_Static_Subtype
gcc/ada/
* sem_eval.adb (Is_OK_Static_Subtype): Call Is_Static_Subtype,
remove redundant checks.
Piotr Trojanek [Wed, 20 Jan 2021 16:41:09 +0000 (17:41 +0100)]
[Ada] Remove repeated calls in Resolve_Range
gcc/ada/
* sem_res.adb (First_Last_Ref): Simplify "if [condition] then
return True" in "return [condition]".
(Resolve_Range): Remove calls appearing in IF condition from the
THEN statements.
Piotr Trojanek [Wed, 20 Jan 2021 11:41:16 +0000 (12:41 +0100)]
[Ada] Use high-level Make_Character_Literal instead of low-level New_Node
gcc/ada/
* sem_case.adb (Missing_Choice): Fix typo in comment.
(Lit_Of): Simplify with Make_Character_Literal.
(Check_Choices): Remove extra spaces in parameter
specifications.
* sem_case.ads: Same reformatting.
Ed Schonberg [Wed, 20 Jan 2021 21:15:30 +0000 (16:15 -0500)]
[Ada] Missing semantic error on ineffective Others_Clause
gcc/ada/
* exp_aggr.adb (Expand_Array_Aggregate): If the expression in an
Others_Clause has not been analyzed because previous analysis of
the enclosing aggregate showed the clause to be ineffective i.e.
cover a null range, analyze it now to detect a possible type
illegality.
Eric Botcazou [Wed, 20 Jan 2021 16:08:51 +0000 (17:08 +0100)]
[Ada] Fix off-by-one bug in underflow handling of Scaling
gcc/ada/
* libgnat/s-fatgen.adb (Scaling): Fix off-by-one bug for underflow.
Arnaud Charlet [Wed, 20 Jan 2021 09:50:14 +0000 (04:50 -0500)]
[Ada] Assert failure on pragma Inline in procedure body
gcc/ada/
* sem_ch6.adb (Is_Inline_Pragma): Protect against N not being a
list member in both branches.
Piotr Trojanek [Tue, 19 Jan 2021 14:07:35 +0000 (15:07 +0100)]
[Ada] Remove hardcoded pragma Warnings from the formal vectors library
gcc/ada/
* libgnat/a-cofove.adb (Insert_Space): Remove hardcoded pragma
Warnings.
Piotr Trojanek [Fri, 8 Jan 2021 20:43:10 +0000 (21:43 +0100)]
[Ada] Set Raises_CE flag only in Apply_Compile_Time_Constraint_Error
gcc/ada/
* sem_ch4.adb (Analyze_Selected_Component): Remove explicit call
to Set_Raises_Constraint_Error on statically missing component.
* sem_eval.adb (Eval_Arithmetic_Op): Likewise for static
divisions by integer and real zeros.
* sem_util.adb (Apply_Compile_Time_Constraint_Error): Call
Set_Raises_Constraint_Error before exiting early in GNATprove
mode.
Justin Squirek [Fri, 15 Jan 2021 15:59:49 +0000 (10:59 -0500)]
[Ada] Spurious constraint error on conversion of access types
gcc/ada/
* checks.adb (Make_Discriminant_Constraint_Check): Add check for
null when the type being converted is an access type.
Arnaud Charlet [Tue, 19 Jan 2021 08:32:24 +0000 (03:32 -0500)]
[Ada] Fix handling of PATs
gcc/ada/
* exp_pakd.adb (Expand_Packed_Eq): Fix handling of PATs.
Piotr Trojanek [Tue, 19 Jan 2021 10:59:57 +0000 (11:59 +0100)]
[Ada] Remove unused initial value in Read_Library_Info_From_Full
gcc/ada/
* osint.adb (Read_Library_Info_From_Full): Cleanup unused
initial value.
Eric Botcazou [Mon, 18 Jan 2021 18:30:27 +0000 (19:30 +0100)]
[Ada] Document a few more characteristics of floating-point support
gcc/ada/
* doc/gnat_rm/implementation_defined_characteristics.rst (3.5.7):
Mention the IEEE standard explicitly. Use current format names.
Document assumed rounding mode and new features of I/O support.
* gnat_rm.texi: Regenerate.
Eric Botcazou [Mon, 18 Jan 2021 10:19:01 +0000 (11:19 +0100)]
[Ada] Reset x87 FPU to 64-bit precision for floating-point I/O on Linux
gcc/ada/
* init.c (__gnat_init_float): Use full version on Linux too.
Eric Botcazou [Fri, 15 Jan 2021 18:01:59 +0000 (19:01 +0100)]
[Ada] Make new implementation of System.Fat_Gen.Valid more robust
gcc/ada/
* libgnat/s-fatgen.adb (Valid): Do a bit comparison with 0.0
when denormalized numbers are not supported.
Piotr Trojanek [Fri, 15 Jan 2021 23:00:35 +0000 (00:00 +0100)]
[Ada] Fix restriction No_Enumeration_Maps on both Image attributes
gcc/ada/
* sem_attr.adb (Check_Enum_Image): Reword comment; add
Check_Enumeration_Maps parameter. Now this routine combines
both referencing enumeration literals and checking restriction
No_Enumeration_Maps, if required.
(Analyze_Attribute): Remove duplicated code and instead call
Check_Enum_Image.
Piotr Trojanek [Fri, 15 Jan 2021 15:58:41 +0000 (16:58 +0100)]
[Ada] Remove redundant condition for Image attribute and Ada version
gcc/ada/
* sem_attr.adb (Analyze_Image_Attribute): Remove redundant
condition; add a missing header box.
Gary Dismukes [Fri, 15 Jan 2021 19:45:42 +0000 (14:45 -0500)]
[Ada] Add mention of underscore and fix grammar error in doc for -gnatd
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add
mention of underscore and fix grammar error in doc for -gnatd.
* gnat_ugn.texi: Regenerate.
Eric Botcazou [Thu, 14 Jan 2021 12:16:16 +0000 (13:16 +0100)]
[Ada] Implement tiered support for floating-point exponentiation
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-exponr, s-exnflt
and s-exnlfl.
* exp_ch4.adb (Expand_N_Op_Expon): Use RE_Exn_Float for Short_Float.
* rtsfind.ads (RTU_Id): Add System_Exn_Flt and System_Exn_LFlt.
(RE_Id): Adjust entries for RE_Exn_Float and RE_Exn_Long_Float.
(RE_Unit_Table): Likewise.
* libgnat/s-exnflt.ads: New file.
* libgnat/s-exnlfl.ads: Likewise.
* libgnat/s-exnllf.ads: Change to mere instantiation.
* libgnat/s-exnllf.adb: Move implementation to...
* libgnat/s-exponr.ads: New generic unit.
* libgnat/s-exponr.adb: ...here and also make it generic.
(Expon): Do the computation in double precision internally.
Piotr Trojanek [Fri, 15 Jan 2021 13:08:07 +0000 (14:08 +0100)]
[Ada] Style cleanups related to writing of ALI files
gcc/ada/
* lib-writ.adb, osint.adb, osint.ads: Cleanup.
Piotr Trojanek [Fri, 15 Jan 2021 13:01:59 +0000 (14:01 +0100)]
[Ada] Remove excessive conditions in iterations across components
gcc/ada/
* exp_ch3.adb (Expand_Freeze_Array_Type): Remove excessive
condition.
(Expand_N_Object_Declaration): Likewise.
(Build_Equivalent_Aggregate): Likewise.
(Initialization_Warning): Likewise; change another excessive
condition into assertion.
* freeze.adb (Freeze_Entity): Remove excessive condition.
Ed Schonberg [Thu, 14 Jan 2021 22:54:05 +0000 (17:54 -0500)]
[Ada] Crash on if_expression used as index of discriminant-dependent array
gcc/ada/
* sem_res.adb (Resolve_If_Expression): If the context of the
expression is an indexed_component, resolve the expression and
its dependent_expressions with the base type of the index, to
ensure that an index check is generated when resolving the
enclosing indexxed_component, and avoid an improper use of
discriminants out of scope, when the index type is
discriminant-dependent.
Arnaud Charlet [Fri, 15 Jan 2021 10:41:45 +0000 (05:41 -0500)]
[Ada] Fix typos
gcc/ada/
* einfo.ads, exp_prag.adb, exp_util.adb: Fix typos.
Christoph Muellner [Wed, 5 May 2021 19:23:41 +0000 (21:23 +0200)]
RISC-V: Generate helpers for cbranch4.
On RISC-V we are facing the fact, that our conditional branches
require Pmode conditions. Currently, we generate them explicitly
with a check for Pmode and then calling the proper generator
(i.e. gen_cbranchdi4 on RV64 and gen_cbranchsi4 on RV32).
Let's simplify this code by generating the INSN helpers
and use gen_cbranch4 (Pmode).
gcc/
PR target/100266
* config/riscv/riscv.c (riscv_block_move_loop): Use cbranch helper.
* config/riscv/riscv.md (cbranch<mode>4): Generate helpers.
(stack_protect_test): Use cbranch helper.
GCC Administrator [Thu, 6 May 2021 00:16:37 +0000 (00:16 +0000)]
Daily bump.
Eric Botcazou [Wed, 5 May 2021 20:48:51 +0000 (22:48 +0200)]
Fix PR target/100402
This is a regression for 64-bit Windows present from mainline down to the 9
branch and introduced by the fix for PR target/99234. Again SEH, but with
a twist related to the way MinGW implements setjmp/longjmp, which turns out
to be piggybacked on SEH with recent versions of MinGW, i.e. the longjmp
performs a bona-fide unwinding of the stack, because it calls RtlUnwindEx
with the second argument initially passed to setjmp, which is the result of
__builtin_frame_address (0) in the MinGW header file:
define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
This means that we directly expose the frame pointer to the SEH machinery
here (unlike with regular exception handling where we use an intermediate
CFA) and thus that we cannot do whatever we want with it. The old code
would leave it unaligned, i.e. not multiple of 16, whereas the new code
aligns it, but this breaks for some reason; at least it appears that a
.seh_setframe directive with 0 as second argument always works, so the
fix aligns it this way.
gcc/
PR target/100402
* config/i386/i386.c (ix86_compute_frame_layout): For a SEH target,
always return the establisher frame for __builtin_frame_address (0).
gcc/testsuite/
* gcc.c-torture/execute/
20210505-1.c: New test.
Ivan Sorokin [Mon, 3 May 2021 08:39:48 +0000 (11:39 +0300)]
x86: Build only one __cpu_model/__cpu_features2 variables
GCC -O2 generated quite bad code for this function:
bool
f (void)
{
return __builtin_cpu_supports("popcnt")
&& __builtin_cpu_supports("ssse3");
}
f:
movl __cpu_model+12(%rip), %edx
movl %edx, %eax
shrl $6, %eax
andl $1, %eax
andl $4, %edx
movl $0, %edx
cmove %edx, %eax
ret
The problem was caused by the fact that internally every invocation of
__builtin_cpu_supports built a new variable __cpu_model and a new type
__processor_model. Because of this, GIMPLE level optimizers weren't able
to CSE the loads of __cpu_model and optimize bit-operations properly.
Improve GCC -O2 code generation by caching __cpu_model and__cpu_features2
variables as well as their types:
f:
movl __cpu_model+12(%rip), %eax
andl $68, %eax
cmpl $68, %eax
sete %al
ret
2021-05-05 Ivan Sorokin <vanyacpp@gmail.com>
H.J. Lu <hjl.tools@gmail.com>
gcc/
PR target/91400
* config/i386/i386-builtins.c (ix86_cpu_model_type_node): New.
(ix86_cpu_model_var): Likewise.
(ix86_cpu_features2_type_node): Likewise.
(ix86_cpu_features2_var): Likewise.
(fold_builtin_cpu): Cache __cpu_model and __cpu_features2 with
their types.
gcc/testsuite/
PR target/91400
* gcc.target/i386/pr91400-1.c: New test.
* gcc.target/i386/pr91400-2.c: Likewise.
Martin Sebor [Wed, 5 May 2021 17:07:39 +0000 (11:07 -0600)]
PR middle-end/100325 - missing warning with -O0 on sprintf overflow with pointer plus offset
gcc/ChangeLog:
* passes.def (pass_warn_printf): Run after SSA.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test.
Patrick Palka [Wed, 5 May 2021 16:07:52 +0000 (12:07 -0400)]
libstdc++: Don't constrain some enable_borrowed_range specializations
These constraints are already present on the template we're partially
specializing for.
libstdc++-v3/ChangeLog:
* include/bits/ranges_util.h (enable_borrowed_range<subrange>):
Remove constraints on this partial specialization.
* include/std/ranges (enable_borrowed_range<iota_view>):
Likewise.
Patrick Palka [Wed, 5 May 2021 16:07:32 +0000 (12:07 -0400)]
libstdc++: Implement LWG 3517/3520 for join_view/transform_view
libstdc++-v3/ChangeLog:
* include/std/ranges (transform_view::_Iterator::iter_swap):
Remove as per LWG 3520.
(join_view::_Iterator::iter_swap): Add indirectly_swappable
constraint as per LWG 3517.
Prathamesh Kulkarni [Wed, 5 May 2021 15:41:45 +0000 (21:11 +0530)]
arm/97903: Missed optimization in lowering test operation.
gcc/ChangeLog:
2021-05-05 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* config/arm/neon.md (neon_vtst_combine<mode>): New pattern.
* config/arm/predicates.md (minus_one_operand): New predicate.
Jeff Law [Wed, 5 May 2021 15:15:42 +0000 (09:15 -0600)]
Remove cc0 remnants from avr port
gcc/
* config/avr/avr.md: Remove references to CC_STATUS_INIT.
Stefan Schulze Frielinghaus [Wed, 5 May 2021 15:00:43 +0000 (17:00 +0200)]
PR rtl-optimization/100263: Ensure register can change mode
For move2add_valid_value_p we also have to ask the target whether a
register can be accessed in a different mode than it was set before.
gcc/ChangeLog:
PR rtl-optimization/100263
* postreload.c (move2add_valid_value_p): Ensure register can
change mode.
Eric Botcazou [Wed, 5 May 2021 14:50:55 +0000 (16:50 +0200)]
Fix PR rtl-optimization/100411
This is the bootstrap failure of GCC 11 on MinGW64 configured with --enable-
tune=nocona. The bottom line is that SEH does not support CFI for epilogues
but the x86 back-end nevertheless attaches it to instructions, so we have to
filter it out and this is done by detecting the end of the prologue by means
of the NOTE_INSN_PROLOGUE_END note.
But the compiler manages to generate a second epilogue before this note in
the RTL stream and this fools the aforementioned logic. The root cause is
cross-jumping, which inserts a jump before the end of the prologue, in fact
just before the note; the rest (CFG cleanup, BB reordering, etc) is downhill
from there.
gcc/
PR rtl-optimization/100411
* cfgcleanup.c (try_crossjump_to_edge): Also skip end of prologue
and beginning of function markers.
Jeff Law [Wed, 5 May 2021 13:49:28 +0000 (07:49 -0600)]
Remove NOTICE_UPDATE_CC remnants on cr16
gcc
* config/cr16/cr16.h (NOTICE_UPDATE_CC): Remove.
* config/cr16/cr16.c (notice_update_cc): Remove.
* config/cr16/cr16-protos.h (notice_update_cc): Remove.
Harald Anlauf [Wed, 5 May 2021 13:25:50 +0000 (15:25 +0200)]
PR fortran/100274 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131
When the check for the length of formal and actual character arguments
found a mismatch and emitted a warning, it would skip further checks
like that could lead to errors. Fix that by continuing the checking.
Also catch a NULL pointer dereference.
gcc/fortran/ChangeLog:
PR fortran/100274
* interface.c (gfc_compare_actual_formal): Continue checks after
emitting warning for argument length mismatch.
* trans-expr.c (gfc_conv_procedure_call): Check for NULL pointer
dereference.
gcc/testsuite/ChangeLog:
PR fortran/100274
* gfortran.dg/argument_checking_25.f90: New test.
Uros Bizjak [Wed, 5 May 2021 13:07:25 +0000 (15:07 +0200)]
i386: Implement integer vector compares for 64bit vectors [PR98218]
Implement integer vector compares for 64bit vectors for TARGET_MMX_WITH_SSE.
2021-05-05 Uroš Bizjak <ubizjak@gmail.com>
gcc/
PR target/98218
* config/i386/i386-expand.c (ix86_expand_int_sse_cmp):
Handle V8QI, V4HI and V2SI modes.
* config/i386/i386.c (ix86_build_const_vector): Handle V2SImode.
(ix86_build_signbit_mask): Ditto.
* config/i386/mmx.md (MMXMODE14): New mode iterator.
(<smaxmin:code><MMXMODE14:mode>3): New expander.
(*mmx_<smaxmin:code><MMXMODE14:mode>3): New insn pattern.
(<umaxmin:code><MMXMODE24:mode>3): New expander.
(*mmx_<umaxmin:code><MMXMODE24:mode>3): New insn pattern.
(vec_cmp<MMXMODEI:mode><MMXMODEI:mode>): New expander.
(vec_cmpu<MMXMODEI:mode><MMXMODEI:mode>): Ditto.
(vcond<MMXMODEI:mode><MMXMODEI:mode>): Ditto.
(vcondu<MMXMODEI:mode><MMXMODEI:mode>): Ditto.
(vcond_mask_<MMXMODEI:mode><MMXMODEI:mode>): Ditto.
gcc/testsuite/
PR target/98218
* gcc.target/i386/pr98218-1.c: New test.
* gcc.target/i386/pr98218-1a.c: Ditto.
* gcc.target/i386/pr98218-2.c: Ditto.
* gcc.target/i386/pr98218-2a.c: Ditto.
* gcc.target/i386/pr98218-3.c: Ditto.
* gcc.target/i386/pr98218-3a.c: Ditto.
* gcc.dg/vect/vect-bool-cmp.c (dg-final):
Scan vect tree dump for "LOOP VECTORIZED", not VECTORIZED.
Jonathan Wakely [Wed, 5 May 2021 11:41:14 +0000 (12:41 +0100)]
libstdc++: Add tests for std::invoke feature test macro
libstdc++-v3/ChangeLog:
* testsuite/20_util/function_objects/invoke/3.cc: Check feature
test macro.
* testsuite/20_util/function_objects/invoke/version.cc: New test.
Jonathan Wakely [Wed, 5 May 2021 10:19:55 +0000 (11:19 +0100)]
libstdc++: Use unsigned char argument to std::isdigit
Passing plain char to isdigit is undefined if the value is negative.
libstdc++-v3/ChangeLog:
* include/std/charconv (__from_chars_alnum): Pass unsigned
char to std::isdigit.
Eric Botcazou [Wed, 5 May 2021 10:48:44 +0000 (12:48 +0200)]
Minor formatting tweak
gcc/testsuite/
* gnat.dg/debug17.adb: Minor tweak.
Eric Botcazou [Wed, 5 May 2021 10:07:24 +0000 (12:07 +0200)]
Generate debug info for local dynamic record types
In Ada you can embed VLAs in local record types and thus end up with
dynamic offsets in record types, which are not well described in DWARF
because 1) the temporaries generated for them by the gimplifier are
naturally marked DECL_IGNORED_P and 2) when the types are referenced
in nested subprograms, the DWARF back-end does not correctly handle
the rewritten references.
gcc/
* dwarf2out.c (loc_list_from_tree_1) <DECL>: During early DWARF, do
not expand the VALUE_EXPR of variables put in the non-local frame.
* gimplify.c (gimplify_type_sizes) <RECORD_TYPE>: If the type is not
to be ignored for debug info, ensure its variable offsets are not.
gcc/testsuite/
* gnat.dg/debug8.adb: Minor tweak.
* gnat.dg/debug11.adb: Likewise.
* gnat.dg/debug16.adb: Likewise.
* gnat.dg/debug17.adb: New test.
* gnat.dg/specs/debug1.ads: Minor tweak.
Tobias Burnus [Wed, 5 May 2021 09:48:48 +0000 (11:48 +0200)]
libgfortran/intrinsics/chmod.c: Silence unused var warning
libgfortran/ChangeLog:
* intrinsics/chmod.c (chmod_internal): Only declare mode_mask var
if HAVE_UMASK.
Robin Dapp [Tue, 27 Apr 2021 15:11:54 +0000 (17:11 +0200)]
testsuite: Add s390 to gcc.dg/vect/slp-21.c
On s390 we vectorize 4 statements using SLP. Add s390*-*-* to the
appropriate dg-finals.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/slp-21.c: Add s390.
Piotr Trojanek [Thu, 14 Jan 2021 16:28:31 +0000 (17:28 +0100)]
[Ada] Fix expansion of attributes Input/Output for unchecked union types
gcc/ada/
* exp_attr.adb (Expand_N_Attribute_Reference): Fix expansion of
attributes Input and Output for unchecked unions.
* sem_case.ads: Fix typo "disriminant" and refill comment.
Piotr Trojanek [Thu, 14 Jan 2021 20:14:06 +0000 (21:14 +0100)]
[Ada] Reuse Has_Defaulted_Discriminants where possible
gcc/ada/
* exp_attr.adb, exp_ch9.adb, sem_ch3.adb: Reuse
Has_Defaulted_Discriminants.
* sem_ch4.adb (Analyze_Allocator): Reuse
Has_Defaulted_Discriminants (after reordering conjuncts); remove
redundant IF statement, whose condition is implied by
Has_Defaulted_Discriminants.
* sem_util.adb (Has_Defaulted_Discriminants): Has_Discriminants
implies that the First_Discriminant is present.
(Is_Fully_Initialized_Type): Reuse Has_Defaulted_Discriminants.
Justin Squirek [Thu, 14 Jan 2021 12:52:26 +0000 (07:52 -0500)]
[Ada] Incorrect accessibility level on actual in procedure call
gcc/ada/
* exp_ch6.adb (Expand_Call_Helper): Add condition to check for
expanded actuals and remove dead code.
Piotr Trojanek [Wed, 13 Jan 2021 16:17:34 +0000 (17:17 +0100)]
[Ada] Detect unchecked union subcomponents in nested variant parts
gcc/ada/
* exp_ch4.adb (Has_Unconstrained_UU_Component): Rewrite to
follow the Ada RM grammar.
Piotr Trojanek [Wed, 13 Jan 2021 21:53:32 +0000 (22:53 +0100)]
[Ada] Refine types of variables with call to Scope as their initial values
gcc/ada/
* exp_ch4.adb (User_Defined_Primitive_Equality_Op): Refine type
of a local variable.
* exp_dbug.adb (Scope_Contains): Refine all types from Node_Id
to Entity_Id; rename parameters to match those of the
Scope_Within routine (which is similar but not the same); also,
simplify an OR ELSE into a membership test.