Richard Kenner [Mon, 17 Feb 2020 23:17:58 +0000 (18:17 -0500)]
[Ada] Issue with unnesting of 'First/Last and renaming
2020-06-08 Richard Kenner <kenner@adacore.com>
gcc/ada/
* exp_unst.adb (Visit_Node): When visiting array attribute
nodes, in addition to checking the type of Get_Referenced_Object
of the prefix, also check the actual type of the prefix.
Gary Dismukes [Mon, 17 Feb 2020 06:31:57 +0000 (01:31 -0500)]
[Ada] Implement predicate checks on qualified expressions (AI12-0100)
2020-06-08 Gary Dismukes <dismukes@adacore.com>
gcc/ada/
* checks.adb (Apply_Predicate_Check): Refine test for being in a
subprogram body to account for no Corresponding_Body case,
avoiding blowups arising due to other changes here.
* exp_ch4.adb (Expand_N_Qualified_Expression): Apply predicate
checks, if any, after constraint checks are applied.
* sem_eval.ads (Check_Expression_Against_Static_Predicate): Add
Check_Failure_Is_Error formal for conditionalizing warning vs.
error messages.
* sem_eval.adb (Check_Expression_Against_Static_Predicate):
Issue an error message rather than a warning when the new
Check_Failure_Is_Error formal is True. In the nonstatic or
Dynamic_Predicate case where the predicate is known to fail,
emit the check to ensure that folded cases get checks applied.
* sem_res.adb (Resolve_Qualified_Expression): Call
Check_Expression_Against_Static_Predicate, passing True for
Check_Failure_Is_Error, to ensure we reject static predicate
violations. Remove code that was conditionally calling
Apply_Predicate_Check, which is no longer needed, and that check
procedure shouldn't be called from a resolution routine in any
case. Also remove associated comment about preventing infinite
recursion and consistency with Resolve_Type_Conversion, since
that handling was already similarly removed from
Resolve_Type_Convesion at some point.
(Resolve_Type_Conversion): Add passing of True for
Check_Failure_Is_Error parameter on call to
Check_Expression_Against_Static_Predicate, to ensure that static
conversion cases that violate a predicate are rejected as
errors.
Piotr Trojanek [Mon, 17 Feb 2020 13:15:16 +0000 (14:15 +0100)]
[Ada] Restore Snames.Name_SPARK as it used in the GNATprove backend
2020-06-08 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* snames.ads-tmpl (Name_SPARK): Restore after being deleted.
Arnaud Charlet [Mon, 10 Feb 2020 20:18:47 +0000 (15:18 -0500)]
[Ada] Remove processing of SPARK_05 restriction
2020-06-08 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* exp_aggr.adb, exp_ch6.adb, par-ch11.adb, par-ch6.adb,
par-ch7.adb, par-prag.adb, restrict.adb, restrict.ads,
scans.ads, scng.adb, sem_aggr.adb, sem_attr.adb, sem_ch11.adb,
sem_ch12.adb, sem_ch3.adb, sem_ch3.ads, sem_ch4.adb,
sem_ch5.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_ch9.adb,
sem_res.adb, sem_util.adb, sem_util.ads, snames.ads-tmpl,
gnatbind.adb, libgnat/s-rident.ads,
doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
Remove processing of SPARK_05 restriction.
* gnat_rm.texi: Regenerate.
* opt.ads: Remove processing of old checksum which is now
handled by gprbuild directly.
Arnaud Charlet [Sun, 16 Feb 2020 12:16:45 +0000 (07:16 -0500)]
[Ada] AI12-0287 Legality Rules for null exclusions in renaming are too fierce
2020-06-08 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_ch12.adb (Instantiate_Object): Relax rules related to null
exclusions and generic objects. Handle all anonymous types
consistently and not just E_Anonymous_Access_Type.
* sem_ch8.adb (Analyze_Object_Renaming): Change wording so that
it applies to both renamings and instantiations to avoid
confusion.
Arnaud Charlet [Sat, 15 Feb 2020 17:37:13 +0000 (12:37 -0500)]
[Ada] Ada.Text_IO: fix typo
2020-06-08 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* libgnat/a-textio.ads (File_Mode): Fix typo in comment.
Eric Botcazou [Sat, 15 Feb 2020 15:48:15 +0000 (16:48 +0100)]
[Ada] Do not warn on partial access to atomic object with address clause
2020-06-08 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Indexed_Component): Do not give a warning
for a nonatomic component of an atomic array which is subject to
an address clause in Ada 2020 mode.
(Resolve_Selected_Component): Likewise for an atomic record.
Philippe Gil [Mon, 3 Feb 2020 13:56:23 +0000 (14:56 +0100)]
[Ada] Add gnatname use for multiple units files support
2020-06-08 Philippe Gil <gil@adacore.com>
gcc/ada/
* doc/gnat_ugn/the_gnat_compilation_model.rst: in "Handling
Files with Multiple Units" part documents gnatname use for
unmodified files handling and gnatchop use for files
refactoring.
* gnat_ugn.texi: Regenerate.
Arnaud Charlet [Fri, 14 Feb 2020 08:12:30 +0000 (03:12 -0500)]
[Ada] Update doc on Enum_Rep/Enum_Val
2020-06-08 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* doc/gnat_rm/implementation_defined_attributes.rst:
Enum_Rep/Enum_Val are standard Ada 202x attributes.
* gnat_rm.texi: Regenerate.
Javier Miranda [Mon, 10 Feb 2020 22:12:32 +0000 (17:12 -0500)]
[Ada] Better code generation for nested aggregates
2020-06-08 Javier Miranda <miranda@adacore.com>
gcc/ada/
* exp_aggr.adb (Safe_Component): Remove code that considers as
unsafe components that are aggregates; such removal allows the
frontend to proceed and evaluate if they are safe by means of
invoking Safe_Aggregate.
Piotr Trojanek [Wed, 12 Feb 2020 10:00:38 +0000 (11:00 +0100)]
[Ada] Reuse standard expansion of 'First and 'Last in GNATprove mode
2020-06-08 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Apply
standard expansion to attributes First and Last.
Piotr Trojanek [Tue, 11 Feb 2020 22:01:06 +0000 (23:01 +0100)]
[Ada] Reuse Get_Index_Subtype in the special expander for GNATprove
2020-06-08 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_attr.adb, exp_util.ads, exp_util.adb (Get_Index_Subtype):
Move from the body of Exp_Attr to Exp_Util and expose from the
spec.
* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Replace
duplicated code with a call to Get_Index_Subtype.
Arnaud Charlet [Sun, 9 Feb 2020 19:53:05 +0000 (14:53 -0500)]
[Ada] AI12-0226 Make objects more consistent
2020-06-08 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_ch8.adb (Analyze_Object_Renaming): Simplify code by moving
many special cases to Is_Object_Reference and removing others by
only checking renamings coming from sources.
* sem_util.adb (Is_Object_Reference): Update for AI12-0226 and
add more regular handling of 'Priority. Remove special cases no
longer needed now that we are only checking renamings coming
from sources.
Claire Dross [Mon, 10 Feb 2020 13:51:30 +0000 (14:51 +0100)]
[Ada] Silence spurious warning on instances of formal vectors
2020-06-08 Claire Dross <dross@adacore.com>
gcc/ada/
* libgnat/a-cofove.adb (Insert_Space): The computation of Index
generates a spurious compiler warning about a value not being in
range for a statically dead branch. Silence it using pragma
Warnings.
Bob Duff [Tue, 11 Feb 2020 00:21:00 +0000 (19:21 -0500)]
[Ada] gnatbind: Deterministic No_Entry_Calls_In_Elaboration_Code messages
2020-06-08 Bob Duff <duff@adacore.com>
gcc/ada/
* bindo-graphs.adb (function Add_Edge): Rename
Add_Edge_With_Return to Add_Edge; we can tell it returns because
it's a function, and overloading seems appropriate in this case.
If Activates_Task=True, and we're not going to add a new edge
because an existing Pred-->Succ edge already exists, then set
Activates_Task to True on the preexisting edge. This ensures
that the message:
info: use pragma Restrictions (No_Entry_Calls_In_Elaboration_Code)
appears when appropriate, no matter in what order the edges
happened to be processed.
(procedure Add_Edge): Remove redundant assertions.
(Activates_Task): Other kinds of edges can have
Activates_Task=True. For example, if we had a With_Edge and
then an Invocation_Edge with Activates_Task=True, then the
With_Edge has Activates_Task set to True.
(Add_Edge_Kind_Check): New procedure to prevent other bugs of
this nature. For example, if we were to sometimes call Add_Edge
for a Spec_Before_Body_Edge followed by Add_Edge for a
With_Edge, and sometimes in the other order, that would cause a
similar bug to what we're fixing here.
(Set_Is_Recorded_Edge): Val parameter is not used. Get rid of
it.
(Set_Activates_Task): New procedure to set the Activates_Task flag.
* bindo-graphs.ads (Library_Graph_Edge_Kind): Reorder the
enumeration literals to facilitate Add_Edge_Kind_Check.
* ali.adb (Known_ALI_Lines): The comment about "still available"
was wrong. Fix that by erasing the comment, and encoding the
relevant information in real code. Take advantage of Ada's full
coverage rules by removing "others =>". Also DRY.
Ed Schonberg [Mon, 10 Feb 2020 00:30:05 +0000 (19:30 -0500)]
[Ada] Ada_2020: shared variable control aspects on formal derived types
2020-06-08 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* par-ch12.adb (P_Formal_Derived_Type_Definition): Handle
properly formal derived types that include aspect
specifications, so that the "with" keyword appears twice in the
formal type declaration.
* sem_ch13.adb (Has_Generic_Parent): Return true if the type
itself is a generic formal.
Dmitriy Anisimkov [Thu, 6 Feb 2020 10:25:06 +0000 (16:25 +0600)]
[Ada] Fix socket timeout correction for Windows Server 2019 case
2020-06-08 Dmitriy Anisimkov <anisimko@adacore.com>
gcc/ada/
* socket.c (__gnat_minus_500ms): Remove
IsWindowsVersionOrGreater from condition.
Claire Dross [Mon, 10 Feb 2020 11:30:40 +0000 (12:30 +0100)]
[Ada] Add Depends contracts to Delete procedures of formal containers
2020-06-08 Claire Dross <dross@adacore.com>
gcc/ada/
* libgnat/a-cfdlli.ads, libgnat/a-cfhama.ads,
libgnat/a-cfhase.ads, libgnat/a-cforma.ads, libgnat/a-cforse.ads
(Delete): Add Depends contract.
Arnaud Charlet [Fri, 31 Jan 2020 16:09:11 +0000 (11:09 -0500)]
[Ada] AI12-0309 Missing checks for pragma Suppress
2020-06-08 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* snames.ads-tmpl (Name_Program_Error_Check,
Name_Tasking_Check): New constants.
* types.ads (Program_Error_Check, Tasking_Check): New constants.
(All_Checks): Update accordingly.
GCC Administrator [Mon, 8 Jun 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.
Iain Buclaw [Sun, 7 Jun 2020 19:58:49 +0000 (21:58 +0200)]
d: Merge upstream dmd
73d8e2fec.
Renames the enum PROTKIND to Prot::Kind, updates all uses of the
original enum accordingly.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
73d8e2fec.
* decl.cc (get_symbol_decl): Use new Prot::Kind enum.
* modules.cc (get_internal_fn): Likewise.
Uros Bizjak [Sun, 7 Jun 2020 20:07:28 +0000 (22:07 +0200)]
i386: Improve expansion of __builtin_parity
GCC currently hides the shift and xor reduction inside a backend
specific UNSPEC PARITY, making it invisible to the RTL optimizers until
very late during compilation. It is normally reasonable for the
middle-end to maintain wider mode representations for as long as possible
and split them later, but this only helps if the semantics are visible
at the RTL-level (to combine and other passes), but UNSPECs are black
boxes, so in this case splitting early (during RTL expansion) is a
better strategy.
It turns out that that popcount instruction on modern x86_64 processors
has (almost) made the integer parity flag in the x86 ALU completely
obsolete, especially as POPCOUNT's integer semantics are a much better
fit to RTL. The one remaining case where these transistors are useful
is where __builtin_parity is immediately tested by a conditional branch,
and therefore the result is wanted in a flags register rather than as
an integer. This case is captured by two peephole2 optimizations in
the attached patch.
2020-06-07 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog:
* config/i386/i386.md (paritydi2, paritysi2): Expand reduction
via shift and xor to an USPEC PARITY matching a parityhi2_cmp.
(paritydi2_cmp, paritysi2_cmp): Delete these define_insn_and_split.
(parityhi2, parityqi2): New expanders.
(parityhi2_cmp): Implement set parity flag with xorb insn.
(parityqi2_cmp): Implement set parity flag with testb insn.
New peephole2s to use these insns (UNSPEC PARITY) when appropriate.
gcc/testsuite/ChangeLog:
* gcc.target/i386/parity-3.c: New test.
* gcc.target/i386/parity-4.c: Likewise.
* gcc.target/i386/parity-5.c: Likewise.
* gcc.target/i386/parity-6.c: Likewise.
* gcc.target/i386/parity-7.c: Likewise.
* gcc.target/i386/parity-8.c: Likewise.
* gcc.target/i386/parity-9.c: Likewise.
Iain Buclaw [Sun, 7 Jun 2020 17:42:58 +0000 (19:42 +0200)]
d: Merge upstream dmd
108ca1bcd.
Renames OutBuffer::peekString to OutBuffer::peekChars, and
OutBuffer::extractString to OutBuffer::extractChars. All callers have
been updated as appropriate.
Reviewed-on: https://github.com/dlang/dmd/pull/11247
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
108ca1bcd.
* d-diagnostic.cc (expand_d_format): Adjust to use extractChars().
* d-frontend.cc (Loc::toChars): Likewise.
* d-lang.cc (deps_write): Likewise.
(d_parse_file): Likewise.
* decl.cc (d_mangle_decl): Likewise.
* intrinsics.cc (maybe_set_intrinsic): Likewise.
Iain Buclaw [Sun, 7 Jun 2020 14:50:46 +0000 (16:50 +0200)]
d: Merge upstream dmd
b0df0e982
Adds a struct ParameterList to encapulate parameter and vararg
information in the front-end.
Reviewed-on: https://github.com/dlang/dmd/pull/11226
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
b0df0e982.
* d-builtins.cc (build_frontend_type): Use VarArg for varargs_p.
* d-codegen.cc (declaration_type): Call TypeFunction::create with
argument VARARGnone.
(parameter_type): Likewise.
(d_build_call): Use new field names and member functions.
* d-target.cc (Target::cppParameterType): Call TypeFunction::create
with argument VARARGnone.
* types.cc (TypeVisitor::visit (TypeFunction *): Use new field names
and member functions.
Harald Anlauf [Sun, 7 Jun 2020 14:43:12 +0000 (16:43 +0200)]
PR fortran/95091 - Buffer overflows with submodules and long symbols
Add cast to fix bootstrap error with -Werror=sign-compare.
gcc/fortran/
PR fortran/95091
* class.c (gfc_hash_value): Add cast.
Iain Buclaw [Sun, 7 Jun 2020 14:37:25 +0000 (16:37 +0200)]
d: Merge upstream dmd
1831b24ff.
Converts some global and param fields from pointers to value types.
Reviewed-on: https://github.com/dlang/dmd/pull/11245
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
1831b24ff.
* d-lang.cc (d_init_options): Remove initialization of updated fields.
(d_handle_option): Adjust for new field types.
Harald Anlauf [Sun, 7 Jun 2020 12:47:24 +0000 (14:47 +0200)]
PR fortran/95091 - Buffer overflows with submodules and long symbols
With submodules, name mangling results in long internal symbols. This
requires adjustment of the sizes of temporaries to avoid buffer overflows.
2020-06-07 Harald Anlauf <anlauf@gmx.de>
gcc/fortran/
PR fortran/95091
* class.c (get_unique_type_string, gfc_hash_value): Enlarge
buffers, and check whether the strings returned by
get_unique_type_string() fit.
Iain Buclaw [Sun, 7 Jun 2020 09:26:32 +0000 (11:26 +0200)]
d: Merge upstream dmd
cef1e7991.
Adds a DString type, a struct that has a compatible layout with D
strings. Many parameters in the Global struct have been switched over
to this type, and users of these params have been adjust to use the
length or ptr field as appropriate.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
cef1e7991.
* d-lang.cc (d_parse_file): Adjust for new field types.
guojiufu [Thu, 28 May 2020 06:10:39 +0000 (14:10 +0800)]
rs6000: allow cunroll to grow size according to -funroll-loop or -fpeel-loops
Previously, flag_unroll_loops was turned on at -O2 implicitly. This
also turned on cunroll with allowance size increasing, and cunroll
will unroll/peel the loop even the loop is complex like code in PR95018.
With this patch, size growth for cunroll is allowed only for if -funroll-loops
or -fpeel-loops or -O3 is specified explicitly.
gcc/ChangeLog
2020-06-07 Jiufu Guo <guojiufu@linux.ibm.com>
PR target/95018
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Override flag_cunroll_grow_size.
guojiufu [Thu, 28 May 2020 05:42:23 +0000 (13:42 +0800)]
Introduce flag_cunroll_grow_size for cunroll
Currently GIMPLE complete unroller(cunroll) is checking
flag_unroll_loops and flag_peel_loops to see if allow size growth.
Beside affects curnoll, flag_unroll_loops also controls RTL unroler.
To have more freedom to control cunroll and RTL unroller, this patch
introduces flag_cunroll_grow_size. With this patch, we can control
cunroll and RTL unroller indepently.
gcc/ChangeLog
2020-06-07 Jiufu Guo <guojiufu@linux.ibm.com>
* common.opt (flag_cunroll_grow_size): New flag.
* toplev.c (process_options): Set flag_cunroll_grow_size.
* tree-ssa-loop-ivcanon.c (pass_complete_unroll::execute):
Use flag_cunroll_grow_size.
Thomas Koenig [Sun, 7 Jun 2020 08:43:54 +0000 (10:43 +0200)]
Added test case for a PR which has been fixed in the meantime.
gcc/testsuite/ChangeLog:
PR tree-optimization/50439
* gfortran.dg/loop_interchange_2.f: New test.
GCC Administrator [Sun, 7 Jun 2020 00:16:19 +0000 (00:16 +0000)]
Daily bump.
Jan Hubicka [Sat, 6 Jun 2020 20:19:46 +0000 (22:19 +0200)]
Fix ICE in ODR enum streaming [PR95548]
gcc/ChangeLog:
2020-06-06 Jan Hubicka <hubicka@ucw.cz>
PR lto/95548
* ipa-devirt.c (struct odr_enum_val): Turn values to wide_int.
(ipa_odr_summary_write): Update streaming.
(ipa_odr_read_section): Update streaming.
gcc/testsuite/ChangeLog:
2020-06-06 Jan Hubicka <hubicka@ucw.cz>
* g++.dg/torture/pr95548.C: New test.
Max Filippov [Sat, 6 Jun 2020 08:26:56 +0000 (01:26 -0700)]
MAINTAINERS: Add myself as xtensa port maintainer
2020-06-06 Max Filippov <jcmvbkbc@gmail.com>
* MAINTAINERS: Add myself as xtensa port maintainer.
Alexandre Oliva [Sat, 6 Jun 2020 01:31:19 +0000 (22:31 -0300)]
[PR95456] avoid memcpy (_, NULL, 0) in gcc.c
Some newly-added code in gcc.c might call memcpy with a NULL source
pointer and zero-length inputs. Avoid such calls by rearranging the
code a little.
for gcc/ChangeLog
PR driver/95456
* gcc.c (do_spec_1): Don't call memcpy (_, NULL, 0).
GCC Administrator [Sat, 6 Jun 2020 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Iain Buclaw [Fri, 5 Jun 2020 21:09:23 +0000 (23:09 +0200)]
d: Merge upstream dmd
740f3d1ea.
Backports the conversion of the parameter fields debugids and versionids
to Identifiers. The idea is that Identifiers should be used instead of
C strings where ever possible.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
740f3d1ea.
* d-lang.cc (d_handle_option): Use new fields to save debug and
version levels passed over command-line.
(d_post_options): Add them to front-end here.
Martin Sebor [Fri, 5 Jun 2020 20:59:16 +0000 (14:59 -0600)]
Temporarily remove an unintentionally commited test.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wnonnull5.C: Temporarily remove.
Marek Polacek [Fri, 5 Jun 2020 18:22:35 +0000 (14:22 -0400)]
c++: Make braced-init-list as template arg work with aggr init [PR95369]
Barry pointed out to me that our braced-init-list as a template-argument
extension doesn't work as expected when we aggregate-initialize. Since
aggregate list-initialization is a user-defined conversion sequence, we
allow it as part of a converted constant expression.
Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/ChangeLog:
PR c++/95369
* call.c (build_converted_constant_expr_internal): Allow
list-initialization.
gcc/testsuite/ChangeLog:
PR c++/95369
* g++.dg/cpp2a/nontype-class38.C: New test.
Harald Anlauf [Fri, 5 Jun 2020 18:30:34 +0000 (20:30 +0200)]
PR fortran/95530, PR fortran/95537 - Buffer overflows with long symbols
The testcases for PR95090 and PR95106 trigger buffer overflows with long
symbols that were found with an instrumented compiler. Enlarge the
affected buffers, and add checks that the buffers will suffice.
2020-06-05 Harald Anlauf <anlauf@gmx.de>
gcc/fortran/
PR fortran/95530
PR fortran/95537
* decl.c (gfc_match_decl_type_spec): Enlarge buffer, and enhance
string copy to detect buffer overflow.
* gfortran.h (gfc_common_head): Enlarge buffer.
* trans-common.c (finish_equivalences): Enhance string copy to
detect buffer overflow.
Iain Sandoe [Fri, 5 Jun 2020 14:09:39 +0000 (15:09 +0100)]
coroutines: co_returns are statements, not expressions.
This corrects an error in the CO_RETURN_EXPR tree
class.
gcc/cp/ChangeLog:
* cp-tree.def (CO_RETURN_EXPR): Correct the class
to use tcc_statement.
Mark Wielaard [Thu, 28 May 2020 00:55:36 +0000 (02:55 +0200)]
diagnostics: Consistently add fixit hint for implicit builtin declaration
There are two warnings that might trigger when a builtin function is
used but not declared yet. Both called through implicitly_declare in
c-decl. The first in implicit_decl_warning does warn for builtins,
but does not add a fixit hint for them (only for non-builtins when
a header is suggested through lookup_name_fuzzy). This warning is
guarded by -Wimplicit-function-declaration. The second warning, which
does include a fixit hint if possible, is given when the implicit
builtin declaration has an incompatible signature. This second warning
cannot be disabled.
This setup means that you only get a fixit-hint for usage of builtin
functions where the implicit signature is different than the actual
signature of the builtin. No fixit hints with header suggestions
are ever generated for builtins like abs, isdigit or putchar.
It seems more consistent to always generate a fixit-hint if possible
for the -Wimplicit-function-declaration warning. And for the second
warning to make it depend on -Wbuiltin-declaration-mismatch like
other warnings about builtin declaration mismatches.
Include a new test to show we get fixit-hints for abs, isdigit and
putchar now. Some small tweaks to existing tests to show the
effect of -Wno-builtin-declaration-mismatch with this change. And
a testcase to show that #pragma GCC diagnostic ignored now works.
gcc/c/ChangeLog:
* c-decl.c (implicit_decl_warning): When warned and olddecl is
an undeclared builtin, then add a fixit header hint, if found.
(implicitly_declare): Add OPT_Wbuiltin_declaration_mismatch to
warning_at about implicit builtin declaration type mismatch.
gcc/testsuite/ChangeLog:
* gcc.dg/missing-header-fixit-3.c: Add
-Wno-implicit-function-declaration.
* gcc.dg/missing-header-fixit-4.c: Add new expected output.
* gcc.dg/missing-header-fixit-5.c: New testcase.
* gcc.dg/Wbuiltin-declaration-mismatch-ignore.c: Likewise.
Iain Buclaw [Fri, 5 Jun 2020 17:27:29 +0000 (19:27 +0200)]
d: Merge upstream dmd
f5638c7b8.
Adds a CHECKENABLE enum, uses it for all contract parameters for
consistency in state checking.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
f5638c7b8.
* d-builtins.cc (d_init_versions): Use new CHECKENABLE enum.
* d-codegen.cc (array_bounds_check): Likewise.
(build_frame_type): Likewise.
(get_frameinfo): Likewise.
* d-lang.cc (d_init_options): Likewise.
(d_init_options_struct): Don't initialize x_flag_bounds_check.
(d_handle_option): Use new CHECKENABLE enum.
(d_post_options): Likewise. Set flag_bounds_check here.
* expr.cc (ExprVisitor::visit(AssertExp *)): Use new CHECKENABLE enum.
Jason Merrill [Thu, 4 Jun 2020 19:56:57 +0000 (15:56 -0400)]
c++: Fix pretty-print of pointer minus integer.
For whatever reason, GCC internally represents a pointer minus an integer as
a pointer plus a very large unsigned integer. But exposing that to users is
unsightly, and it's easy enough to show the real value.
gcc/cp/ChangeLog:
* error.c (dump_binary_op): Handle negative operand to
POINTER_PLUS_EXPR.
gcc/c-family/ChangeLog:
* c-pretty-print.c (pp_c_additive_expression): Handle negative
operand to POINTER_PLUS_EXPR.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-ptrsub2.C: New test.
Tom Tromey [Fri, 5 Jun 2020 12:40:14 +0000 (06:40 -0600)]
fortran/95509 - fix spellcheck-operator.f90 regression
My earlier patch to add case handling to the spell checker caused a
Fortran regression. I believe I must have misread the test results.
This patch fixes the problem by changing the cutoff. I chose this
value because the previous patch effectively multiplied the result of
get_edit_distance by 2 (unless a case change is involved).
gcc/fortran/ChangeLog:
PR fortran/95509
* misc.c (gfc_closest_fuzzy_match): Update cutoff value
computation.
Thomas Schwinge [Wed, 20 May 2020 08:56:55 +0000 (10:56 +0200)]
[OpenACC 'exit data'] Strip 'GOMP_MAP_STRUCT' mappings
These are not itself necessary for OpenACC 'exit data' directives, and are
skipped over (now) in libgomp. We might as well not emit them to start with,
in line with the equivalent OpenMP directive. We keep the no-op handling in
libgomp for the reason of backward compatibility.
gcc/
* gimplify.c (gimplify_adjust_omp_clauses): Remove
'GOMP_MAP_STRUCT' mapping from OpenACC 'exit data' directives.
gcc/testsuite/
* c-c++-common/goacc/struct-enter-exit-data-1.c: New file.
libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>: Explain
special handling.
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Thomas Schwinge [Wed, 20 May 2020 08:53:33 +0000 (10:53 +0200)]
[OpenACC 'exit data'] Simplify 'GOMP_MAP_STRUCT' handling
libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>:
Simplify.
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Julian Brown [Thu, 4 Jun 2020 13:40:53 +0000 (06:40 -0700)]
Add 'libgomp.oacc-c-c++-common/struct-copyout-{1,2}.c'
libgomp/
* testsuite/libgomp.oacc-c-c++-common/struct-copyout-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/struct-copyout-2.c: New test.
Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
Iain Buclaw [Fri, 5 Jun 2020 15:50:49 +0000 (17:50 +0200)]
d: Merge upstream dmd
56f0a65c4.
Updates the Target interface, removing static from all members, so all
field accesses and member function calls go through a single global
'target'. Information relating to extern ABI are now in TargetC,
TargetCPP, and TargetObjC for each supported language respectively.
Reviewed-on: https://github.com/dlang/dmd/pull/11228
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
56f0a65c4.
* d-builtins.cc (build_frontend_type): Remove static.
(d_build_builtins_module): Use target.va_listType() to get front-end
type for va_list.
(d_init_builtins): Move creation of va_list to Target::va_listType.
* d-codegen.cc (build_interface_binfo): Use new target global.
(build_vindex_ref): Likewise.
(identity_compare_p): Likewise.
* d-ctfloat.cc (CTFloat::parse): Likewise.
* d-lang.cc (d_init): Likewise.
* d-port.cc (Port::isFloat32LiteralOutOfRange): Likewise.
(Port::isFloat64LiteralOutOfRange): Likewise.
* d-target.cc (define_float_constants): Initialize constants through a
reference, instead of setting globals.
(Target::_init): Initialize new fields instead of setting globals.
(Target::va_listType): Build front-end type from va_list_type_node.
(Target::toCppMangle): Renamed to ...
(TargetCPP::toMangle): ... this.
(Target::cppTypeInfoMangle): Renamed to ...
(TargetCPP::typeInfoMangle): ... this.
(Target::cppTypeMangle): Renamed to ...
(TargetCPP::typeMangle): this.
(Target::cppParameterType): Renamed to ...
(TargetCPP::parameterType): ... this. Use target.va_listType() to get
front-end type for va_list.
(Target::cppFundamentalType): Renamed to ...
(TargetCPP::fundamentalType): ... this.
* d-tree.h (build_frontend_type): Declare.
* decl.cc (base_vtable_offset): Use new target global.
* typeinfo.cc (layout_classinfo_interfaces): Likewise.
(layout_cpp_typeinfo): Likewise.
* types.cc (valist_array_p): Use target.va_listType() to get front-end
type for va_list.
(layout_aggregate_type): Use new target global.
Martin Sebor [Fri, 5 Jun 2020 15:34:39 +0000 (09:34 -0600)]
Adjust text of expected warnings to g:
b825a22890740f341eae566af27e18e528cd29a7.
gcc/testsuite/ChangeLog:
* c-c++-common/goacc/uninit-use-device-clause.c: Adjust.
* c-c++-common/pr59223.c: Same.
* g++.dg/warn/Wnonnull5.C: Same.
* gcc.dg/pr59924.c: Same.
* gcc.dg/ubsan/pr81981.c: Same.
* gcc.dg/ubsan/pr89284.c: Same.
* gfortran.dg/goacc/uninit-use-device-clause.f95: Same.
Arnaud Charlet [Sun, 9 Feb 2020 19:52:12 +0000 (14:52 -0500)]
[Ada] Replace ? by ?? in Error_Msg_N
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_prag.adb (Validate_Compile_Time_Warning_Or_Error): Use ??.
Arnaud Charlet [Sun, 9 Feb 2020 19:50:50 +0000 (14:50 -0500)]
[Ada] Update comments wrt Ada 83 handling
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* cstand.adb (Create_Standard): Update comments.
Arnaud Charlet [Mon, 3 Feb 2020 10:22:57 +0000 (05:22 -0500)]
[Ada] Support 'Reduce under -gnatX
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* scng.adb (Scan): Fix typo to take into account all future
versions of Ada.
* sem_attr.ads (Attribute_Impl_Def): Add Attribute_Reduce for
now.
* sem_attr.adb (Analyze_Attribute): Only allow 'Reduce under
-gnatX.
* snames.ads-tmpl (Name_Reduce): Update comment.
Thomas Quinot [Thu, 6 Feb 2020 18:03:24 +0000 (19:03 +0100)]
[Ada] Add note about gnatcov reliance on thunk names
2020-06-05 Thomas Quinot <quinot@adacore.com>
gcc/ada/
* exp_disp.adb (Expand_Interface_Thunk): Add comment about
gnatcov reliance on specific name used for thunks.
Ed Schonberg [Wed, 5 Feb 2020 16:38:38 +0000 (11:38 -0500)]
[Ada] Subtype inherits Atomic flag from base type
2020-06-05 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch3.adb (Analyze_Subtype_Declaration): For scalar types,
and for subtype declarations without a constraint, subtype
inherits Atomic flag from base type.
Piotr Trojanek [Thu, 6 Feb 2020 10:12:45 +0000 (11:12 +0100)]
[Ada] Fix punctuation in description of Enum_Rep attribute
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* doc/gnat_rm/implementation_defined_attributes.rst (Enum_Rep):
Remove extra colon.
* gnat_rm.texi: Regenerate.
Eric Botcazou [Wed, 5 Feb 2020 17:02:03 +0000 (18:02 +0100)]
[Ada] Make the Has_Dynamic_Range_Check flag obsolete
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* atree.adb (New_Copy): Clear Has_Dynamic_Range_Check on
subexpression nodes.
* checks.adb (Append_Range_Checks): Assert that the node
doesn't have the Has_Dynamic_Range_Check flag set.
(Insert_Range_Checks): Likewise.
* exp_ch3.adb (Expand_N_Subtype_Indication): Do not apply
range checks for a full type or object declaration.
* sem_ch3.ads: Move with and use clauses for Nlists to...
(Process_Range_Expr_In_Decl): Change default to No_List for
the Check_List parameter.
* sem_ch3.adb: ...here.
(Process_Range_Expr_In_Decl): Likewise. When the insertion
node is a declaration, only insert on the list if is present
when the declaration involves discriminants, and only insert
on the node when there is no list otherwise.
Piotr Trojanek [Wed, 5 Feb 2020 16:22:17 +0000 (17:22 +0100)]
[Ada] Do not create an empty list of nodes that confuses GNATprove
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_aggr.adb (Resolve_Record_Aggregate): Create the
N_Aggregate node with its Expressions field set to No_List and
not to an empty list.
Dmitriy Anisimkov [Thu, 23 Jan 2020 09:05:58 +0000 (15:05 +0600)]
[Ada] Optimize Normalize_Pathname
2020-06-05 Dmitriy Anisimkov <anisimko@adacore.com>
gcc/ada/
* libgnat/s-os_lib.adb (Is_Dirsep): Moved from Build_Path to
package level to reuse.
(Normalize_Pathname.Final_Value): Reduce 2 'if' statements to
one.
(Normalize_Pathname.Fill_Directory): New procedure instead of
function Get_Directory. Remove slash to backslash conversion and
drive letter uppercasing on Windows.
Arnaud Charlet [Sun, 2 Feb 2020 18:42:50 +0000 (19:42 +0100)]
[Ada] Spurious assert failure in Walk_Library_Items
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem.adb (Assert_Done): Relax check for main unit, as it was
overzealous in the case of the main unit itself.
Piotr Trojanek [Thu, 16 Jan 2020 17:56:38 +0000 (18:56 +0100)]
[Ada] Use Is_Incomplete_Type instead of a low-level Ekind test
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_ch3.adb, sem_ch8.adb, sem_util.adb: Use Is_Incomplete_Type
to make the code easier to read.
Piotr Trojanek [Thu, 16 Jan 2020 17:50:05 +0000 (18:50 +0100)]
[Ada] Simplify iteration over components
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* einfo.adb: Minor reformatting.
* sem_util.adb (Has_Full_Default_Initialization,
Is_Partially_Initialized_Type, Caller_Known_Size_Record,
Large_Max_Size_Mutable): Iterate with
First_Component/Next_Component; rename Ent to Comp.
Eric Botcazou [Tue, 4 Feb 2020 23:13:00 +0000 (00:13 +0100)]
[Ada] Fix incorrect initialization for array of non-standard enumeration type
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Use
Expr_Rep_Value instead of Expr_Value to obtain the equivalent
integer value.
* sem_eval.ads (Expr_Value): Document more supported cases.
* sem_eval.adb (Expr_Rep_Value): Copy missing cases from
Exp_Value.
Bob Duff [Tue, 4 Feb 2020 16:08:32 +0000 (11:08 -0500)]
[Ada] Put_Image attribute: Rtsfind cleanups
2020-06-05 Bob Duff <duff@adacore.com>
gcc/ada/
* rtsfind.adb, rtsfind.ads: Move subtypes of RTU_Id into package
body, because they are not needed by clients. Change "Child_" to
"Descendant", because grandchildren and great grandchildren are
involved. Replace all the repetitive comments with a single
concise one. Change the parent subtypes to be more consistent;
use the most specific parent.
Piotr Trojanek [Mon, 3 Feb 2020 16:44:41 +0000 (17:44 +0100)]
[Ada] Move routine for detecting special Text_IO packages from GNATprove
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* rtsfind.ads, rtsfind.adb (Is_Text_IO_Special_Package): Moved
from the GNATprove backend to the frontend.
Yannick Moy [Mon, 3 Feb 2020 15:30:34 +0000 (16:30 +0100)]
[Ada] Add comment about function only used in CodePeer
2020-06-05 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_util.ads: Add comment about function only used in
CodePeer.
Ed Schonberg [Fri, 31 Jan 2020 17:28:21 +0000 (12:28 -0500)]
[Ada] Spurious error on address clause in task body
2020-06-05 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch9.adb, (Analyze_Task_Body): After analying the task
body, indicate that all local variables have no delayed aspects.
This prevents improper later calls to
Check_Aspect_At_End_Of_Declarations, that would happen when the
constructed task_procedure body (generated during expansion) is
analyzed. The legality of aspect specifications that may appear
on local declarations has already been established, and it is in
general not possible to recheck them properly during expansion,
when visibility may not be fully established.
Piotr Trojanek [Fri, 31 Jan 2020 20:13:31 +0000 (21:13 +0100)]
[Ada] Add missing Global contract to Ada.Containers.Functional_Vectors
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* libgnat/a-cofuve.ads (First): Add Global contract.
Arnaud Charlet [Fri, 31 Jan 2020 20:53:42 +0000 (15:53 -0500)]
[Ada] AI12-0207 Convention of anonymous access types
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_prag.adb (Set_Convention_From_Pragma): Set the convention
of anonymous access array components.
Arnaud Charlet [Fri, 31 Jan 2020 14:18:37 +0000 (09:18 -0500)]
[Ada] AI12-0336 Meaning of Time_Offset
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* libgnat/a-calfor.ads, libgnat/a-catizo.ads,
libgnat/a-catizo.adb (Local_Time_Offset, Local_Image): New.
(UTC_Time_Offset): Now a renaming of Local_Time_Offset.
Eric Botcazou [Fri, 31 Jan 2020 10:56:30 +0000 (11:56 +0100)]
[Ada] Fix assertion failure on double rederivation of private type
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch3.adb (Available_Full_View): New function returning
either the full or the underlying full view.
(Build_Full_Derivation): Add guard for the full view.
(Copy_And_Build): Retrieve the underlying full view, if any,
also if deriving a completion.
(Build_Derived_Private_Type): Use Available_Full_View throughout
to decide whether a full derivation must be done.
Bob Duff [Fri, 31 Jan 2020 13:28:45 +0000 (08:28 -0500)]
[Ada] Put_Image attribute
2020-06-05 Bob Duff <duff@adacore.com>
gcc/ada/
* exp_attr.adb, exp_ch11.adb, exp_imgv.adb, exp_tss.ads,
par-ch4.adb, sem_attr.adb, sem_util.ads: Misc cleanup.
Arnaud Charlet [Fri, 31 Jan 2020 10:47:01 +0000 (05:47 -0500)]
[Ada] AI12-0144 Make Discrete_Random more flexible
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* libgnat/a-nudira.ads, libgnat/a-nudira.adb (Random): New
function.
Arnaud Charlet [Fri, 31 Jan 2020 12:52:25 +0000 (07:52 -0500)]
[Ada] AI12-0237 Getting the representation of an enumeration value
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_attr.ads (Attribute_Impl_Def): Remove Enum_Rep/Val.
* sem_attr.adb (Attribute_20): New, move Enum_Rep/Val here.
(Analyze_Attribute): Take Attribute_20 into account.
Arnaud Charlet [Fri, 31 Jan 2020 11:22:26 +0000 (06:22 -0500)]
[Ada] AI12-0318 No_IO should apply to Ada.Directories
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* restrict.ads (Unit_Array): Add a-direct.
Arnaud Charlet [Fri, 31 Jan 2020 11:05:01 +0000 (06:05 -0500)]
[Ada] AI12-0235 System.Storage_Pools should be pure
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* libgnat/s-stopoo.ads: Mark package Pure and leave room for
Nonblocking once this aspect is supported.
Eric Botcazou [Thu, 30 Jan 2020 20:48:27 +0000 (21:48 +0100)]
[Ada] Add No_Truncation flag on view conversion for GNAT-LLVM
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_attr.adb (Expand_N_Attribute_Reference) <Valid_Scalars>:
Set the No_Truncation flag on the unchecked conversion built for
scalar types.
Bob Duff [Thu, 30 Jan 2020 19:45:19 +0000 (14:45 -0500)]
[Ada] Assertion_Policy (Ignore) ignores invariants
2020-06-05 Bob Duff <duff@adacore.com>
gcc/ada/
* einfo.adb, einfo.ads, exp_util.adb: Remove Invariants_Ignored
flag.
* sem_prag.adb (Invariant): Instead of setting a flag to be
checked elsewhere, remove the pragma as soon as it is analyzed
and checked for legality.
Eric Botcazou [Thu, 30 Jan 2020 12:23:31 +0000 (13:23 +0100)]
[Ada] Rename parameter of routines in Checks
2020-06-05 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* checks.ads (Apply_Length_Check): Rename Ck_Node parameter to
Expr.
(Apply_Range_Check): Likewise.
(Get_Range_Checks): Likewise.
* checks.adb (Apply_Float_Conversion_Check): Likewise.
(Apply_Selected_Length_Checks): Likewise.
(Apply_Selected_Range_Checks): Likewise.
(Guard_Access): Likewise.
(Selected_Length_Checks): Likewise. Also avoid shadowing in
child procedures.
(Selected_Range_Checks): Likewise.
Arnaud Charlet [Thu, 30 Jan 2020 08:09:19 +0000 (03:09 -0500)]
[Ada] Minor wording changes wrt Ada 202x
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* par-ch3.adb, par-ch4.adb, scng.adb, sem_aggr.adb,
sem_ch10.adb, sem_ch12.adb, sem_prag.adb: Update wording: change
Ada_2020 to Ada 2020 in comments and mention -gnat2020 instead
of -gnatX switch.
Iain Buclaw [Fri, 5 Jun 2020 09:37:47 +0000 (11:37 +0200)]
d: Merge upstream dmd
6d5bffa54
Removes an unused parameter from Condition::include(), all callers have
been updated in the front-end.
Reviewed-on: https://github.com/dlang/dmd/pull/11229
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
6d5bffa54.
* d-builtins.cc (maybe_set_builtin_1): Update call to
Condition::include().
* decl.cc (DeclVisitor::visit(AttribDeclaration *)): Likewise.
* types.cc (layout_aggregate_members): Likewise.
Richard Biener [Fri, 5 Jun 2020 08:13:27 +0000 (10:13 +0200)]
tree-optimization/95539 - fix SLP_TREE_REPRESENTATIVE vs. dr_info
This fixes a disconnect between the stmt_info used for dr_info
analysis and the one in SLP_TREE_REPRESENTATIVE with a temporary
workaround.
2020-06-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/95539
* tree-vect-data-refs.c
(vect_slp_analyze_and_verify_instance_alignment): Use
SLP_TREE_REPRESENTATIVE for the data-ref check.
* tree-vect-stmts.c (vectorizable_load): Reset stmt_info
back to the first scalar stmt rather than the
SLP_TREE_REPRESENTATIVE to match previous behavior.
* gcc.dg/vect/pr95539.c: New testcase.
Fei Yang [Fri, 5 Jun 2020 09:34:59 +0000 (10:34 +0100)]
expand: Simplify removing subregs when expanding a copy [PR95254]
In rtl expand, if we have a copy that matches one of the following patterns:
(set (subreg:M1 (reg:M2 ...)) (subreg:M1 (reg:M2 ...)))
(set (subreg:M1 (reg:M2 ...)) (mem:M1 ADDR))
(set (mem:M1 ADDR) (subreg:M1 (reg:M2 ...)))
(set (subreg:M1 (reg:M2 ...)) (constant C))
where mode M1 is equal in size to M2, try to detect whether the mode change
involves an implicit round trip through memory. If so, see if we can avoid
that by removing the subregs and doing the move in mode M2 instead.
2020-06-05 Felix Yang <felix.yang@huawei.com>
gcc/
PR target/95254
* expr.c (emit_move_insn): Check src and dest of the copy to see
if one or both of them are subregs, try to remove the subregs when
innermode and outermode are equal in size and the mode change involves
an implicit round trip through memory.
gcc/testsuite/
PR target/95254
* gcc.target/aarch64/pr95254.c: New test.
* gcc.target/i386/pr67609.c: Check "movq\t%xmm0" instead of "movdqa".
Jakub Jelinek [Fri, 5 Jun 2020 08:44:23 +0000 (10:44 +0200)]
ix86: Improve __builtin_c[lt]z followed by extension [PR95535]
In January I've added patterns to optimize SImode -> DImode sign or zero
extension of __builtin_popcount, this patch does the same for
__builtin_c[lt]z. Like most other instructions, the [tl]zcntl instructions
clear the upper 32 bits of the destination register and as the instructions
only result in values 0 to 32 inclusive, both sign and zero extensions
behave the same.
2020-06-05 Jakub Jelinek <jakub@redhat.com>
PR target/95535
* config/i386/i386.md (*ctzsi2_zext, *clzsi2_lzcnt_zext): New
define_insn_and_split patterns.
(*ctzsi2_zext_falsedep, *clzsi2_lzcnt_zext_falsedep): New
define_insn patterns.
* gcc.target/i386/pr95535-1.c: New test.
* gcc.target/i386/pr95535-2.c: New test.
Jonathan Wakely [Fri, 22 May 2020 06:22:50 +0000 (07:22 +0100)]
Add new/delete to struct occurence
This adds an example how to use new/delete operators to pool
allocated objects.
2020-06-04 Jonathan Wakely <jwakely@redhat.com>
* alloc-pool.h (object_allocator::remove_raw): New.
* tree-ssa-math-opts.c (struct occurrence): Use NSMDI.
(occurrence::occurrence): Add.
(occurrence::~occurrence): Likewise.
(occurrence::new): Likewise.
(occurrence::delete): Likewise.
(occ_new): Remove.
(insert_bb): Use new occurence (...) instead of occ_new.
(register_division_in): Likewise.
(free_bb): Use delete occ instead of manually removing
from the pool.
Richard Biener [Thu, 4 Jun 2020 11:44:58 +0000 (13:44 +0200)]
middle-end/95493 - bogus MEM_ATTRS for variable array access
The following patch avoids keeping the inherited MEM_ATTRS when
set_mem_attributes_minus_bitpos is called with a variable ARRAY_REF.
The inherited ones may not reflect the correct offset and neither
does the updated alias-set match the inherited MEM_EXPR. This all
ends up confusing path-based alias-analysis, causing wrong-code.
The fix is to stop not adopting a MEM_EXPR for certain kinds of
expressions and instead handle everything we can. There's still
the constant kind trees case which I'm too lazy to look into right
now. I did refrain from adding SSA_NAME there and instead avoided
calling set_mem_attributes_minus_bitpos when debug expression
expansion ended up expanding a SSA definition RHS which should
already have taken care of setting the appropriate MEM_ATTRS.
2020-06-04 Richard Biener <rguenther@suse.de>
PR middle-end/95493
* cfgexpand.c (expand_debug_expr): Avoid calling
set_mem_attributes_minus_bitpos when we were expanding
an SSA name.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Remove
ARRAY_REF special-casing, add CONSTRUCTOR to the set of
special-cases we do not want MEM_EXPRs for. Assert
we end up with reasonable MEM_EXPRs.
* g++.dg/torture/pr95493.C: New testcase.
Cui,Lili [Thu, 4 Jun 2020 07:01:43 +0000 (15:01 +0800)]
Fix bitmask conflict between PTA_AVX512VP2INTERSECT and PTA_WAITPKG in gcc/config/i386/i386.h
2020-06-05 Lili Cui <lili.cui@intel.com>
gcc/ChangeLog:
PR target/95525
* config/i386/i386.h (PTA_WAITPKG): Change bitmask value.
GCC Administrator [Fri, 5 Jun 2020 00:16:30 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Thu, 4 Jun 2020 22:20:49 +0000 (23:20 +0100)]
libstdc++: Remove workarounds for constrained nested class templates
With PR c++/92078 and PR c++/92103 both fixed, nested class templates
can now be constrained. That means a number of namespace-scope helpers
can be moved to the class scope, so they're only visible where they're
needed.
* include/bits/iterator_concepts.h (__detail::__ptr, __detail::__ref)
(__detail::__cat, __detail::__diff): Move to class scope in the
relevant __iterator_traits specializations.
(__iterator_traits<>): Use nested class templates instead of ones from
namespace __detail.
* include/bits/stl_iterator.h (__detail::__common_iter_ptr): Move to
class scope in iterator_traits<common_iterator<I, S>>.
(iterator_traits<common_iterator<I, S>>): Use nested class template
instead of __detail::__common_iter_ptr.
Martin Sebor [Thu, 4 Jun 2020 22:06:10 +0000 (16:06 -0600)]
Implement a solution for PR middle-end/10138 and PR middle-end/95136.
PR middle-end/10138 - warn for uninitialized arrays passed as const arguments
PR middle-end/95136 - missing -Wuninitialized on an array access with a variable offset
gcc/c-family/ChangeLog:
PR middle-end/10138
PR middle-end/95136
* c-attribs.c (append_access_attrs): Handle attr_access::none.
(handle_access_attribute): Same.
gcc/ChangeLog:
PR middle-end/10138
PR middle-end/95136
* attribs.c (init_attr_rdwr_indices): Move function here.
* attribs.h (rdwr_access_hash, rdwr_map): Define.
(attr_access): Add 'none'.
(init_attr_rdwr_indices): Declared function.
* builtins.c (warn_for_access)): New function.
(check_access): Call it.
* builtins.h (checK-access): Add an optional argument.
* calls.c (rdwr_access_hash, rdwr_map): Move to attribs.h.
(init_attr_rdwr_indices): Declare extern.
(append_attrname): Handle attr_access::none.
(maybe_warn_rdwr_sizes): Same.
(initialize_argument_information): Update comments.
* doc/extend.texi (attribute access): Document 'none'.
* tree-ssa-uninit.c (struct wlimits): New.
(maybe_warn_operand): New function.
(maybe_warn_pass_by_reference): Same.
(warn_uninitialized_vars): Refactor code into maybe_warn_operand.
Also call for function calls.
(pass_late_warn_uninitialized::execute): Adjust comments.
(execute_early_warn_uninitialized): Same.
gcc/testsuite/ChangeLog:
PR middle-end/10138
PR middle-end/95136
* c-c++-common/Wsizeof-pointer-memaccess1.c: Prune out valid
Wuninitialized.
* c-c++-common/uninit-pr51010.c: Adjust expected warning format.
* c-c++-common/goacc/uninit-dim-clause.c: Same.
* c-c++-common/goacc/uninit-firstprivate-clause.c: Same.
* c-c++-common/goacc/uninit-if-clause.c: Same.
* c-c++-common/gomp/pr70550-1.c: Same.
* c-c++-common/gomp/pr70550-2.c: Adjust.
* g++.dg/
20090107-1.C: Same.
* g++.dg/
20090121-1.C: Same.
* g++.dg/ext/attr-access.C: Avoid -Wuninitialized.
* gcc.dg/tree-ssa/forwprop-6.c: Prune out -Wuninitialized.
* gcc.dg/Warray-bounds-52.c: Prune out valid -Wuninitialized.
* gcc.dg/Warray-bounds-53.c: Same.
* gcc.dg/Warray-bounds-54.c: Same.
* gcc.dg/Wstringop-overflow-33.c: New test.
* gcc.dg/attr-access-none.c: New test.
* gcc.dg/attr-access-read-only.c: Adjust.
* gcc.dg/attr-access-read-write.c: Same.
* gcc.dg/attr-access-write-only.c: Same.
* gcc.dg/pr71581.c: Adjust text of expected warning.
* gcc.dg/uninit-15.c: Same.
* gcc.dg/uninit-32.c: New test.
* gcc.dg/uninit-33.c: New test.
* gcc.dg/uninit-34.c: New test.
* gcc.dg/uninit-36.c: New test.
* gcc.dg/uninit-B-O0.c: Adjust text of expected warning.
* gcc.dg/uninit-I-O0.c: Same.
* gcc.dg/uninit-pr19430-O0.c: Same.
* gcc.dg/uninit-pr19430.c: Same.
* gcc.dg/uninit-pr95136.c: New test.
* gfortran.dg/assignment_4.f90: Expect -Wuninitialized.
* gfortran.dg/goacc/uninit-dim-clause.f95: Adjust text of expected
warning.
* gfortran.dg/goacc/uninit-firstprivate-clause.f95
* gfortran.dg/goacc/uninit-if-clause.f95
* gfortran.dg/pr66545_2.f90
Iain Buclaw [Thu, 4 Jun 2020 20:36:26 +0000 (22:36 +0200)]
d: Merge upstream dmd
48d704f08
Updates the Array interface in dmd/root/array.h to use a DArray<TYPE>
internally. Splits out BitArray into a separate header.
Reviewed-on: https://github.com/dlang/dmd/pull/11219
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
48d704f08.
* d-attribs.cc (build_attributes): Use new field name.
* d-builtins.cc (build_frontend_type): Likewise.
(maybe_set_builtin_1): Likewise.
(d_maybe_set_builtin): Likewise.
* d-codegen.cc (build_interface_binfo): Likewise.
(identity_compare_p): Likewise.
(lower_struct_comparison): Likewise.
(build_struct_comparison): Likewise.
(d_build_call): Likewise.
(build_frame_type): Likewise.
(build_closure): Likewise.
* d-compiler.cc (Compiler::paintAsType): Likewise.
(Compiler::loadModule): Likewise.
* d-incpath.cc (add_globalpaths): Likewise.
(add_filepaths): Likewise.
(add_import_paths): Likewise.
* d-lang.cc (deps_write): Likewise.
(d_parse_file): Likewise.
* decl.cc (gcc_attribute_p): Likewise.
(base_vtable_offset): Likewise.
(get_vtable_decl): Likewise.
(build_class_instance): Likewise.
* expr.cc (class ExprVisitor): Likewise.
* modules.cc (layout_moduleinfo_fields): Likewise.
(layout_moduleinfo): Likewise.
(build_module_tree): Likewise.
* toir.cc (class IRVisitor): Likewise.
* typeinfo.cc (class TypeInfoVisitor): Likewise.
(layout_classinfo_interfaces): Likewise.
* types.cc (layout_aggregate_members): Likewise.
(layout_aggregate_type): Likewise.
François Dumont [Wed, 22 Jan 2020 17:21:28 +0000 (18:21 +0100)]
libstdc++: Specialize copy/copy_n for istreambuf_iterator and deque iterators
Add __copy_n_a overloads for std::deque iterators to replace with C memmove
when possible. Expose std::copy_n implementation details in pre-C++11 modes
and use it for std::copy overloads.
libstdc++-v3/ChangeLog
* include/bits/stl_algo.h (__copy_n_a): Move to ...
* include/bits/stl_algobase.h (__copy_n_a): ...here. Add __strict
parameter.
(__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
Declare.
(__niter_base(const _Safe_iterator<_Ite, _Seq,
random_access_iterator_tag>&)): Declare.
(__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
_Deque_iterator<>)): Declare.
* include/bits/deque.tcc
(__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
_Deque_iterator<>)): New.
(__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
New.
* include/bits/streambuf_iterator.h
(__copy_n_a(istreambuf_iterator<>, _Size, _CharT*, bool)): Adapt.
* include/debug/safe_iterator.tcc (__niter_base): New.
* testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
(test03): New.
* testsuite/25_algorithms/copy/streambuf_iterators/char/debug/deque_neg.cc:
New test.
* testsuite/25_algorithms/copy_n/debug/istreambuf_ite_deque_neg.cc:
New test.
* testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc: New test.
* testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc:
New test.
Iain Buclaw [Thu, 4 Jun 2020 20:05:49 +0000 (22:05 +0200)]
d: Merge upstream dmd
47ed0330f
Updates the copyright years of the front-end sources.
Reviewed-on: https://github.com/dlang/dmd/pull/11221
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
47ed0330f.
Jason Merrill [Thu, 4 Jun 2020 03:50:50 +0000 (23:50 -0400)]
c++: Fix complex constexpr virtual cases [PR93310].
The code in constexpr for looking up the actual type of the object and then
getting the virtual function from there broke for both of these tests: for
16, it assumed incorrectly that the DECL_VINDEX would apply to the most
derived type's vtable; for 17, it failed to consider that during
construction the base subobject is treated as being of the base type.
Fixed by just doing constant evaluation of the expression that looks up the
function in the vtable. This means that a virtual call will involve loading
the vptr, so we will reject some calls through non-constexpr variables that
we previously accepted, but this seems appropriate to me. None of our
testcases were affected.
gcc/cp/ChangeLog:
PR c++/93310
* constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
Evaluate OBJ_TYPE_REF_EXPR.
gcc/testsuite/ChangeLog:
PR c++/93310
* g++.dg/cpp2a/constexpr-virtual16.C: New test.
* g++.dg/cpp2a/constexpr-virtual17.C: New test.
* g++.dg/cpp2a/constexpr-new12.C: Adjust diagnostic.
Jason Merrill [Thu, 4 Jun 2020 03:50:06 +0000 (23:50 -0400)]
c++: Fix FE devirt with diamond inheritance [PR95158]
This started breaking in GCC 8 because of the fix for PR15272; after that
change, we (correctly) remember the lookup from template parsing time that
found Base::foo through the non-dependent MiddleB base, and so we overlook
the overrider in MiddleA. But given that, the devirtualization condition
from the fix for PR59031 is insufficient; we know that d has to be a
Derived, and we found Base::foo in Base, but forcing a non-virtual call
gets the wrong function.
Fixed by removing the PR59031 code that the PR67184 patch moved to
build_over_call, and instead looking up the overrider in BINFO_VIRTUALS.
gcc/cp/ChangeLog:
PR c++/95158
* class.c (lookup_vfn_in_binfo): New.
* call.c (build_over_call): Use it.
* cp-tree.h (resolves_to_fixed_type_p): Add default argument.
(lookup_vfn_in_binfo): Declare.
gcc/testsuite/ChangeLog:
PR c++/95158
* g++.dg/template/virtual5.C: New test.
Harald Anlauf [Thu, 4 Jun 2020 19:00:33 +0000 (21:00 +0200)]
PR fortran/95500 - Segfault compiling extra interface on intrinsic
Converting an expression so that it can be passed by reference could
result in a NULL pointer dereference.
2020-06-04 Steven G. Kargl <kargl@gcc.gnu.org>
Harald Anlauf <anlauf@gmx.de>
gcc/fortran/
PR fortran/95500
* trans-expr.c (gfc_conv_expr_reference): Do not dereference NULL
pointer.
gcc/testsuite/
PR fortran/95500
* gfortran.dg/pr95500.f90: New test.
Iain Sandoe [Thu, 4 Jun 2020 16:14:37 +0000 (17:14 +0100)]
coroutines: Fix missed ramp function return copy elision [PR95346].
Confusingly, "get_return_object ()" can do two things:
- Firstly it can provide the return object for the ramp function (as
the name suggests).
- Secondly if the type of the ramp function is different from that
of the get_return_object call, this is used as a single parameter
to a CTOR for the ramp's return type.
In the first case we can rely on finish_return_stmt () to do the
necessary processing for copy elision.
In the second case, we should have passed a prvalue to the CTOR as
per the standard comment, but I had omitted the rvalue () call. Fixed
thus.
gcc/cp/ChangeLog:
PR c++/95346
* coroutines.cc (morph_fn_to_coro): Ensure that the get-
return-object is constructed correctly; When it is not the
final return value, pass it to the CTOR of the return type
as an rvalue, per the standard comment.
gcc/testsuite/ChangeLog:
PR c++/95346
* g++.dg/coroutines/pr95346.C: New test.
Vladimir N. Makarov [Thu, 4 Jun 2020 17:32:24 +0000 (13:32 -0400)]
Add test for PR95464.c.
2020-06-04 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/95464
* gcc.target/i386/pr95464.c: New.
Thomas Schwinge [Thu, 4 Jun 2020 14:13:35 +0000 (16:13 +0200)]
[OpenACC 'exit data'] Evaluate 'copyfrom' individually for 'GOMP_MAP_STRUCT' entries
Currently, we don't at all evaluate 'copyfrom' for 'GOMP_MAP_STRUCT' entries.
Fix this by copying/adapting the corresponding non-'GOMP_MAP_STRUCT' code.
libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>:
Evaluate 'copyfrom' individually for each entry.
* testsuite/libgomp.oacc-c-c++-common/struct-1.c: Update.
Thomas Schwinge [Thu, 4 Jun 2020 14:01:07 +0000 (16:01 +0200)]
[OpenACC 'exit data'] Evaluate 'finalize' individually for 'GOMP_MAP_STRUCT' entries
Currently, we don't at all evaluate 'finalize' for 'GOMP_MAP_STRUCT' entries.
Fix this by copying/adapting the corresponding non-'GOMP_MAP_STRUCT' code.
libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>:
Evaluate 'finalize' individually for each entry.
* testsuite/libgomp.oacc-c-c++-common/struct-1.c: New file.
* testsuite/libgomp.oacc-c-c++-common/struct-refcount-1.c: Remove
file.