aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-04-06Update gcc sv.po.Joseph Myers1-310/+212
* sv.po: Update.
2021-04-06c++: access checking in aggregate initialization [PR96673]Jason Merrill2-0/+35
We were deferring access checks while parsing B<int>{}, didn't adjust that when we went to instantiate the default member initializer for B::c, deferred access checking for C::C, and then checked it after parsing B<int>{}, back in the main() context which has no access. We need to do the access checks in the class context of the DMI. I tried fixing this in push_to/pop_from_top_level, but that caused several regressions. gcc/cp/ChangeLog: PR c++/96673 * init.c (get_nsdmi): Don't defer access checking. gcc/testsuite/ChangeLog: PR c++/96673 * g++.dg/cpp1y/nsdmi-aggr13.C: New test.
2021-04-06c++: C++17 constexpr static data member linkage [PR99901]Jason Merrill2-4/+54
C++17 makes constexpr static data members implicitly inline variables. In C++14, a subsequent out-of-class declaration is the definition. We want to continue emitting a symbol for such a declaration in C++17 mode, for ABI compatibility with C++14 code that wants to refer to it. Normally I'd distinguish in- and out-of-class declarations by looking at DECL_IN_AGGR_P, but we never set DECL_IN_AGGR_P on inline variables. I think that's wrong, but don't want to mess with it so close to release. Conveniently, we already have a test for in-class declaration earlier in the function. gcc/cp/ChangeLog: PR c++/99901 * decl.c (cp_finish_decl): mark_needed an implicitly inline static data member with an out-of-class redeclaration. gcc/testsuite/ChangeLog: PR c++/99901 * g++.dg/cpp1z/inline-var9.C: New test.
2021-04-06d: Fix missing call to va_end in getMatchError [PR99917]Iain Buclaw2-1/+2
Reviewed-on: https://github.com/dlang/dmd/pull/12380 gcc/d/ChangeLog: PR d/99917 * dmd/MERGE: Merge upstream dmd d16195406.
2021-04-06d: Use Array::find to get index of elementIain Buclaw1-18/+10
gcc/d/ChangeLog: * d-codegen.cc (build_frame_type): Use Array::find to get index of element.
2021-04-06d: Increment gaggedWarnings if warning or deprecation message was suppressedIain Buclaw1-0/+4
gcc/d/ChangeLog: * d-diagnostic.cc (vwarning): Increment gaggedWarnings if warning message was suppressed. (vdeprecation): Likewise for deprecation messages.
2021-04-06d: Merge upstream dmd 5cc71ff83, druntime 1134b710Iain Buclaw11-88/+290
D front-end changes: - Fix ICEs that occurred when using opaque enums. - Update `pragma(printf)' checking code to work on 16-bit targets. Phobos change: - Don't compile in argTypes code on AArch64 Reviewed-on: https://github.com/dlang/dmd/pull/12378 https://github.com/dlang/druntime/pull/3431 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 5cc71ff83. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 1134b710.
2021-04-06[PR99781] Update correctly reg notes in LRA for multi-registers and set up ↵Vladimir N. Makarov3-24/+62
biggest mode safely The PR is about incorrect use of partial_subreg_p for unordered modes. I found 2 places of dangerous comparing unordered modes in LRA. The patch removes dangerous use of paradoxical_subreg_p and partial_subreg_p in split_reg and process_bb_lives. The both places used them to solve PR77761 long time ago. But the problem was also fixed by later patches too (if there is no hard reg explicitly, it have VOIDmode and we use natural mode to split hard reg live, otherwise we use the biggest explicitly used mode for hard reg splitting). The PR also says about inaccurate update of reg notes in LRA. It happens for reg notes which refer for multi-registers. The patch also fixes this issue. gcc/ChangeLog: PR target/99781 * lra-constraints.c (split_reg): Don't check paradoxical_subreg_p. * lra-lives.c (clear_sparseset_regnos, regnos_in_sparseset_p): New functions. (process_bb_lives): Don't update biggest mode of hard reg for implicit in multi-register group. Use the new functions for updating dead_set and unused_set by register notes. gcc/testsuite/ChangeLog: PR target/99781 * g++.target/aarch64/sve/pr99781.C: New.
2021-04-06C-SKY: Describe ck802 bypass accurately.Xianmiao Qu1-2/+6
Fix the following warning: insn-automata.c: In function ‘int maximal_insn_latency(rtx_insn*)’: insn-automata.c:679:37: warning: array subscript -1 is below array bounds of ‘const unsigned char [19]’ [-Warray-bounds] 679 | return default_latencies[insn_code]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ insn-automata.c:397:30: note: while referencing ‘default_latencies’ 397 | static const unsigned char default_latencies[] = | gcc/ * config/csky/csky_pipeline_ck802.md : Use insn reservation name instead of *.
2021-04-06x86: Update memcpy/memset inline strategies for Skylake family CPUsH.J. Lu8-12/+93
Simply memcpy and memset inline strategies to avoid branches for Skylake family CPUs: 1. With MOVE_RATIO and CLEAR_RATIO == 17, GCC will use integer/vector load and store for up to 16 * 16 (256) bytes when the data size is fixed and known. 2. Inline only if data size is known to be <= 256. a. Use "rep movsb/stosb" with simple code sequence if the data size is a constant. b. Use loop if data size is not a constant. 3. Use memcpy/memset libray function if data size is unknown or > 256. On Cascadelake processor with -march=native -Ofast -flto, 1. Performance impacts of SPEC CPU 2017 rate are: 500.perlbench_r 0.17% 502.gcc_r -0.36% 505.mcf_r 0.00% 520.omnetpp_r 0.08% 523.xalancbmk_r -0.62% 525.x264_r 1.04% 531.deepsjeng_r 0.11% 541.leela_r -1.09% 548.exchange2_r -0.25% 557.xz_r 0.17% Geomean -0.08% 503.bwaves_r 0.00% 507.cactuBSSN_r 0.69% 508.namd_r -0.07% 510.parest_r 1.12% 511.povray_r 1.82% 519.lbm_r 0.00% 521.wrf_r -1.32% 526.blender_r -0.47% 527.cam4_r 0.23% 538.imagick_r -1.72% 544.nab_r -0.56% 549.fotonik3d_r 0.12% 554.roms_r 0.43% Geomean 0.02% 2. Significant impacts on eembc benchmarks are: eembc/idctrn01 9.23% eembc/nnet_test 29.26% gcc/ * config/i386/x86-tune-costs.h (skylake_memcpy): Updated. (skylake_memset): Likewise. (skylake_cost): Change CLEAR_RATIO to 17. * config/i386/x86-tune.def (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB): Replace m_CANNONLAKE, m_ICELAKE_CLIENT, m_ICELAKE_SERVER, m_TIGERLAKE and m_SAPPHIRERAPIDS with m_SKYLAKE and m_CORE_AVX512. gcc/testsuite/ * gcc.target/i386/memcpy-strategy-9.c: New test. * gcc.target/i386/memcpy-strategy-10.c: Likewise. * gcc.target/i386/memcpy-strategy-11.c: Likewise. * gcc.target/i386/memset-strategy-7.c: Likewise. * gcc.target/i386/memset-strategy-8.c: Likewise. * gcc.target/i386/memset-strategy-9.c: Likewise.
2021-04-06tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defsRichard Biener2-0/+23
This adds a relevancy check before trying to set the vector def of a backedge in an unvectorized PHI. 2021-04-06 Richard Biener <rguenther@suse.de> PR tree-optimization/99880 * tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only set vectorized defs of relevant PHIs. * gcc.dg/torture/pr99880.c: New testcase.
2021-04-06c++: Simplify va_arg testNathan Sidwell2-28/+2
The va_arg scans are just too brittle. Let's not be that picky. We have other tested builtins that are less brittle now anyway. gcc/testsuite/ * g++.dg/modules/builtin-3_a.C: Remove dump scans. * g++.dg/modules/builtin-3_b.C: Remove dump scans.
2021-04-06testsuite: Fix up pr96573.c on aarch64 [PR96573]Jakub Jelinek1-1/+1
On Thu, Apr 01, 2021 at 02:16:55PM +0100, Alex Coplan via Gcc-patches wrote: > FYI, I'm seeing the new test failing on aarch64: > > PASS: gcc.dg/pr96573.c (test for excess errors) > FAIL: gcc.dg/pr96573.c scan-tree-dump optimized "__builtin_bswap" The vectorizer in the aarch64 case manages to emit a VEC_PERM_EXPR instead (which is just as efficient). So, do we want to go for the following (and/or perhaps also restrict the test to a couple of targets where it works? In my last distro build it failed only on aarch64-linux, while armv7hl-linux-gnueabi and {i686,x86_64,powerpc64le,s390x}-linux were fine)? 2021-04-06 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/96573 * gcc.dg/pr96573.c: Instead of __builtin_bswap accept also VEC_PERM_EXPR with bswapping permutation.
2021-04-06tree-optimization/99924 - visit permute nodes again when partitioningRichard Biener2-1/+13
Since SLP graph partitioning works on scalar stmts (because it's done for costing) we have to make sure to visit permute nodes multiple times since they will not pull partitions together. 2021-04-06 Richard Biener <rguenther@suse.de> PR tree-optimization/99924 * tree-vect-slp.c (vect_bb_partition_graph_r): Do not mark nodes w/o scalar stmts as visited. * gfortran.dg/vect/pr99924.f90: New testcase.
2021-04-06testsuite: Fix up g++.dg/ext/vector40.C testJakub Jelinek1-0/+1
The test FAILs on i686-linux due to -Wpsabi diagnostics. 2021-04-06 Jakub Jelinek <jakub@redhat.com> PR c++/97900 * g++.dg/ext/vector40.C: Add -Wno-psabi -w to dg-options.
2021-04-06arm: Fix PCS for SFmode -> SImode libcalls [PR99748]Alex Coplan1-0/+4
This patch fixes PR99748 which shows us trying to pass the argument to __aeabi_f2iz in the VFP register s0 when the library function is expecting to use the GPR r0. It also fixes the __aeabi_f2uiz case which was broken in the same way. For the testcase in the PR, here is the code we generate before the patch (with -mfloat-abi=hard -march=armv8.1-m.main+mve -O0): main: push {r7, lr} sub sp, sp, #8 add r7, sp, #0 mov r3, #1065353216 str r3, [r7, #4] @ float vldr.32 s0, [r7, #4] bl __aeabi_f2iz mov r3, r0 cmp r3, #1 [...] This becomes: main: push {r7, lr} sub sp, sp, #8 add r7, sp, #0 mov r3, #1065353216 str r3, [r7, #4] @ float ldr r0, [r7, #4] @ float bl __aeabi_f2iz mov r3, r0 cmp r3, #1 [...] after the patch. We see a similar change for the same testcase with a cast to unsigned instead of int. gcc/ChangeLog: PR target/99748 * config/arm/arm.c (arm_libcall_uses_aapcs_base): Also use base PCS for [su]fix_optab.
2021-04-06c++: mangling of lambdas in default args [PR91241]Jason Merrill2-9/+13
In this testcase, the parms remembered in LAMBDA_EXPR_EXTRA_SCOPE are no longer the parms of the FUNCTION_DECL they have as their DECL_CONTEXT, so we were mangling both lambdas as parm #0. But since the parms are numbered from right to left we don't need to need to find them in the FUNCTION_DECL, we can measure their own DECL_CHAIN. gcc/cp/ChangeLog: PR c++/91241 * mangle.c (write_compact_number): Add sanity check. (write_local_name): Use list_length for parm number. gcc/testsuite/ChangeLog: PR c++/91241 * g++.dg/abi/lambda-defarg1.C: New test.
2021-04-05c++: placeholder type constraint in structured binding [PR99899]Patrick Palka3-8/+54
In this PR, we're crashing because the constraint handling inside do_auto_deduction doesn't expect to see an adc_decomp_type context. This patch fixes this by treating adc_decomp_type like adc_variable_type or adc_return_type during placeholder type constraint checking. Meanwhile, I noticed we weren't checking constraints at all when binding an array via a structured binding, since do_auto_deduction would exit early and bypass the constraint check. This patch fixes this by replacing the early exit with an appropriate setup of the 'targs' vector. gcc/cp/ChangeLog: PR c++/99899 * pt.c (do_auto_deduction): Don't exit early when deducing the array type of a structured binding. Also handle adc_decomp_type during constraint checking. gcc/testsuite/ChangeLog: PR c++/99899 * g++.dg/cpp2a/concepts-placeholder7.C: New test. * g++.dg/cpp2a/concepts-placeholder8.C: New test.
2021-04-06Daily bump.GCC Administrator6-1/+166
2021-04-05c++: -Wunused, constant, and generic lambda [PR96311]Jason Merrill2-0/+21
We never called mark_use for a return value in a function with dependent return type. In that situation we don't know if the use is as an rvalue or lvalue, but we can use mark_exp_read instead. gcc/cp/ChangeLog: PR c++/96311 * typeck.c (check_return_expr): Call mark_exp_read in dependent case. gcc/testsuite/ChangeLog: PR c++/96311 * g++.dg/cpp1y/lambda-generic-Wunused.C: New test.
2021-04-05c++: reinterpret_cast from prvalue to rvalue ref [PR98440]Jason Merrill4-14/+10
In r260622 I allowed this under the general principle that [basic.lval] "Whenever a prvalue appears as an operand of an operator that expects a glvalue for that operand, the temporary materialization conversion (7.3.4) is applied to convert the expression to an xvalue." But [expr.reinterpret.cast] specifically excludes creating a temporary in this case. gcc/cp/ChangeLog: PR c++/98440 * typeck.c (build_reinterpret_cast_1): Don't perform temporary materialization. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/rv-cast6.C: Expect reinterpret_cast error. * g++.dg/cpp0x/reinterpret_cast2.C: Adjust message. * g++.old-deja/g++.jason/rvalue3.C: Likewise.
2021-04-05c++: enum in generic lambda in template [PR95317]Jason Merrill2-1/+12
Here we weren't instantiating the enumerators because the arglist still had the template parameter for the generic lambda, so looking one up failed. We need to instantiate if the non-lambda enclosing scope is non-dependent. gcc/cp/ChangeLog: PR c++/95317 * pt.c (lookup_template_class_1): Do tsubst_enum when tsubsting a generic lambda. gcc/testsuite/ChangeLog: PR c++/95317 * g++.dg/cpp1y/lambda-generic-enum1.C: New test.
2021-04-05c++: lambda in DMI in class template [PR95870]Jason Merrill2-0/+25
Here enclosing_instantiation_of was failing to find a match because otctx is struct S<T> and current_function_decl is S<int>::S(), so the latter has more function contexts, and we end up trying to compare S() to NULL_TREE. After spending a bit of time working on establishing the correspondence in this case (class <=> constructor), it occurred to me that we could just use DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be redeclared. Since we're so close to release, for now I'm only doing this for the case that was failing before. gcc/cp/ChangeLog: PR c++/95870 * pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION if there is no enclosing non-lambda function. gcc/testsuite/ChangeLog: PR c++/95870 * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.
2021-04-05Fix small regression with -fdump-ada-specEric Botcazou1-18/+21
When the enumeration constants of an enumeration type are defined by explicit values, the binding generated by -fdump-ada-spec does not use an enumeration type on the Ada side, because the set of allowed values in C/C++ is larger than the set of allowed values in Ada, but instead use an integer subtype and defines a set of explicit constants, which used to be of this subtype but were changed to the base type at some point. This reinstates the subtype for them. gcc/c-family/ * c-ada-spec.c (is_simple_enum): Minor tweaks. (dump_ada_enum_type): Add TYPE and PARENT parameters. For non-simple enumeral types use again the type name for the enumeration constants. (dump_ada_node): Adjust call to dump_ada_enum_type. (dump_nested_type): Likewise.
2021-04-05c++: Unneeded export query [PR 99380]Nathan Sidwell1-27/+39
This problem got introduced fixing a module numbering problem. When preprocessing a header unit, we don't need to send an EXPORT query unless we're also determining dependencies, or the mapper asked us to. Sadly the testsuite isn't set up to test this kind of subtlety. I manually did that with stdin/stdout. PR c++/99380 gcc/cp/ * module.cc (name_pending_imports): Drop 'atend' parm. Don't query export when not needed. (preprocess_module, preprocessed_module): Adjust.
2021-04-05analyzer: fix ICE on zero-arg calls passed to __attribute__((nonnull)) [PR ↵David Malcolm3-2/+6
99906] gcc/analyzer/ChangeLog: PR analyzer/99906 * analyzer.cc (maybe_reconstruct_from_def_stmt): Fix NULL dereference on calls with zero arguments. * sm-malloc.cc (malloc_state_machine::on_stmt): When handling __attribute__((nonnull)), only call get_diagnostic_tree if the result will be used. gcc/testsuite/ChangeLog: PR analyzer/99906 * gcc.dg/analyzer/pr99906.c: New test.
2021-04-05analyzer: fix apparent hang with -fanalyzer-verbosity=0 [PR analyzer/99886]David Malcolm2-3/+26
The analyzer appeared to enter an infinite loop on malloc-1.c when -fanalyzer-verbosity=0 was used. In fact, it was slowly counting from 0 to 0xffffffff. Root cause is looping up to effectively ((unsigned)0) - 1 in diagnostic_manager::consolidate_conditions when there are no events in the path. Fixed by the following, which uses signed integers when subtracting from path->num_events () when simplifying checker_paths. gcc/analyzer/ChangeLog: PR analyzer/99886 * diagnostic-manager.cc (diagnostic_manager::prune_interproc_events): Use signed integers when subtracting one from path->num_events (). (diagnostic_manager::consolidate_conditions): Likewise. Convert next_idx to a signed int. gcc/testsuite/ChangeLog: PR analyzer/99886 * gcc.dg/analyzer/pr99886.c: New test.
2021-04-05c++: extern template and static data member [PR99066]Jason Merrill2-1/+21
'extern template' should mean that the relevant symbols are never emitted. But in this case we were assuming that DECL_EXTERNAL was already set on the variable, so we just needed to clear DECL_NOT_REALLY_EXTERN. Since DECL_EXTERNAL was not set, we emitted a definition of npos. gcc/cp/ChangeLog: PR c++/99066 * pt.c (mark_decl_instantiated): Set DECL_EXTERNAL. gcc/testsuite/ChangeLog: PR c++/99066 * g++.dg/cpp0x/extern_template-6.C: New test.
2021-04-05c++: constexpr if and nested generic lambda [PR99201]Jason Merrill2-1/+36
When building up *_EXTRA_ARGS for a constexpr if or pack expansion, we need to walk into the body of a lambda to find all the local_specializations that we need to remember, like we do in find_parameter_packs_r. gcc/cp/ChangeLog: PR c++/99201 * pt.c (class el_data): Add visited field. (extract_local_specs): Pass it to cp_walk_tree. (extract_locals_r): Walk into the body of a lambda. gcc/testsuite/ChangeLog: PR c++/99201 * g++.dg/cpp1z/constexpr-if-lambda4.C: New test.
2021-04-05c++: Fix print-tree for TEMPLATE_DECLJason Merrill1-9/+9
The if allows TEMPLATE_DECL, but then checking DECL_MODULE_IMPORT_P crashes on TEMPLATE_DECL. Fixed by stripping TEMPLATE_DECL first. gcc/cp/ChangeLog: * ptree.c (cxx_print_decl): Check DECL_MODULE_IMPORT_P on template result.
2021-04-05d: Use weak linkage for template symbols instead of gnu.linkonce (PR99914)Iain Buclaw8-72/+94
The default linkage of templates in the D language is now DECL_WEAK instead of DECL_ONE_ONLY, if supported. This better matches the expected override semantics of template symbols compiled to object code. For example: module rt.config; template rt_flag() { pragma(mangle, "rt_flag") __gshared bool rt_flag = true; } module main; extern(C) __gshared bool rt_flag = false; The above currently does not succeed in linking due to there being multiple definitions of `rt_flag' in different sections that aren't considered mergeable. The compiler flag enabling toggling of this has been given a clearer named `-fweak-templates', which distinguishes itself from G++ `-fweak', which is intended only for testing. gcc/d/ChangeLog: PR d/99914 * d-lang.cc (d_init): Disable flag_weak_templates if no support for weak or one-only symbols. * d-tree.h (VAR_OR_FUNCTION_DECL_CHECK): New macro. (DECL_INSTANTIATED): New macro. (d_comdat_linkage): Remove declaration. (d_linkonce_linkage): Remove declaration. (set_linkage_for_decl): New declaration. * decl.cc (DeclVisitor::visit (StructDeclaration *)): Replace call to d_linkonce_linkage with setting DECL_INSTANTIATED. (DeclVisitor::visit (ClassDeclaration *)): Likewise. (DeclVisitor::visit (EnumDeclaration *)): Likewise. (DeclVisitor::visit (InterfaceDeclaration *)): Remove call to d_linkonce_linkage. (get_symbol_decl): Call set_linkage_for_decl instead of d_linkonce_linkage. (d_finish_decl): Call set_linkage_for_decl. (d_comdat_linkage): Made function static. Only set DECL_COMDAT for DECL_INSTANTIATED decls. (d_linkonce_linkage): Remove function. (d_weak_linkage): New function. (set_linkage_for_decl): New function. * gdc.texi (Runtime Options): Rename -fno-weak to -fno-weak-templates, update documentation of option. * lang.opt (fweak): Rename option to ... (fweak-templates): ... this. Update help string. * modules.cc (get_internal_fn): Add Prot parameter. Set generated function flag. (build_internal_fn): Update call to get_internal_fn. (build_dso_cdtor_fn): Likewise. (register_moduleinfo): Call d_finish_decl on dso_slot_node and dso_initialized_node. * typeinfo.cc (TypeInfoVisitor::internal_reference): Call set_linkage_for_decl instead of d_comdat_linkage. (TypeInfoDeclVisitor::visit (TypeInfoDeclaration *)): Remove calls to d_linkonce_linkage and d_comdat_linkage. (get_cpp_typeinfo_decl): Likewise. gcc/testsuite/ChangeLog: PR d/99914 * gdc.dg/pr99914.d: New test.
2021-04-04Trivial testsuite fixes for nios2-elf.Sandra Loosemore2-2/+2
nios2-elf defaults to -fno-delete-null-pointer-checks, which causes failures in tests that assume the option is enabled. Make the dependence explicit. 2021-04-04 Sandra Loosemore <sandra@codesourcery.com> gcc/testsuite/ * gcc.dg/ipa/propmalloc-4.c: Add -fdelete-null-pointer-checks. * gcc.dg/tree-ssa/evrp11.c: Likewise.
2021-04-05Daily bump.GCC Administrator3-1/+11
2021-04-03c++: array new initialized from a call [PR99643]Jason Merrill2-3/+9
Here the get_foo() call results in a TARGET_EXPR, which we strip in massage_init_elt, but then when build_vec_init tries to use it to initialize the array element we crash because build_aggr_init expects a class rvalue to have a TARGET_EXPR. So don't strip it. The stripping was added in r206639 for PR59659, so I checked that removing it didn't significantly increase compile time or memory usage for that testcase; compile time was unaffected, memory usage increased by 0.00004%. gcc/cp/ChangeLog: PR c++/99643 * typeck2.c (massage_init_elt): Don't strip TARGET_EXPR. gcc/testsuite/ChangeLog: PR c++/99643 * g++.dg/cpp0x/initlist-new5.C: New test.
2021-04-04Daily bump.GCC Administrator6-1/+133
2021-04-04d: Merge upstream dmd 3b808e838, druntime 483bc129, phobos f89dc217aIain Buclaw144-2371/+5904
D front-end changes: - Explicit package visibility attribute is now always applied to introducing scopes. - Added `__traits(totype, string)' to convert mangled type string to an existing type. - Printf-like and scanf-like functions are now detected by prefixing them with `pragma(printf)' for printf-like functions or `pragma(scanf)' for scanf-like functions. - Added `__c_wchar_t', `__c_complex_float', `__c_complex_double', and `__c_complex_real' types for interfacing with C and C++. - Template alias parameters can now be instantiated with basic types, such as `int` or `void function()`. - Mixins can now be used as types in the form `mixin(string) var'. - Mixin expressions can take an argument list, same as `pragma(msg)'. - Implement DIP1034, add `typeof(*null)' types to represent `noreturn'. - `pragma(msg)' can print expressions of type `void'. - It is now an error to use private variables selectively imported from other modules. Due to a bug, some imported private members were visible from other modules, violating the specification. - Added new syntax to declare an alias to a function type using the `alias' syntax based on the assignment operator. - Function literals can now return a value by reference. Phobos changes: - Synchronize C bindings with the latest port fixes in upstream druntime. - Added alias for a `noreturn' type in object.d - Make use of the new `pragma(printf)' and `pragma(scanf)' pragmas, fix all code that got flagged as being incorrect. - Fixed code that relied on bugs in the D import package system. Reviewed-on: https://github.com/dlang/dmd/pull/12339 https://github.com/dlang/druntime/pull/3422 https://github.com/dlang/phobos/pull/7932 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 3b808e838. * Make-lang.in (D_FRONTEND_OBJS): Add d/chkformat.o. * d-codegen.cc (build_struct_literal): Handle special enums. * d-convert.cc (convert_expr): Handle noreturn type. (convert_for_condition): Likewise. * d-target.cc (Target::_init): Set type for wchar_t. (TargetCPP::derivedClassOffset): New method. (Target::libraryObjectMonitors): New method. * decl.cc (get_symbol_decl): Set TREE_THIS_VOLATILE for functions of type noreturn. * toir.cc (IRVisitor::visit (ReturnStatement *)): Handle returning noreturn types. * types.cc (TypeVisitor::visit (TypeNoreturn *)): New method. (TypeVisitor::visit (TypeEnum *)): Handle special enums. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 483bc129. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/fcntl.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/unistd.d. (DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/stdc/malloc.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos f89dc217a. * src/Makefile.am (PHOBOS_DSOURCES): Add std/regex/internal/tests2.d. * src/Makefile.in: Regenerate. * testsuite/libphobos.exceptions/chain.d: Fix format arguments. * testsuite/libphobos.exceptions/line_trace.d: Likewise.
2021-04-03initialize pr94314-3.C counterAlexandre Oliva1-1/+1
The int counter in the main loop was uninitialized, so we might end up looping a very large number of times before completing successfully. I suspect that was unintended, so I'm adding a zero initializer. for gcc/testsuite/ChangeLog * g++.dg/pr94314-3.C: Zero-initialize main loop counter.
2021-04-03silence expected psabi warning in ipa-sra-19 on ppc-vxworksAlexandre Oliva1-1/+1
The default CPU for our ppc-vx7r2 toolchain has no support for altivec or vsx, so an ABI without vector support is selected. The selected calling conventions do not cover passing or returning vector types, so -Wpsabi warns about such uses. powerpc-ibm-aix* already silences these warnings with -Wno-psabi; this patch extends that to powerpc-wrs-vxworks* too. for gcc/testsuite/ChangeLog * gcc.dg/ipa/ipa-sra-19.c: Extend -Wno-psabi to ppc-vx7r2.
2021-04-03c++: GC during late parsing collects live data [PR91416]Marek Polacek2-0/+25
Coming back to <https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527699.html>: This is a crash that points to a GC problem. Consider this test: __attribute__ ((unused)) struct S { S() { } } s; We're parsing a simple-declaration. While parsing the decl specs, we parse the attribute, which means creating a TREE_LIST using ggc_alloc_*. A function body is a complete-class context so when parsing the member-specification of this class-specifier, we parse the bodies of the functions we'd queued in cp_parser_late_parsing_for_member. This then leads to this call chain: cp_parser_function_definition_after_declarator -> expand_or_defer_fn -> expand_or_defer_fn_1 -> maybe_clone_body -> expand_or_defer_fn -> cgraph_node::finalize_function -> ggc_collect. In this test, the ggc_collect call collects the TREE_LIST we had allocated, and a crash duly ensues. I couldn't do what Richard suggested, that is, attach the attribute list to struct S, because we don't pass decl_specs from cp_parser_type_specifier down to cp_parser_class_specifier. Therefore I've attempted to do "push the decl_specifiers onto a vec that is a GC root", except I couldn't really push the decl_specifiers, because first I'd have to mark cp_decl_specifier_seq with GTY(()) and even that wouldn't be enough for me to be able to create static GTY(()) vec<cp_decl_specifier_seq *, va_gc> But here we only care about cp_decl_specifier_seq::attributes, so the patch is just this. I've also extended the test so now we test a nested class too. gcc/cp/ChangeLog: PR c++/91416 * parser.c: Create a GC root for attributes in a decl specifier. (cp_parser_type_specifier): Push/pop ->attributes onto/from it. gcc/testsuite/ChangeLog: PR c++/91416 * g++.dg/other/gc7.C: New test.
2021-04-03Darwin : Fix out-of-bounds access to df_regs_ever_live.Iain Sandoe1-2/+3
During changes made for LRA (or, perhaps, even before) we omitted a check that the current register we are working on is a hard reg before we tried to note its liveness. A stage 1 built with fsanitize=address catches this, as does any attempt to build master with clang and -std=c++11. gcc/ChangeLog: * config/darwin.c (machopic_legitimize_pic_address): Check that the current pic register is one of the hard reg set before setting liveness.
2021-04-03Darwin : Fix whitespace and delete unused code (NFC).Iain Sandoe1-20/+14
Fix some incorrect indenting and remove two cases where we had code '#if 0'-d out. gcc/ChangeLog: * config/darwin.c (machopic_legitimize_pic_address): Fix whitespace, remove unused code.
2021-04-03Fortran: Fix ICE on wrong code [PR99818].Paul Thomas2-4/+34
2021-04-03 Paul Thomas <pault@gcc.gnu.org> gcc/fortran/ChangeLog PR fortran/99818 * interface.c (compare_parameter): The codimension attribute is applied to the _data field of class formal arguments. gcc/testsuite/ChangeLog PR fortran/99818 * gfortran.dg/coarray_48.f90: New test.
2021-04-03bswap: Fix up bswap_view_convert after the recent change [PR99882]Jakub Jelinek2-1/+47
Martin reported that my recent change to allow pointer types in bswap broke valgrind. The bswap_view_convert function used for the initialization of vector CONSTRUCTOR from the identity or byte-swapped pieces unfortunately didn't handle pointer types. The following patch handles it there. 2021-04-03 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/99882 * gimple-ssa-store-merging.c (bswap_view_convert): Handle val with pointer type. * gcc.dg/pr99882.c: New test.
2021-04-03dse: Fix up hard reg conflict checking in replace_read [PR99863]Jakub Jelinek2-6/+38
Since PR37922 fix RTL DSE has hard register conflict checking in replace_read, so that if the replacement sequence sets (or typically just clobbers) some hard register (usually condition codes) we verify that hard register is not live. Unfortunately, it compares the hard reg set clobbered/set by the sequence (regs_set) against the currently live hard register set, but it then emits the insn sequence not at the current insn position, but before store_insn->insn. So, we should not compare against the current live hard register set, but against the hard register live set at the point of the store insn. Fortunately, we already have that remembered in store_insn->fixed_regs_live. In addition to bootstrapping/regtesting this patch on x86_64-linux and i686-linux, I've also added statistics gathering and it seems the only place where we end up rejecting the replace_read is the newly added testcase (the PR37922 is no longer effective at that) and fixed_regs_live has been always non-NULL at the if (store_insn->fixed_regs_live) spot. Rather than having there an assert, I chose to just keep regs_set as is, which means in that hypothetical case where fixed_regs_live wouldn't be computed for some store we'd still accept sequences that don't clobber/set any hard registers and just punt on those that clobber/set those. 2021-04-03 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/99863 * dse.c (replace_read): Drop regs_live argument. Instead of regs_live, use store_insn->fixed_regs_live if non-NULL, otherwise punt if insns sequence clobbers or sets any hard registers. * gcc.target/i386/pr99863.c: New test.
2021-04-03rs6000: Avoid -fpatchable-function-entry* regressions on powerpc64 be [PR98125]Jakub Jelinek4-12/+58
The SECTION_LINK_ORDER changes broke powerpc64-linux ELFv1. Seems that the assembler/linker relies on the symbol mentioned for the "awo" section to be in the same section as the symbols mentioned in the relocations in that section (i.e. labels for the patchable area in this case). That is the case for most targets, including powerpc-linux 32-bit or powerpc64 ELFv2 (that one has -fpatchable-function-entry* support broken for other reasons and it doesn't seem to be a regression). But it doesn't work on powerpc64-linux ELFv1. We emit: .section ".opd","aw" .align 3 _Z3foov: .quad .L._Z3foov,.TOC.@tocbase,0 .previous .type _Z3foov, @function .L._Z3foov: .section __patchable_function_entries,"awo",@progbits,_Z3foov .align 3 .8byte .LPFE1 .section .text._Z3foov,"axG",@progbits,_Z3foov,comdat .LPFE1: nop .LFB0: .cfi_startproc and because _Z3foov is in the .opd section rather than the function text section, it doesn't work. I'm afraid I don't know what exactly should be done, whether e.g. it could use .section __patchable_function_entries,"awo",@progbits,.L._Z3foov instead, or whether the linker should be changed to handle it as is, or something else. But because we have a P1 regression that didn't see useful progress over the 4 months since it has been filed and we don't really have much time, below is an attempt to do a targetted reversion of H.J's patch, basically act as if HAVE_GAS_SECTION_LINK_ORDER is never true for powerpc64-linux ELFv1, but for 32-bit or 64-bit ELFv2 keep working as is. This would give us time to resolve it for GCC 12 properly. 2021-04-03 Jakub Jelinek <jakub@redhat.com> PR testsuite/98125 * targhooks.h (default_print_patchable_function_entry_1): Declare. * targhooks.c (default_print_patchable_function_entry_1): New function, copied from default_print_patchable_function_entry with an added flags argument. (default_print_patchable_function_entry): Rewritten into a small wrapper around default_print_patchable_function_entry_1. * config/rs6000/rs6000.c (TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY): Redefine. (rs6000_print_patchable_function_entry): New function. * g++.dg/pr93195a.C: Skip on powerpc*-*-* 64-bit.
2021-04-03c++: NRV in lambda in template [PR91217]Jason Merrill2-2/+27
tsubst_lambda_expr was producing a function with two blocks that claimed to be the outermost block in the function body, one from the call to start_lambda_function in tsubst_lambda_expr, and one from tsubsting the block added by start_lambda_function when we first parsed the lambda. This messed with the named return value optimization, which only works for variables in the outermost block. gcc/cp/ChangeLog: PR c++/91217 * pt.c (tsubst_lambda_expr): Skip the body block from DECL_SAVED_TREE. gcc/testsuite/ChangeLog: PR c++/91217 * g++.dg/opt/nrv20.C: New test.
2021-04-03c++: PMF template parm and noexcept [PR90664]Jason Merrill2-0/+27
The constexpr code only wants to preserve PTRMEM_CST in conversions if the conversions are only qualification conversions; dropping noexcept counts as a qualification adjustment in overload resolution, so let's include it here. gcc/cp/ChangeLog: PR c++/90664 * cvt.c (can_convert_qual): Check fnptr_conv_p. gcc/testsuite/ChangeLog: PR c++/90664 * g++.dg/cpp1z/noexcept-type24.C: New test.
2021-04-03c++: dependent attribute on parameter [PR97900]Jason Merrill2-60/+21
We were copying attributes from the template to the instantiation without considering that they might be dependent. To make sure that the new parms have the appropriate properties for the code pattern, let's just regenerate them. gcc/cp/ChangeLog: PR c++/97900 * pt.c (regenerate_decl_from_template): tsubst_decl the parms. gcc/testsuite/ChangeLog: PR c++/97900 * g++.dg/ext/vector40.C: New test.
2021-04-03Daily bump.GCC Administrator4-1/+68
2021-04-02c++: placeholder type constraint inside range-for [PR99869]Patrick Palka2-1/+13
In the testcase below, during ahead-of-time deduction of a constrained auto inside a range-based for loop, we trip over an assert within do_auto_deduction which expects the deduction context to be adc_return_type or adc_variable_type, but do_range_for_auto_deduction calls do_auto_deduction with the context defaulted to adc_unspecified. We could safely relax the assert to also accept adc_unspecified, but it seems the deduction context should really be adc_variable_type here. gcc/cp/ChangeLog: PR c++/99869 * parser.c (do_range_for_auto_deduction): Pass adc_variable_type to do_auto_deduction. gcc/testsuite/ChangeLog: PR c++/99869 * g++.dg/cpp2a/concepts-placeholder6.C: New test.