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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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>
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>
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.