[pushed] c++: mangling of lambdas in default args [PR91241]

2021-04-05 Thread Jason Merrill via Gcc-patches
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,

Re: [PATCH 2/3] x86: Update memcpy/memset inline strategies for Skylake family CPUs

2021-04-05 Thread H.J. Lu via Gcc-patches
On Mon, Apr 5, 2021 at 2:14 PM Jan Hubicka wrote: > > > > /* skylake_cost should produce code tuned for Skylake familly of CPUs. > > > */ > > > static stringop_algs skylake_memcpy[2] = { > > > - {libcall, {{1024, rep_prefix_4_byte, true}, {-1, libcall, false}}}, > > > - {libcall, {{16,

[pushed] c++: -Wunused, constant, and generic lambda [PR96311]

2021-04-05 Thread Jason Merrill via Gcc-patches
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. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: PR c++/96311 *

[pushed] c++: reinterpret_cast from prvalue to rvalue ref [PR98440]

2021-04-05 Thread Jason Merrill via Gcc-patches
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

Re: [PATCH 2/3] x86: Update memcpy/memset inline strategies for Skylake family CPUs

2021-04-05 Thread Jan Hubicka
> > /* skylake_cost should produce code tuned for Skylake familly of CPUs. */ > > static stringop_algs skylake_memcpy[2] = { > > - {libcall, {{1024, rep_prefix_4_byte, true}, {-1, libcall, false}}}, > > - {libcall, {{16, loop, false}, {512, unrolled_loop, false}, > > - {-1,

[PATCH 3/3] d: Add TARGET_D_REGISTER_OS_TARGET_INFO

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds TARGET_D_REGISTER_OS_TARGET_INFO as a new D front-end target hook, implementing `__traits(getTargetInfo, "objectFormat")' for all targets that have D support files. This trait was added earlier in the front-end as a stub, however the target-specific implementation was left

[PATCH 2/3] d: Add TARGET_D_REGISTER_CPU_TARGET_INFO

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds TARGET_D_REGISTER_CPU_TARGET_INFO as a new D front-end target hook, implementing `__traits(getTargetInfo, "floatAbi")' for all targets that have D support files. This trait was added earlier in the front-end as a stub, however the target-specific implementation was left out

[PATCH 1/3] d: Add TARGET_D_HAS_STDCALL_CONVENTION

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds TARGET_D_HAS_STDCALL_CONVENTION as a new D front-end target hook. It replaces the use of the D front-end `is64bit' parameter in determining whether to insert the "stdcall" function attribute. It is also used to determine whether `extern(System)' should be the same as

[pushed] c++: enum in generic lambda in template [PR95317]

2021-04-05 Thread Jason Merrill via Gcc-patches
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. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog:

[pushed] c++: lambda in DMI in class template [PR95870]

2021-04-05 Thread Jason Merrill via Gcc-patches
Here enclosing_instantiation_of was failing to find a match because otctx is struct S and current_function_decl is S::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

Re: [PATCH] c++: placeholder type constraint on structured binding [PR99899]

2021-04-05 Thread Jason Merrill via Gcc-patches
On 4/5/21 12:31 PM, Patrick Palka wrote: On Mon, 5 Apr 2021, Patrick Palka wrote: 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 and

[c-family] Fix small regression with -fdump-ada-spec

2021-04-05 Thread Eric Botcazou
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

Re: [PATCH] c++: placeholder type constraint on structured binding [PR99899]

2021-04-05 Thread Patrick Palka via Gcc-patches
On Mon, 5 Apr 2021, Patrick Palka wrote: > 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 > and adc_return_type during the constraint

[PATCH] c++: placeholder type constraint on structured binding [PR99899]

2021-04-05 Thread Patrick Palka via Gcc-patches
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 and adc_return_type during the constraint handling. Meanwhile, I noticed we weren't

[committed] analyzer: fix ICE on zero-arg calls passed to __attribute__((nonnull)) [PR 99906]

2021-04-05 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r11-7988-g7d8f4240c94e2e7643ac13cda1fdd0bb6ca3a3fb. gcc/analyzer/ChangeLog: PR analyzer/99906 * analyzer.cc (maybe_reconstruct_from_def_stmt): Fix NULL dereference on calls with zero

[committed] analyzer: fix apparent hang with -fanalyzer-verbosity=0 [PR analyzer/99886]

2021-04-05 Thread David Malcolm via Gcc-patches
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 0x. Root cause is looping up to effectively ((unsigned)0) - 1 in diagnostic_manager::consolidate_conditions when there are no events in the path.

c++: Unneeded export query [PR 99380]

2021-04-05 Thread Nathan Sidwell
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 askedus to. Sadly the testsuite isn't set up to test this kind of subtlety. I manually did that

Re: [PATCH 2/3] x86: Update memcpy/memset inline strategies for Skylake family CPUs

2021-04-05 Thread H.J. Lu via Gcc-patches
On Mon, Mar 22, 2021 at 6:16 AM H.J. Lu wrote: > > 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

[pushed] c++: extern template and static data member [PR99066]

2021-04-05 Thread Jason Merrill via Gcc-patches
'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. Tested

[pushed] c++: constexpr if and nested generic lambda [PR99201]

2021-04-05 Thread Jason Merrill via Gcc-patches
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. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: PR

Re: [PATCH RFC] c++: Fix print-tree module handling for TEMPLATE_DECL

2021-04-05 Thread Nathan Sidwell
On 4/3/21 10:54 AM, Jason Merrill wrote: The if allows TEMPLATE_DECL, but then checking DECL_MODULE_IMPORT_P crashes on TEMPLATE_DECL. Fixed by stripping TEMPLATE_DECL first. Nathan, does this look right to you? gcc/cp/ChangeLog: * ptree.c (cxx_print_decl): Check DECL_MODULE_IMPORT_P

[committed] d: Use weak linkage for template symbols instead of gnu.linkonce (PR99914)

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch changes the default linkage of templates in the D language to be 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() {

Re: [Patch, fortran] PR99818 - [10/11 Regression] ICE in gfc_get_tree_for_caf_expr, at fortran/trans-expr.c:2186

2021-04-05 Thread Paul Richard Thomas via Gcc-patches
Hi Jerry, A belated thanks is in order. Pushed as fc27115d6107f219e6f3dc610c99210005fe9dc5. I'll wait a little while for 10-branch since it is an ICE on wrong code. Regards Paul On Fri, 2 Apr 2021 at 04:11, Jerry DeLisle wrote: > Paul, > > This looks OK to me for Trunk. I believe 10 is in