Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486)
On Wed, 2018-12-19 at 20:00 +0100, Thomas Schwinge wrote: > Hi David! > > I will admit that I don't have researched ;-/ what this is actually > all > about, and how it's implemented, but... > > On Mon, 5 Nov 2018 15:31:08 -0500, David Malcolm m> wrote: > > The C++ frontend gained various location wrapper nodes in r256448 > > (GCC 8). > > That patch: > > https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00799.html > > added wrapper nodes around all nodes with !CAN_HAVE_LOCATION_P for: > > > > * arguments at callsites, and for > > > > * typeid, alignof, sizeof, and offsetof. > > > > This is a followup to that patch, adding many more location > > wrappers > > to the C++ frontend. It adds location wrappers for nodes with > > !CAN_HAVE_LOCATION_P to: > > > > * all literal nodes (in cp_parser_primary_expression) > > > > * all id-expression nodes (in finish_id_expression), except within > > a > > decltype. > > > > * all mem-initializer nodes within a mem-initializer-list > > (in cp_parser_mem_initializer) > > > > However, the patch also adds some suppressions: regions in the > > parser > > for which wrapper nodes will not be created: > > > > * within a template-parameter-list or template-argument-list (in > > cp_parser_template_parameter_list and > > cp_parser_template_argument_list > > respectively), to avoid encoding the spelling location of the > > nodes > > in types. For example, "array<10>" and "array<10>" are the same > > type, > > despite the fact that the two different "10" tokens are spelled > > in > > different locations in the source. > > > > * within a gnu-style attribute (none of are handlers are set up to > > cope > > with location wrappers yet) > > > > * within various OpenMP clauses I suppressed the addition of wrapper nodes within OpenMP as a way to reduce the scope of the patch. > ... I did wonder why things applicable to OpenMP wouldn't likewise > apply > to OpenACC, too? That is: It might or might not be. Maybe there's a gap in my test coverage? How should I be running the OpenACC tests? > > (cp_parser_omp_all_clauses): Don't create wrapper nodes within > > OpenMP clauses. > > (cp_parser_omp_for_loop): Likewise. > > (cp_parser_omp_declare_reduction_exprs): Likewise. > > @@ -33939,6 +33968,9 @@ cp_parser_omp_all_clauses (cp_parser > > *parser, omp_clause_mask mask, > >bool first = true; > >cp_token *token = NULL; > > > > + /* Don't create location wrapper nodes within OpenMP > > clauses. */ > > + auto_suppress_location_wrappers sentinel; > > + > >while (cp_lexer_next_token_is_not (parser->lexer, > > CPP_PRAGMA_EOL)) > > { > >pragma_omp_clause c_kind; > > @@ -35223,6 +35255,10 @@ cp_parser_omp_for_loop (cp_parser *parser, > > enum tree_code code, tree clauses, > > } > >loc = cp_lexer_consume_token (parser->lexer)->location; > > > > + /* Don't create location wrapper nodes within an OpenMP > > "for" > > +statement. */ > > + auto_suppress_location_wrappers sentinel; > > + > >matching_parens parens; > >if (!parens.require_open (parser)) > > return NULL; > > @@ -37592,6 +37628,8 @@ cp_parser_omp_declare_reduction_exprs (tree > > fndecl, cp_parser *parser) > >else > > { > > cp_parser_parse_tentatively (parser); > > + /* Don't create location wrapper nodes here. */ > > + auto_suppress_location_wrappers sentinel; > > tree fn_name = cp_parser_id_expression (parser, > > /*template_p=*/false, > > /*check_dependen > > cy_p=*/true, > > /*template_p=*/N > > ULL, > > Shouldn't "cp_parser_oacc_all_clauses" (and "some" other functions?) > be > adjusted in the same way? How would I test that? (I don't see any > OpenMP test cases added -- I have not yet tried whether any problems > would become apparent when temporarily removing the OpenMP changes > cited > above.) Lots of pre-existing OpenMP test cases started failing when I added the wrapper nodes to the C++ parser (e.g. for id-expressions and constants); suppressing them in the given places was an easy way to get them to pass again. Dave
Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486)
Hi David! I will admit that I don't have researched ;-/ what this is actually all about, and how it's implemented, but... On Mon, 5 Nov 2018 15:31:08 -0500, David Malcolm wrote: > The C++ frontend gained various location wrapper nodes in r256448 (GCC 8). > That patch: > https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00799.html > added wrapper nodes around all nodes with !CAN_HAVE_LOCATION_P for: > > * arguments at callsites, and for > > * typeid, alignof, sizeof, and offsetof. > > This is a followup to that patch, adding many more location wrappers > to the C++ frontend. It adds location wrappers for nodes with > !CAN_HAVE_LOCATION_P to: > > * all literal nodes (in cp_parser_primary_expression) > > * all id-expression nodes (in finish_id_expression), except within a > decltype. > > * all mem-initializer nodes within a mem-initializer-list > (in cp_parser_mem_initializer) > > However, the patch also adds some suppressions: regions in the parser > for which wrapper nodes will not be created: > > * within a template-parameter-list or template-argument-list (in > cp_parser_template_parameter_list and cp_parser_template_argument_list > respectively), to avoid encoding the spelling location of the nodes > in types. For example, "array<10>" and "array<10>" are the same type, > despite the fact that the two different "10" tokens are spelled in > different locations in the source. > > * within a gnu-style attribute (none of are handlers are set up to cope > with location wrappers yet) > > * within various OpenMP clauses ... I did wonder why things applicable to OpenMP wouldn't likewise apply to OpenACC, too? That is: > (cp_parser_omp_all_clauses): Don't create wrapper nodes within > OpenMP clauses. > (cp_parser_omp_for_loop): Likewise. > (cp_parser_omp_declare_reduction_exprs): Likewise. > @@ -33939,6 +33968,9 @@ cp_parser_omp_all_clauses (cp_parser *parser, > omp_clause_mask mask, >bool first = true; >cp_token *token = NULL; > > + /* Don't create location wrapper nodes within OpenMP clauses. */ > + auto_suppress_location_wrappers sentinel; > + >while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL)) > { >pragma_omp_clause c_kind; > @@ -35223,6 +35255,10 @@ cp_parser_omp_for_loop (cp_parser *parser, enum > tree_code code, tree clauses, > } >loc = cp_lexer_consume_token (parser->lexer)->location; > > + /* Don't create location wrapper nodes within an OpenMP "for" > + statement. */ > + auto_suppress_location_wrappers sentinel; > + >matching_parens parens; >if (!parens.require_open (parser)) > return NULL; > @@ -37592,6 +37628,8 @@ cp_parser_omp_declare_reduction_exprs (tree fndecl, > cp_parser *parser) >else > { > cp_parser_parse_tentatively (parser); > + /* Don't create location wrapper nodes here. */ > + auto_suppress_location_wrappers sentinel; > tree fn_name = cp_parser_id_expression (parser, /*template_p=*/false, > /*check_dependency_p=*/true, > /*template_p=*/NULL, Shouldn't "cp_parser_oacc_all_clauses" (and "some" other functions?) be adjusted in the same way? How would I test that? (I don't see any OpenMP test cases added -- I have not yet tried whether any problems would become apparent when temporarily removing the OpenMP changes cited above.) Grüße Thomas
Re: [PING] Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486)
On 12/3/18 5:10 PM, Jeff Law wrote: On 11/19/18 9:51 AM, David Malcolm wrote: Ping, for these patches: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486) https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00304.html [PATCH 2/2] C++: improvements to binary operator diagnostics (PR c++/87504) https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00303.html Thanks Dave [1] I've split them up for ease of review; they could be reworked to be fully independent, but there's some churn in the results for -Wtautological-compare introduced by the 1st patch which the 2nd patch addresses. gcc/ChangeLog: PR c++/43064 PR c++/43486 * convert.c: Include "selftest.h". (preserve_any_location_wrapper): New function. (convert_to_pointer_maybe_fold): Update to handle location wrappers. (convert_to_real_maybe_fold): Likewise. (convert_to_integer_1): Handle location wrappers when checking for INTEGER_CST. (convert_to_integer_maybe_fold): Update to handle location wrappers. (convert_to_complex_maybe_fold): Likewise. (selftest::test_convert_to_integer_maybe_fold): New functions. (selftest::convert_c_tests): New function. * fold-const.c (operand_equal_p): Strip any location wrappers. * selftest-run-tests.c (selftest::run_tests): Call selftest::convert_c_tests. * selftest.h (selftest::convert_c_tests): New decl. * tree.c (tree_int_cst_equal): Strip any location wrappers. (maybe_wrap_with_location): Don't create wrappers if any auto_suppress_location_wrappers are active. (suppress_location_wrappers): New variable. * tree.h (CONSTANT_CLASS_OR_WRAPPER_P): New macro. (suppress_location_wrappers): New decl. (class auto_suppress_location_wrappers): New class. gcc/c-family/ChangeLog: PR c++/43064 PR c++/43486 * c-common.c (unsafe_conversion_p): Strip any location wrapper. (verify_tree): Handle location wrappers. (c_common_truthvalue_conversion): Strip any location wrapper. Handle CONST_DECL. (fold_offsetof): Strip any location wrapper. (complete_array_type): Likewise for initial_value. (convert_vector_to_array_for_subscript): Call fold_for_warn on the index before checking for INTEGER_CST. * c-pretty-print.c (c_pretty_printer::primary_expression): Don't print parentheses around location wrappers. * c-warn.c (warn_logical_operator): Call fold_for_warn on op_right before checking for INTEGER_CST. (warn_tautological_bitwise_comparison): Call tree_strip_any_location_wrapper on lhs, rhs, and bitop's operand before checking for INTEGER_CST. (readonly_error): Strip any location wrapper. (warn_array_subscript_with_type_char): Strip location wrappers before checking for INTEGER_CST. Use the location of the index if available. gcc/cp/ChangeLog: PR c++/43064 PR c++/43486 * call.c (build_conditional_expr_1): Strip location wrappers when checking for CONST_DECL. (conversion_null_warnings): Use location of "expr" if available. * class.c (fixed_type_or_null): Handle location wrappers. * constexpr.c (potential_constant_expression_1): Likewise. * cvt.c (ignore_overflows): Strip location wrappers when checking for INTEGER_CST, and re-wrap the result if present. (ocp_convert): Call fold_for_warn before checking for INTEGER_CST. * decl.c (reshape_init_r): Strip any location wrapper. (undeduced_auto_decl): Likewise. * decl2.c (grokbitfield): Likewise for width. * expr.c (mark_discarded_use): Likewise for expr. * init.c (build_aggr_init): Likewise before checking init for DECL_P. (warn_placement_new_too_small): Call fold_for_warn on adj before checking for CONSTANT_CLASS_P, and on nelts. Strip any location wrapper from op0 and on oper before checking for VAR_P. * lambda.c (add_capture): Strip any location from initializer. * name-lookup.c (handle_namespace_attrs): Strip any location from x before checking for STRING_CST. * parser.c (cp_parser_primary_expression): Call maybe_add_location_wrapper on numeric and string literals. (cp_parser_postfix_expression): Strip any location wrapper when checking for DECL_IS_BUILTIN_CONSTANT_P. (cp_parser_binary_expression): Strip any location wrapper when checking for DECL_P on the lhs. (cp_parser_decltype_expr): Suppress location wrappers in the id-expression. (cp_parser_mem_initializer): Add location wrappers to the parenthesized expression list. (cp_parser_template_parameter_list): Don't create wrapper nodes within a template-parameter-list.
Re: [PING] Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486)
On Mon, 2018-12-03 at 15:10 -0700, Jeff Law wrote: > On 11/19/18 9:51 AM, David Malcolm wrote: > > Ping, for these patches: > > > > [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR > > c++/43486) > > https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00304.html > > > > [PATCH 2/2] C++: improvements to binary operator diagnostics (PR > > c++/87504) > > https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00303.html > > > > > > Thanks > > Dave > > > > > > > > [1] I've split them up for ease of review; they could be reworked > > > to > > > be > > > fully independent, but there's some churn in the results for > > > -Wtautological-compare introduced by the 1st patch which the 2nd > > > patch addresses. > > > > > > gcc/ChangeLog: > > > PR c++/43064 > > > PR c++/43486 > > > * convert.c: Include "selftest.h". > > > (preserve_any_location_wrapper): New function. > > > (convert_to_pointer_maybe_fold): Update to handle location > > > wrappers. > > > (convert_to_real_maybe_fold): Likewise. > > > (convert_to_integer_1): Handle location wrappers when checking > > > for > > > INTEGER_CST. > > > (convert_to_integer_maybe_fold): Update to handle location > > > wrappers. > > > (convert_to_complex_maybe_fold): Likewise. > > > (selftest::test_convert_to_integer_maybe_fold): New functions. > > > (selftest::convert_c_tests): New function. > > > * fold-const.c (operand_equal_p): Strip any location wrappers. > > > * selftest-run-tests.c (selftest::run_tests): Call > > > selftest::convert_c_tests. > > > * selftest.h (selftest::convert_c_tests): New decl. > > > * tree.c (tree_int_cst_equal): Strip any location wrappers. > > > (maybe_wrap_with_location): Don't create wrappers if any > > > auto_suppress_location_wrappers are active. > > > (suppress_location_wrappers): New variable. > > > * tree.h (CONSTANT_CLASS_OR_WRAPPER_P): New macro. > > > (suppress_location_wrappers): New decl. > > > (class auto_suppress_location_wrappers): New class. > > > > > > gcc/c-family/ChangeLog: > > > PR c++/43064 > > > PR c++/43486 > > > * c-common.c (unsafe_conversion_p): Strip any location wrapper. > > > (verify_tree): Handle location wrappers. > > > (c_common_truthvalue_conversion): Strip any location wrapper. > > > Handle CONST_DECL. > > > (fold_offsetof): Strip any location wrapper. > > > (complete_array_type): Likewise for initial_value. > > > (convert_vector_to_array_for_subscript): Call fold_for_warn on > > > the > > > index before checking for INTEGER_CST. > > > * c-pretty-print.c (c_pretty_printer::primary_expression): > > > Don't > > > print parentheses around location wrappers. > > > * c-warn.c (warn_logical_operator): Call fold_for_warn on > > > op_right > > > before checking for INTEGER_CST. > > > (warn_tautological_bitwise_comparison): Call > > > tree_strip_any_location_wrapper on lhs, rhs, and bitop's > > > operand > > > before checking for INTEGER_CST. > > > (readonly_error): Strip any location wrapper. > > > (warn_array_subscript_with_type_char): Strip location wrappers > > > before checking for INTEGER_CST. Use the location of the index > > > if > > > available. > > > > > > gcc/cp/ChangeLog: > > > PR c++/43064 > > > PR c++/43486 > > > * call.c (build_conditional_expr_1): Strip location wrappers > > > when > > > checking for CONST_DECL. > > > (conversion_null_warnings): Use location of "expr" if > > > available. > > > * class.c (fixed_type_or_null): Handle location wrappers. > > > * constexpr.c (potential_constant_expression_1): Likewise. > > > * cvt.c (ignore_overflows): Strip location wrappers when > > > checking for INTEGER_CST, and re-wrap the result if present. > > > (ocp_convert): Call fold_for_warn before checking for > > > INTEGER_CST. > > > * decl.c (reshape_init_r): Strip any location wrapper. > > > (undeduced_auto_decl): Likewise. > > > * decl2.c (grokbitfield): Likewise for width. > > > * expr.c (mark_discarded_use): Likewise for expr. > > > * init.c (build_aggr_init): Likewise before checking init for > > > DECL_P. > > > (warn_placement_new_too_small): Call fold_for_warn on adj > > > before > > > checking for CONSTANT_CLASS_P, and on nelts. Strip any > > > location > > > wrapper from op0 and on oper before checking for VAR_P. > > > * lambda.c (add_capture): Strip any location from initializer. > > > * name-lookup.c (handle_namespace_attrs): Strip any location > > > from > > > x before checking for STRING_CST. > > > * parser.c (cp_parser_primary_expression): Call > > > maybe_add_location_wrapper on numeric and string literals. > > > (cp_parser_postfix_expression): Strip any location wrapper when > > > checking for DECL_IS_BUILTIN_CONSTANT_P. > > > (cp_parser_binary_expression): Strip any location wrapper when > > > checking for DECL_P on the lhs. > > > (cp_parser_decltype_expr): Suppress location wrappers in the > > > id-expression. > > >
Re: [PING] Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486)
On 11/19/18 9:51 AM, David Malcolm wrote: > Ping, for these patches: > > [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486) > https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00304.html > > [PATCH 2/2] C++: improvements to binary operator diagnostics (PR c++/87504) > https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00303.html > > > Thanks > Dave > >> >> [1] I've split them up for ease of review; they could be reworked to >> be >> fully independent, but there's some churn in the results for >> -Wtautological-compare introduced by the 1st patch which the 2nd >> patch addresses. >> >> gcc/ChangeLog: >> PR c++/43064 >> PR c++/43486 >> * convert.c: Include "selftest.h". >> (preserve_any_location_wrapper): New function. >> (convert_to_pointer_maybe_fold): Update to handle location >> wrappers. >> (convert_to_real_maybe_fold): Likewise. >> (convert_to_integer_1): Handle location wrappers when checking >> for >> INTEGER_CST. >> (convert_to_integer_maybe_fold): Update to handle location >> wrappers. >> (convert_to_complex_maybe_fold): Likewise. >> (selftest::test_convert_to_integer_maybe_fold): New functions. >> (selftest::convert_c_tests): New function. >> * fold-const.c (operand_equal_p): Strip any location wrappers. >> * selftest-run-tests.c (selftest::run_tests): Call >> selftest::convert_c_tests. >> * selftest.h (selftest::convert_c_tests): New decl. >> * tree.c (tree_int_cst_equal): Strip any location wrappers. >> (maybe_wrap_with_location): Don't create wrappers if any >> auto_suppress_location_wrappers are active. >> (suppress_location_wrappers): New variable. >> * tree.h (CONSTANT_CLASS_OR_WRAPPER_P): New macro. >> (suppress_location_wrappers): New decl. >> (class auto_suppress_location_wrappers): New class. >> >> gcc/c-family/ChangeLog: >> PR c++/43064 >> PR c++/43486 >> * c-common.c (unsafe_conversion_p): Strip any location wrapper. >> (verify_tree): Handle location wrappers. >> (c_common_truthvalue_conversion): Strip any location wrapper. >> Handle CONST_DECL. >> (fold_offsetof): Strip any location wrapper. >> (complete_array_type): Likewise for initial_value. >> (convert_vector_to_array_for_subscript): Call fold_for_warn on >> the >> index before checking for INTEGER_CST. >> * c-pretty-print.c (c_pretty_printer::primary_expression): >> Don't >> print parentheses around location wrappers. >> * c-warn.c (warn_logical_operator): Call fold_for_warn on >> op_right >> before checking for INTEGER_CST. >> (warn_tautological_bitwise_comparison): Call >> tree_strip_any_location_wrapper on lhs, rhs, and bitop's >> operand >> before checking for INTEGER_CST. >> (readonly_error): Strip any location wrapper. >> (warn_array_subscript_with_type_char): Strip location wrappers >> before checking for INTEGER_CST. Use the location of the index >> if >> available. >> >> gcc/cp/ChangeLog: >> PR c++/43064 >> PR c++/43486 >> * call.c (build_conditional_expr_1): Strip location wrappers >> when >> checking for CONST_DECL. >> (conversion_null_warnings): Use location of "expr" if >> available. >> * class.c (fixed_type_or_null): Handle location wrappers. >> * constexpr.c (potential_constant_expression_1): Likewise. >> * cvt.c (ignore_overflows): Strip location wrappers when >> checking for INTEGER_CST, and re-wrap the result if present. >> (ocp_convert): Call fold_for_warn before checking for >> INTEGER_CST. >> * decl.c (reshape_init_r): Strip any location wrapper. >> (undeduced_auto_decl): Likewise. >> * decl2.c (grokbitfield): Likewise for width. >> * expr.c (mark_discarded_use): Likewise for expr. >> * init.c (build_aggr_init): Likewise before checking init for >> DECL_P. >> (warn_placement_new_too_small): Call fold_for_warn on adj >> before >> checking for CONSTANT_CLASS_P, and on nelts. Strip any >> location >> wrapper from op0 and on oper before checking for VAR_P. >> * lambda.c (add_capture): Strip any location from initializer. >> * name-lookup.c (handle_namespace_attrs): Strip any location >> from >> x before checking for STRING_CST. >> * parser.c (cp_parser_primary_expression): Call >> maybe_add_location_wrapper on numeric and string literals. >> (cp_parser_postfix_expression): Strip any location wrapper when >> checking for DECL_IS_BUILTIN_CONSTANT_P. >> (cp_parser_binary_expression): Strip any location wrapper when >> checking for DECL_P on the lhs. >> (cp_parser_decltype_expr): Suppress location wrappers in the >> id-expression. >> (cp_parser_mem_initializer): Add location wrappers to the >> parenthesized expression list. >> (cp_parser_template_parameter_list): Don't create wrapper nodes >>
[PING] Re: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486)
Ping, for these patches: [PATCH 1/2] C++: more location wrapper nodes (PR c++/43064, PR c++/43486) https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00304.html [PATCH 2/2] C++: improvements to binary operator diagnostics (PR c++/87504) https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00303.html Thanks Dave On Mon, 2018-11-05 at 15:31 -0500, David Malcolm wrote: > The C++ frontend gained various location wrapper nodes in r256448 > (GCC 8). > That patch: > https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00799.html > added wrapper nodes around all nodes with !CAN_HAVE_LOCATION_P for: > > * arguments at callsites, and for > > * typeid, alignof, sizeof, and offsetof. > > This is a followup to that patch, adding many more location wrappers > to the C++ frontend. It adds location wrappers for nodes with > !CAN_HAVE_LOCATION_P to: > > * all literal nodes (in cp_parser_primary_expression) > > * all id-expression nodes (in finish_id_expression), except within a > decltype. > > * all mem-initializer nodes within a mem-initializer-list > (in cp_parser_mem_initializer) > > However, the patch also adds some suppressions: regions in the parser > for which wrapper nodes will not be created: > > * within a template-parameter-list or template-argument-list (in > cp_parser_template_parameter_list and > cp_parser_template_argument_list > respectively), to avoid encoding the spelling location of the nodes > in types. For example, "array<10>" and "array<10>" are the same > type, > despite the fact that the two different "10" tokens are spelled in > different locations in the source. > > * within a gnu-style attribute (none of are handlers are set up to > cope > with location wrappers yet) > > * within various OpenMP clauses > > The patch enables various improvements to locations for bad > initializations, for -Wchar-subscripts, and enables various other > improvements in the followup patch. > > For example, given the followup buggy mem-initializer: > > class X { > X() : bad(42), > good(42) > { } > void* bad; > int good; > }; > > previously, our diagnostic was on the final close parenthesis of the > mem-initializer-list, leaving it unclear where the problem is: > > t.cc: In constructor 'X::X()': > t.cc:3:16: error: invalid conversion from 'int' to 'void*' [- > fpermissive] > 3 | good(42) > |^ > || > |int > > whereas with the patch we highlight which expression is bogus: > > t.cc: In constructor 'X::X()': > t.cc:2:13: error: invalid conversion from 'int' to 'void*' [- > fpermissive] > 2 | X() : bad(42), > | ^~ > | | > | int > > Similarly, the diagnostic for this bogus initialization: > > i.cc:1:44: error: initializer-string for array of chars is too long > [-fpermissive] > 1 | char test[3][4] = { "ok", "too long", "ok" }; > |^ > > is improved by the patch so that it indicates which string is too > long: > > i.cc:1:27: error: initializer-string for array of chars is too long > [-fpermissive] > 1 | char test[3][4] = { "ok", "too long", "ok" }; > | ^~ > > Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu, in > conjunction with the followup patch [1] > > I did some light performance testing, comparing release builds with > and > without the patch on kdecore.cc (preprocessed all-of-KDE) and a test > file > that includes all of the C++ stdlib (but does nothing) with it, in > both > cases compiling at -O3 -g. In both cases there was no significant > difference in the overall wallclock time for all of compilation: > > kdecode.c total wallclock time: > > http://chart.apis.google.com/chart?cht=lc=700x400=x,y,x,y > xr=1,58.26,61.79=FF,FF=control|experiment=58.2 > 6,61.79=t:59.55,60.26,60.53,60.35,60.17,60.27,59.26,60.01,60.21,6 > 0.23,60.1,60.2,60.12,60.48,60.32,60.18,60.01,60.01,60.04,59.96,60.1,6 > 0.11,60.21,60.36,60.08,60.1,60.16,60.01,60.21,60.15,60.12,60.09,59.96 > ,60.12,60.06,60.12,60.05,60.11,59.93,59.99|59.6,59.3,60.03,60.1,60.49 > ,60.35,60.03,60.1,59.87,60.39,60.1,59.96,60.19,60.45,59.97,59.91,60.0 > ,59.99,60.09,60.15,60.79,59.98,60.16,60.09,60.02,60.05,60.32,60.01,59 > .95,59.88,60.1,60.07,60.22,59.87,60.04,60.11,60.01,60.09,59.86,59.86& > chxl=0:|1|8|16|24|32|40|2:||Iteration|3:||Time+(secs)=Compilatio > n+of+kdecore.cc+at+-O3+with+-g+for+x86_64-pc-linux-gnu:+total:+wall > > cp-stdlib.cc total wallclock time: > > http://chart.apis.google.com/chart?cht=lc=700x400=x,y,x,y > xr=1,1.88,4.59=FF,FF=control|experiment=1.88,4 > .59=t:3.59,2.94,2.95,2.94,2.94,2.93,2.92,2.94,2.93,2.94,2.94,2.88 > ,2.94,2.9,2.94,2.9,2.94,2.93,2.94,2.93,2.95,2.93,2.9,2.9,2.94,2.99,2. > 95,3.0,2.94,3.0,2.94,2.99,2.95,2.95,2.9,2.99,2.94,2.99,2.94,2.96|3.54 > ,2.92,2.93,2.88,2.94,2.92,2.93,2.92,2.9,2.93,2.89,2.93,2.9,2.93,2.89, >