[committed] jit: document function pointers

2017-09-28 Thread David Malcolm
/function-pointers.rst @@ -0,0 +1,80 @@ +.. Copyright (C) 2017 Free Software Foundation, Inc. + Originally contributed by David Malcolm + + This is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software

Re: [PING][patch] PR81794: have "would be stringified in traditional C" warning in libcpp/macro.c be controlled by -Wtraditional

2017-09-29 Thread David Malcolm
On Sun, 2017-09-17 at 20:00 -0400, Eric Gallager wrote: > Attached is a version of > https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00481.html that > contains > a combination of both the fix and the testcase update, as requested > in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81794#c2 > > I had

Re: [PING][patch] PR81794: have "would be stringified in traditional C" warning in libcpp/macro.c be controlled by -Wtraditional

2017-09-29 Thread David Malcolm
On Fri, 2017-09-29 at 11:15 -0400, David Malcolm wrote: > On Sun, 2017-09-17 at 20:00 -0400, Eric Gallager wrote: > > Attached is a version of > > https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00481.html that > > contains > > a combination of both the fix and the te

[PATCH] C: underline parameters in mismatching function calls

2017-10-02 Thread David Malcolm
In r253096 ("C++: underline parameters in mismatching function calls" aka 5d78d423a5f7a1d135c7bb678e82007678d1313c https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01546.html ) I updated the C++ FE's handling of mismatched types in function calls so that it underlines the pertinent param of th

Re: [PATCH] C: underline parameters in mismatching function calls

2017-10-02 Thread David Malcolm
On Mon, 2017-10-02 at 16:22 -0400, Paul Koning wrote: > > On Oct 2, 2017, at 4:05 PM, David Malcolm > > wrote: > > > > ... > > the C FE currently emits (trunk): > > > > test.c: In function 'caller': > > test.c:5:25: warning: passing

[committed] jit: implement gcc_jit_context_new_rvalue_from_vector

2017-10-04 Thread David Malcolm
This patch implements a new API entrypoint: /* Build a vector rvalue from an array of elements. "vec_type" should be a vector type, created using gcc_jit_type_get_vector. This API entrypoint was added in LIBGCCJIT_ABI_10; you can test for its presence using #ifdef LIBGCCJIT_HAVE_gc

[PATCH 2/2] C/C++: add fix-it hints for various missing symbols (v3)

2017-10-05 Thread David Malcolm
Here's a slight update to this patch, since v2 was made invalid by r253411 ("C: underline parameters in mismatching function calls"). Both v2 and r253411 added code to c-parser.c/h to track the location_t of the last consumed token (although I somehow managed to name the new field in c_parser dif

[PATCH] Add selftest for vec::reverse

2017-10-06 Thread David Malcolm
Martin: I noticed that your switch expansion patch added a vec::reverse () method. Here's a proposed selftest for it, mostly to verify that it handles even vs odd lengths (which it does). Only lightly tested; hope this is useful. Dave gcc/ChangeLog: * vec.c (selftest::test_reverse): Ne

Re: [PATCH] Implement smart multiple switch expansion algorithms.

2017-10-06 Thread David Malcolm
On Fri, 2017-10-06 at 14:25 +0200, Martin Liška wrote: > Hello. > > As presented at this year's Cauldron, I rewrote current switch > expansion to support > multiple algorithms (jump table and bit-test) that can be used just > for a fraction > of cases. Balanced decision tree is built on top of tha

Re: [PATCH][mingw] Enable colorized diagnostics

2017-10-09 Thread David Malcolm
On Mon, 2017-10-09 at 11:01 +, JonY wrote: > On 10/08/2017 11:39 AM, Liu Hao wrote: > > On 2017/9/28 4:09, Joseph Myers wrote: > > > On Thu, 28 Sep 2017, Liu Hao wrote: > > > > > > > Colorized diagnostics used to be disabled for MinGW targets (on > > > > which > > > > the macro `_WIN32` is def

PING: Re: [PATCH 1/2] C++: avoid partial duplicate implementation of cp_parser_error

2017-10-11 Thread David Malcolm
Ping On Tue, 2017-09-26 at 09:56 -0400, David Malcolm wrote: > In r251026 (aka 3fe34694f0990d1d649711ede0326497f8a849dc, > "C/C++: show pertinent open token when missing a close token") > I copied part of cp_parser_error into cp_parser_required_error, > leading to duplicat

PING Re: [PATCH 2/2] C/C++: add fix-it hints for various missing symbols (v3)

2017-10-11 Thread David Malcolm
Ping On Thu, 2017-10-05 at 12:08 -0400, David Malcolm wrote: > Here's a slight update to this patch, since v2 was made invalid by > r253411 ("C: underline parameters in mismatching function calls"). > > Both v2 and r253411 added code to c-parser.c/h to track the

PING Re: [PATCH] C++: show location of problematic extern "C" specifications

2017-10-11 Thread David Malcolm
Ping On Tue, 2017-09-26 at 15:27 -0400, David Malcolm wrote: > There are a few places where the C++ FE will complain when attempting > to do things within an extern "C" linkage specifier. > > I've run into problems where it wasn't clear where the pertinent >

Re: [PATCH 1/2] add unique_ptr header

2017-10-11 Thread David Malcolm
On Sat, 2017-08-05 at 01:39 -0400, Trevor Saunders wrote: > On Fri, Aug 04, 2017 at 08:55:50PM +0100, Jonathan Wakely wrote: > > On 01/08/17 23:09 -0400, Trevor Saunders wrote: > > > aiui C++03 is C++98 with a few additions to the stl. > > > > Again, STL != C++ Standard Library. > > > > C++03 mad

Re: [PATCH 00/17] RFC: New source-location representation; Language Server Protocol

2017-10-11 Thread David Malcolm
On Mon, 2017-07-24 at 16:04 -0400, David Malcolm wrote: > We currently capture some source location information in the > frontends, but there are many kinds of source entity for which we > *don't* > retain the location information after the initial parse. > > For example,

[PATCH] C: detect more missing semicolons (PR c/7356)

2017-10-11 Thread David Malcolm
[This patch assumes the two patches here: https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00274.html ] c_parser_declaration_or_fndef has logic for parsing what might be either a declaration or a function definition. This patch adds a test to detect cases where a semicolon would have terminated the

Re: [PATCH] C++: show location of problematic extern "C" specifications

2017-10-11 Thread David Malcolm
On Wed, 2017-10-11 at 15:51 -0400, Jason Merrill wrote: > On Tue, Sep 26, 2017 at 3:27 PM, David Malcolm > wrote: > > * cp-tree.h (struct saved_scope): Add "location" field. > > saved_scope seems like the wrong place for this; it's only > interesting

Re: [PATCH] C++: show location of problematic extern "C" specifications

2017-10-11 Thread David Malcolm
On Wed, 2017-10-11 at 17:20 -0400, Jason Merrill wrote: > On Wed, Oct 11, 2017 at 4:50 PM, David Malcolm > wrote: > > On Wed, 2017-10-11 at 15:51 -0400, Jason Merrill wrote: > > > On Tue, Sep 26, 2017 at 3:27 PM, David Malcolm > > om> > > > wrote: > >

Re: [PATCH 1/2] C++: avoid partial duplicate implementation of cp_parser_error

2017-10-12 Thread David Malcolm
On Wed, 2017-10-11 at 17:18 -0400, Jason Merrill wrote: > On Tue, Sep 26, 2017 at 9:56 AM, David Malcolm > wrote: > > In r251026 (aka 3fe34694f0990d1d649711ede0326497f8a849dc, > > "C/C++: show pertinent open token when missing a close token") > > I c

Re: [PATCH] docs: Add __GIMPLE and __RTL to the "Internals" doc

2017-01-27 Thread David Malcolm
On Fri, 2017-01-27 at 13:20 +0100, Richard Biener wrote: > On Thu, Jan 26, 2017 at 5:52 PM, David Malcolm > wrote: > > The "internals" documentation has a "Testsuites" chapter; this > > patch > > adds some notes to it, describing the __GIMPL

[wwwdocs] Add -fdiagnostics-generate-patch to changes.html

2017-01-27 Thread David Malcolm
The following patch to the website adds -fdiagnostics-generate-patch to gcc 7's changes.html. It consolidates the documentation with that for -fdiagnostics-parseable -fixits, so that they can share an example. Successfully validated. OK to commit?Index: htdocs/gcc-7/changes.html

[PATCH] Fix ICE with spelling hints within explicit namespace aliases (PR c++/79298)

2017-01-31 Thread David Malcolm
PR c++/79298 reports a segfault when handling a qualified name lookup error, where consider_binding_level dereferences a NULL cp_binding_level *. The root cause is that suggest_alternative_in_explicit_scope assumes that NAMESPACE_LEVEL (scope) is non-NULL, but this can be NULL for namespace aliase

[committed] Prevent ICEs due to bogus substring locations (PR preprocessor/79210)

2017-01-31 Thread David Malcolm
PR preprocessor/79210 identifies a ICE due to a failing assertion within get_substring_ranges_for_loc when re-lexing strings, due to the wrong location being used for a string token. The root cause of the bogus string location is due to (A) a bogus location being generated when pasting together tw

[PATCH] diagnostics: fix end-points of ranges within macros (PR c++/79300)

2017-02-02 Thread David Malcolm
PR c++/79300 identifies an issue in which diagnostics_show_locus prints the wrong end-point for a range within a macro: assert ((p + val_size) - buf == encoded_len); ~^~~~ as opposed to: assert ((p + val_size) - buf == encoded_len); ~~~

[wwwdocs] Mention GIMPLE and RTL frontends in changes.html

2017-02-02 Thread David Malcolm
This patch to the website moves the section about the selftest suite to the bottom of "Other significant improvements" section, and rewrites it to also cover the GIMPLE and RTL "frontends", and tries to couch these changes in terms of the benefit to the end-user (i.e. a more reliable compiler). Va

Re: [wwwdocs] Mention GIMPLE and RTL frontends in changes.html

2017-02-03 Thread David Malcolm
On Fri, 2017-02-03 at 08:09 +0100, Gerald Pfeifer wrote: > On Thu, 2 Feb 2017, David Malcolm wrote: > > This patch to the website moves the section about the selftest > > suite to > > the bottom of "Other significant improvements" section, and > > rewrites it

[wwwdocs] Uncomment link to gcc-7/porting_to.html

2017-02-03 Thread David Malcolm
We now have a porting_to.html for gcc 7, so this patch uncomments the link to it on gcc 7's changes page. Validates. I took the liberty of committing this, under the "obvious" rule. Index: htdocs/gcc-7/changes.html === RCS file: /cvs

Re: [PATCH] diagnostics: fix end-points of ranges within macros (PR c++/79300)

2017-02-03 Thread David Malcolm
On Fri, 2017-02-03 at 13:28 -0700, Jeff Law wrote: > On 02/02/2017 01:53 PM, David Malcolm wrote: > > PR c++/79300 identifies an issue in which diagnostics_show_locus > > prints the wrong end-point for a range within a macro: > > > >assert ((p + val

Re: [PATCH] Fix spellcheck test data

2017-02-13 Thread David Malcolm
On Mon, 2017-02-13 at 20:47 +0100, Jakub Jelinek wrote: > Hi! > > Not really sure about this, but I'd expect if you meant to write > "foofood", > you'd have written it that way and not > "foo" > "food", > Passes -fself-test either way, bootstrapped/regtested on x86_64-linux > and > i686-linu

[PATCH 2/7] aarch64.c: tweaks to quoting in error messages (PR target/79925)

2017-03-09 Thread David Malcolm
gcc/ChangeLog: PR target/79925 * config/aarch64/aarch64.c (aarch64_validate_mcpu): Quote the full command-line argument, rather than just "str". (aarch64_validate_march): Likewise. (aarch64_validate_mtune): Likewise. --- gcc/config/aarch64/aarch64.c | 10 +++

[PATCH 0/7] Various i18n fixes (and questions)

2017-03-09 Thread David Malcolm
y commit regenerated copies of the .pot files; do we have a policy about this? Thanks; sorry if I'm missing something obvious here. Dave David Malcolm (7): Add missing punctuation to message (PR driver/79875) aarch64.c: tweaks to quoting in error messages (PR target/79925) Remove trai

[PATCH 1/7] Add missing punctuation to message (PR driver/79875)

2017-03-09 Thread David Malcolm
gcc/ChangeLog: PR driver/79875 * opts.c (parse_sanitizer_options): Add missing question mark to "did you mean" message. --- gcc/opts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/opts.c b/gcc/opts.c index 8274fab..6ea57af 100644 --- a/gcc/opts.c

[PATCH 3/7] Remove trailing period from various diagnostic messages (PR translation/79923)

2017-03-09 Thread David Malcolm
gcc/ChangeLog: PR translation/79923 * auto-profile.c (get_combined_location): Convert leading character of diagnostics to lower case and remove trailing period. (read_profile): Likewise for various diagnostics. * config/arm/arm-builtins.c (arm_expand_builtin)

[PATCH 7/7] Simplify uses of "%<%s%>" to "%qs" (PR translation/79848)

2017-03-09 Thread David Malcolm
PR translation/79848 requests that uses of "%<%s%>" in diagnostic messages be simplified to "%qs", presumably to make it easier for translators to deal with them. This patch does this for all such strings found in the source tree. gcc/c-family/ChangeLog: PR translation/79848 * c-f

[PATCH 5/7] fortran: remove trailing exclamation mark from various diagnostics (PR fortran/79852)

2017-03-09 Thread David Malcolm
PR fortran/79852 reports various Fortran diagnostics that have a trailing exclamation mark in their messages. Is there a Fortran-specific convention here? Otherwise, this patch removes the trailing exclamation marks. gcc/fortran/ChangeLog: PR fortran/79852 * bbt.c (insert): Remov

[PATCH 6/7] i386.c: make "sorry" message more amenable to translation (PR target/79926)

2017-03-09 Thread David Malcolm
PR target/79926 notes that in: sorry ("%s instructions aren't allowed in %s service routine", isa, (cfun->machine->func_type == TYPE_EXCEPTION ? "exception" : "interrupt")); the text from the second %s won't be translated, but should be. This patch reworks the dia

[PATCH 4/7] c-indentation.c: workaround xgettext limitation (PR c/79921)

2017-03-09 Thread David Malcolm
xgettext wasn't locating the message: ("...this statement, but the latter is misleadingly indented" " as if it were guarded by the %qs"), when building gcc.pot, and so this message was not being translated. It appears the root cause is the parens around the concatenated literals

[PATCH] Fix out-of-bounds write in RTL function reader (PR bootstrap/79952)

2017-03-09 Thread David Malcolm
PR bootstrap/79952 identifies a crash that can occur when running -fself-test. The root cause is an out-of-bounds memory write in the RTL dump reader when handling SYMBOL_REFs with SYMBOL_FLAG_HAS_BLOCK_INFO set. Such SYMBOL_REFs are normally created by varasm.c:create_block_symbol, which has:

Re: [PATCH] Fix out-of-bounds write in RTL function reader (PR bootstrap/79952)

2017-03-10 Thread David Malcolm
On Fri, 2017-03-10 at 00:36 +0100, Bernd Schmidt wrote: > On 03/09/2017 08:28 PM, David Malcolm wrote: > > The root cause is an out-of-bounds memory write in the RTL dump > > reader when handling SYMBOL_REFs with SYMBOL_FLAG_HAS_BLOCK_INFO > > set. > > > > Such SY

Re: [PATCH 1/7] Add missing punctuation to message (PR driver/79875)

2017-03-10 Thread David Malcolm
On Thu, 2017-03-09 at 21:12 -0700, Martin Sebor wrote: > On 03/09/2017 10:45 AM, David Malcolm wrote: > > gcc/ChangeLog: > > PR driver/79875 > > * opts.c (parse_sanitizer_options): Add missing question mark > > to > > "did you mean" message.

Re: [PATCH 3/7] Remove trailing period from various diagnostic messages (PR translation/79923)

2017-03-10 Thread David Malcolm
On Fri, 2017-03-10 at 09:24 +, Kyrill Tkachov wrote: > On 10/03/17 06:24, Jakub Jelinek wrote: > > On Thu, Mar 09, 2017 at 12:45:25PM -0500, David Malcolm wrote: > > > gcc/ChangeLog: > > > PR translation/79923 > > > * auto-profile.c (get

[PATCH 6/7 v2] i386.c: make "sorry" message more amenable to translation (PR target/79926)

2017-03-10 Thread David Malcolm
On Fri, 2017-03-10 at 07:33 +0100, Jakub Jelinek wrote: > On Thu, Mar 09, 2017 at 12:45:28PM -0500, David Malcolm wrote: > > PR target/79926 notes that in: > > > > sorry ("%s instructions aren't allowed in %s service routine", > >isa, (

[PATCH] omp-offload.c: translation fixes (PR translation/80001)

2017-03-14 Thread David Malcolm
Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk? (either now in stage 4, or for next stage1?) gcc/ChangeLog: PR translation/80001 * omp-offload.c (oacc_loop_fixed_partitions): Make diagnostics more amenable to translation. (oacc_loop_auto_par

[PATCH] Fix location of typeid() (PR c++/80014)

2017-03-14 Thread David Malcolm
PR c++/80014 reports an issue where no caret is printed when issuing an error for this bogus code: !typeid(void); Root cause is that we're not setting up the location for the cp_expr for the typeid expression, so that !typeid(void) has start == caret at the '!', but finish == UNKNOWN_LOCATION,

[PATCH] Fix location of sizeof/alignof (PR c++/80016)

2017-03-14 Thread David Malcolm
PR c++/80016 reports an issue with bizarre underlined range for a complicated expression. The root cause for the incorrect *starting* location of that range is that alignof and sizeof expressions currently have start == finish == caret at the opening parenthesis of the expression. This patch fixe

Re: [PATCH 0/3] Introduce internal_error_cont and exclude it from pot files

2017-03-15 Thread David Malcolm
On Wed, 2017-03-15 at 14:53 +0100, Martin Liška wrote: > Hello. > > Following small series exclude some strings from pot files via > introduction of internal_error_cont function. > > Patch can bootstrap and survives regression tests. > > (Sorry for broken threading because my cover letter was re

[PATCH 2/2] filter_params.py: GTY fix and other cleanups

2017-03-16 Thread David Malcolm
This patch updates the removal of GTY tags in the Doxygen support script so that it can cope with multiline tags, such as that for class symtab_node. It also makes some tweaks to regexes to make them more idiomatic for Python (and stripping some whitespace). Tested via unit test suite, and by run

[PATCH 1/2] Port Doxygen support script from Perl to Python; add unittests

2017-03-16 Thread David Malcolm
It's possible to run GCC's sources through Doxygen by setting INPUT_FILTER = contrib/filter_gcc_for_doxygen within contrib/gcc.doxy and invoking doxygen on the latter file. The script filters out various preprocessor constructs from GCC sources before Doxygen tries to parse them

Re: [PATCH, fortran, v3] Use Levenshtein spelling suggestions in Fortran FE

2016-03-07 Thread David Malcolm
On Sat, 2016-03-05 at 23:46 +0100, Bernhard Reutner-Fischer wrote: [...] > diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c > index 405bae0..72ed311 100644 > --- a/gcc/fortran/misc.c > +++ b/gcc/fortran/misc.c [...] > @@ -274,3 +275,41 @@ get_c_kind(const char *c_kind_name,teropKind_tki > nds

[PATCH 1/2] PR c++/70105: Defer location expansion until diagnostic_show_locus

2016-03-09 Thread David Malcolm
This patch is enabling work for the fix for PR c++/70105, so that patch 2 in the kit can make use of location_t values when sanitizing underlines. This is an updated version of "[PATCH 1/3] Delay location expansion within rich_location until printing" https://gcc.gnu.org/ml/gcc-patches/2015-12

[PATCH 2/2] PR c++/70105: prevent nonsensical underline spew for macro expansions

2016-03-09 Thread David Malcolm
ChangeLog (revision 234088) @@ -2,6 +2,13 @@ PR c/68473 PR c++/70105 + * diagnostic-show-locus.c (compatible_locations_p): New function. + (layout::layout): Sanitize ranges using compatible_locations_p. + +2016-03-09 David Malcolm + + PR c/68473 + PR c++/70105 * diagnostic-show-locus.c (layou

[committed 1/2] Wmisleading-indentation: add reproducer for PR c/70085

2016-03-11 Thread David Malcolm
PR c/70085 reported a false-positive from -Wmisleading-indentation. The warning was fixed by the fix for PR c/68187 (r233972), but it seems worth capturing the reproducer for PR c/70085 as an additional test case, as it's slightly different to those seen in PR c/68187. Committed to trunk (as "obv

[committed 2/2] Wmisleading-indentation.c: add more test cases for PR c/68187

2016-03-11 Thread David Malcolm
I posted a series of tests here: https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00271.html as part of the discussion around PR c/68187. I've cleaned them into DejaGnu form and added them to the existing test file; they add 16 PASS results to gcc.sum and 48 PASS results to g++.sum. Committed to t

Re: Fix 69650, bogus line numbers from libcpp

2016-03-11 Thread David Malcolm
On Thu, 2016-03-10 at 09:40 +0100, Bernd Schmidt wrote: > This is a case where bogus #line directives can confuse libcpp into > producing nonsensical line numbers, even leading to a crash later on > in LTO. > > The following patch moves the test earlier to a point where we can > more > easily re

[committed] PR c/70264: fix crash in compatible_locations_p with BUILTINS_LOCATION

2016-03-19 Thread David Malcolm
In r234088 my fix for PR c++/70105 didn't allow for the possibility that when comparing a pair of macro expansion histories that one of the macros in the history might not be located within a line-map, and PR c/70264 reports a crash due to encountering BUILTINS_LOCATION within the traversal. Fixed

[PATCH] PR c/70281: C FE: fix uninitialized range for __builtin_types_compatible_p

2016-03-19 Thread David Malcolm
PR c/70281 reports another case where Valgrind identified an uninitialized src_range in a c_expr in the C frontend, this time in the parsing of __builtin_types_compatible_p. For gcc 7 I hope to fix this more robustly (via poisoning the values in a c_expr ctor), but for now, this patch fixes the sp

Re: [RFA][PR rtl-optimization/70263] Fix creation of new REG_EQUIV notes

2016-03-19 Thread David Malcolm
On Fri, 2016-03-18 at 13:20 -0600, Jeff Law wrote: > On 03/18/2016 01:16 PM, Bernd Schmidt wrote: > > On 03/18/2016 08:14 PM, Jeff Law wrote: > > > I also added a blurb to the dump file when we create these > > > equivalences > > > and included a test to verify the code fires. I verified it > > >

Re: Fix 69650, bogus line numbers from libcpp

2016-03-21 Thread David Malcolm
On Mon, 2016-03-14 at 14:20 +0100, Bernd Schmidt wrote: > On 03/11/2016 11:09 PM, David Malcolm wrote: > > > + cpp_error (pfile, CPP_DL_ERROR, > > > + "file \"%s\" l

Re: [PATCH] PR c/69993: improvements to wording of -Wmisleading-indentation

2016-03-22 Thread David Malcolm
On Tue, 2016-03-01 at 20:18 +0100, Richard Biener wrote: > On March 1, 2016 7:51:01 PM GMT+01:00, David Malcolm < > dmalc...@redhat.com> wrote: > > The wording of our output from -Wmisleading-indentation is rather > > confusing, as noted by Reddit user "sysop073"

[committed] [wwwdocs] PR c/69993: update wording of -Wmisleading-indentation on website

2016-03-22 Thread David Malcolm
On Tue, 2016-03-22 at 10:28 -0400, David Malcolm wrote: > On Tue, 2016-03-01 at 20:18 +0100, Richard Biener wrote: > > On March 1, 2016 7:51:01 PM GMT+01:00, David Malcolm < > > dmalc...@redhat.com> wrote: > > > The wording of our output from -Wmisleading-indentation

Re: PATCH for c++/70639 (ICE-on-valid with -Wmisleading-indentation and switch)

2016-04-13 Thread David Malcolm
On Wed, 2016-04-13 at 17:31 +0200, Marek Polacek wrote: > This is an ICE-on-valid-though-weirdo (TM) problem. We were trying > to warn > about misleading indentation for a switch statement, but > guard_tinfo_to_string > doesn't know what to do with RID_SWITCH and so a crash ensues. > Rather than

Re: [PATCH, fortran, v3] Use Levenshtein spelling suggestions in Fortran FE

2016-04-25 Thread David Malcolm
On Sat, 2016-04-23 at 20:21 +0200, Bernhard Reutner-Fischer wrote: > On March 7, 2016 3:57:16 PM GMT+01:00, David Malcolm < > dmalc...@redhat.com> wrote: > > On Sat, 2016-03-05 at 23:46 +0100, Bernhard Reutner-Fischer wrote: > > [...] > > > > > diff --git a/

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-08 Thread David Malcolm
On Thu, 2016-09-08 at 13:03 -0600, Martin Sebor wrote: > Attached is another update to the patch to address the last round > of comments and suggestions, most notably to: > > * implement the checking of the implementation limit of 4,095 on > the output of a single directive to allow for th

[PATCH 2/9] Add selftest::read_file

2016-09-08 Thread David Malcolm
This is used later in the kit by the selftests for final.c gcc/ChangeLog: * selftest.c (selftest::read_file): New function. (selftest::test_read_file): New function. (selftest::selftest_c_tests): Call test_read_file. * selftest.h (selftest::read_file): New decl. ---

[PATCH 3/9] selftest.h: add temp_override fixture

2016-09-08 Thread David Malcolm
We have a lot of global state in our code. Ideally we'd reduce the amount of such global state, but a prerequisite for sane refactoring is having automated testing in place to ensure that the refactoring doesn't break anything. However, the global state itself makes it hard to write such automate

[PATCH 7/9] combine.c selftests

2016-09-08 Thread David Malcolm
gcc/ChangeLog: * combine.c: Include selftest.h and selftest-rtl.h. (try_combine): Add assertion on this_basic_block. (class selftest::combine_test): New subclass of selftest::tl_dump_test. (selftest::combine_test::combine_test): New ctor. (selftest::t

[PATCH 9/9] cse.c selftests

2016-09-08 Thread David Malcolm
This patch uses rtl_dump_test to start building out a test suite for cse. I attempted to create a reproducer for PR 71779; however I'm not yet able to replicate the bogus cse reported there via the test case. gcc/ChangeLog: * cse.c: Include selftest.h and selftest-rtl.h. (selftest

[PATCH 1/9] Introduce class rtx_reader

2016-09-08 Thread David Malcolm
Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call.

[PATCH 8/9] final.c selftests

2016-09-08 Thread David Malcolm
gcc/ChangeLog: * final.c: Include selftest.h and selftest-rtl.h. (class selftest::temp_asm_out): New subclass of selftest::named_temp_file. (selftest::temp_asm_out::temp_asm_out): New ctor. (selftest::temp_asm_out::~temp_asm_out): New dtor. (class sel

[PATCH 0/9] RFC: selftests based on RTL dumps

2016-09-08 Thread David Malcolm
icate). Posting for comment (doesn't fully bootstrap yet due to a few stray warnings). Patches 1-4 could probably be applicable even without the rest of the kit. Thoughts? David Malcolm (9): Introduce class rtx_reader Add selftest::read_file selftest.h: add temp_override fixture Ex

[PATCH 4/9] Expose forcibly_ggc_collect and run it after all selftests

2016-09-08 Thread David Malcolm
Force a GC at the end of the selftests, to shake out GC-related issues. For example, if any GC-managed items have buggy (or missing) finalizers, this last collection will ensure that things that were failed to be finalized can be detected by valgrind. gcc/ChangeLog: * ggc-tests.c (forcibl

[PATCH 6/9] df selftests

2016-09-08 Thread David Malcolm
gcc/ChangeLog: * df-core.c: Include selftest.h and selftest-rtl.h. (selftest::dataflow_test::dataflow_test): New ctor. (selftest::dataflow_test::~dataflow_test): New dtor. (selftest::test_df_single_set): New function. (selftest::df_core_c_tests): New function

[PATCH 5/9] Introduce class function_reader

2016-09-08 Thread David Malcolm
This patch generalizes the RTL-reading capabilities so that they can be run on the host as well as the build machine. The available rtx in rtl.def changes dramatically between these two configurations, so a fair amount of #ifdef GENERATOR_FILE is required to express this. This patch introduces a f

Re: [PATCH 0/4] (v2) Generating patches from fix-it hints

2016-09-12 Thread David Malcolm
On Fri, 2016-09-09 at 16:56 -0600, Jeff Law wrote: > On 08/24/2016 07:13 PM, David Malcolm wrote: > > Here's a much less ambitious version of the patch kit, which > > eliminates any attempt to write to the user's source > > code (getting rid of edit_context::apply

Re: [PATCH 0/9] RFC: selftests based on RTL dumps

2016-09-12 Thread David Malcolm
On Mon, 2016-09-12 at 16:10 +0200, Bernd Schmidt wrote: > In general, it's functionality that I would very much like to have > (although maybe it's less useful these days now that the rtl side is > fairly static). I think there's not much sense looking too deeply at > the > individual patches ye

[committed] Simplify edited_file::print_diff

2016-09-12 Thread David Malcolm
Whilst working on support for fix-it hints containing newlines (e.g. "break;\n" for -Wfallthrough), I noticed that edited_file::print_diff could be simplified by breaking it up into subroutines. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. Committed to trunk as r240103. gcc/ChangeLo

[committed] fix-it hints: insert_before vs insert_after

2016-09-13 Thread David Malcolm
The API for adding "insert text" fix-it hints was unclear about exactly where the text should be inserted relative to the given insertion point. This patch clarifies things by renaming the pertinent methods from richloc.add_fixit_insert to richloc.add_fixit_insert_before and adding: richloc.

[PATCH] fix-it hints for warn_uninit

2016-09-13 Thread David Malcolm
We warn about uses of uninitialized variables from the middle end, via warn_uninit. This patch adds the ability for such warnings to contain fix-it hints, showing the user how to zero-initialize the relevant variables. Naturally this is highly frontend-dependent, so the patch adds a langhook: LANG

Re: [PATCH] C: fixits for modernizing structure member designators

2016-09-15 Thread David Malcolm
On Thu, 2016-09-15 at 11:27 -0600, Jeff Law wrote: > On 08/30/2016 08:38 AM, David Malcolm wrote: > > This patch adds fix-it hints to our warning for old-style structure > > member designators, showing how to modernize them to C99 form. > > > > For example: > >

[committed] fix-it hints can't contain newlines (yet)

2016-09-15 Thread David Malcolm
I hope to implement newline support within fix-it hints at some point, but currently it's not supported, and leads to misleading diagnostic output, so for now, fail gracefully. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. Committed to trunk as r240169. gcc/ChangeLog: * diagn

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-16 Thread David Malcolm
On Sun, 2016-09-11 at 20:03 -0600, Martin Sebor wrote: > On 09/08/2016 04:10 PM, Joseph Myers wrote: > > On Thu, 8 Sep 2016, Martin Sebor wrote: > > > > > diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in > > > index da133a4..4607495 100644 > > > --- a/gcc/doc/tm.texi.in > > > +++ b/gcc/doc/tm.

Re: [PATCH 0/9] RFC: selftests based on RTL dumps

2016-09-16 Thread David Malcolm
On Fri, 2016-09-16 at 14:00 -0600, Jeff Law wrote: > On 09/14/2016 02:37 AM, Richard Biener wrote: > > > > Note that while the "snippets" may largely work (not sure how many > > you tried to come up with) I see the issue that a lot of RTL "unit > > tests" would need some trees set up, like to prop

Re: [PATCH 9/9] cse.c selftests

2016-09-16 Thread David Malcolm
On Fri, 2016-09-16 at 14:26 -0600, Jeff Law wrote: > On 09/08/2016 06:30 PM, David Malcolm wrote: > > This patch uses rtl_dump_test to start building out a test suite > > for cse. > > > > I attempted to create a reproducer for PR 71779; however I'm not > > y

Re: [PATCH 0/9] RFC: selftests based on RTL dumps

2016-09-16 Thread David Malcolm
On Fri, 2016-09-16 at 14:05 -0600, Jeff Law wrote: > On 09/13/2016 05:15 AM, Bernd Schmidt wrote: > > > > > > Note that the loader now resets INSN_CODE to -1, regardless of > > > the > > > actual code passed in, to force re-recognition, and to isolate > > > the > > > dumps somewhat from changes to

Re: [PATCH 6/9] df selftests

2016-09-16 Thread David Malcolm
On Fri, 2016-09-16 at 14:34 -0600, Jeff Law wrote: > On 09/08/2016 06:30 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * df-core.c: Include selftest.h and selftest-rtl.h. > > (selftest::dataflow_test::dataflow_test): New ctor. > > (selftest::dataflow_test

Re: [PATCH 7/9] combine.c selftests

2016-09-16 Thread David Malcolm
On Fri, 2016-09-16 at 14:40 -0600, Jeff Law wrote: > On 09/08/2016 06:30 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * combine.c: Include selftest.h and selftest-rtl.h. > > (try_combine): Add assertion on this_basic_block. > > (class selftest::com

Re: [PATCH 8/9] final.c selftests

2016-09-16 Thread David Malcolm
On Fri, 2016-09-16 at 14:45 -0600, Jeff Law wrote: > On 09/08/2016 06:30 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * final.c: Include selftest.h and selftest-rtl.h. > > (class selftest::temp_asm_out): New subclass of > > selftest::named_temp_file. >

Re: [PATCH 5/9] Introduce class function_reader

2016-09-16 Thread David Malcolm
On Fri, 2016-09-16 at 15:28 -0600, Jeff Law wrote: > On 09/08/2016 06:30 PM, David Malcolm wrote: > > This patch generalizes the RTL-reading capabilities so that they > > can be run on the host as well as the build machine. > > The available rtx in rtl.def changes drama

Re: PR35503 - warn for restrict pointer

2016-09-19 Thread David Malcolm
On Mon, 2016-09-19 at 14:21 -0400, Jason Merrill wrote: > On Sun, Sep 18, 2016 at 1:16 PM, Prathamesh Kulkarni > wrote: > > Sorry for late response. In the attached patch, I removed obstack > > building on fmt, and used pp_format for formatting arg_positions by > > adding specifier %I (name > > ch

Re: PR35503 - warn for restrict pointer

2016-09-19 Thread David Malcolm
On Sun, 2016-09-18 at 22:46 +0530, Prathamesh Kulkarni wrote: > On 2 September 2016 at 23:14, David Malcolm > wrote: > > On Thu, 2016-09-01 at 14:55 +0530, Prathamesh Kulkarni wrote: > > > > [...] > > > > > The attached version passes bootstrap+test on

Register numbers in RTL dumps (was Re: [PATCH 0/9] RFC: selftests based on RTL dumps)

2016-09-20 Thread David Malcolm
On Mon, 2016-09-19 at 11:35 -0600, Jeff Law wrote: > On 09/16/2016 03:27 PM, David Malcolm wrote: > > > We should also twiddle how we represent registers in the dumps. > > > Identifying hard regs by name (so we can map back to a hard reg > > > if > > > t

Re: Register numbers in RTL dumps (was Re: [PATCH 0/9] RFC: selftests based on RTL dumps)

2016-09-20 Thread David Malcolm
On Tue, 2016-09-20 at 09:20 -0600, Jeff Law wrote: > On 09/20/2016 08:34 AM, Bernd Schmidt wrote: > > On 09/20/2016 04:32 PM, David Malcolm wrote: > > > > > > To summarize so far: you want every pseudo to have its regno > > > dumped > > > with a '

Re: [PATCH] - improve sprintf buffer overflow detection (middle-end/49905)

2016-09-20 Thread David Malcolm
On Tue, 2016-09-20 at 13:35 -0600, Martin Sebor wrote: [...] > > > +#if 0 > ... > > > +#else > ... > > > +#endif > > Please remove the #if 0'd code. > > Sorry about that. This was left over from my effort to persuade > the substring_loc class to underline just the last quote of the > format str

[PATCH, v2] Introduce class rtx_reader

2016-09-21 Thread David Malcolm
On Fri, 2016-09-16 at 16:04 -0600, Jeff Law wrote: > On 09/08/2016 06:30 PM, David Malcolm wrote: > > Bundle up various global variables within gensupport.c into a > > class rtx_reader, with a view towards making it easier to run the > > code more than once in-process. &

[PATCH] print-rtx.c: add 'h', v' and 'p' prefixes to regnos

2016-09-21 Thread David Malcolm
On Tue, 2016-09-20 at 15:12 -0400, David Malcolm wrote: > On Tue, 2016-09-20 at 09:20 -0600, Jeff Law wrote: > > On 09/20/2016 08:34 AM, Bernd Schmidt wrote: > > > On 09/20/2016 04:32 PM, David Malcolm wrote: > > > > > > > > To summarize so fa

[PATCH] Introduce selftest::locate_file

2016-09-21 Thread David Malcolm
On Mon, 2016-09-19 at 11:31 -0600, Jeff Law wrote: > On 09/16/2016 03:19 PM, David Malcolm wrote: > > > > > When possible I don't think we want the tests to be target > > > specific. > > > Hmm, I'm probably about to argue for Bernd's work...

[committed] Provide location information for terminator characters (PR preprocessor/77672)

2016-09-23 Thread David Malcolm
substring_loc::get_location currently fails for the final terminator character in a STRING_CST from the C frontend, so that format_warning_va falls back to using the location of the string as a whole. This patch tweaks things [1] so that we use the final closing quote as the location of the termin

[committed] Fix gcc.dg/tree-ssa/builtin-sprintf-warn-4.c

2016-09-23 Thread David Malcolm
og (revision 240441) +++ gcc/testsuite/ChangeLog (revision 240442) @@ -1,3 +1,10 @@ +2016-09-23 David Malcolm + + PR preprocessor/77672 + * gcc.dg/tree-ssa/builtin-sprintf-warn-4.c (test): Update + expected multiline output from first warning to reflect change + in r240434. + 2016-09-23 Thomas Preud'homme * gcc.dg/tree-ssa/builtin-sprintf-warn-2.c: Fix xfail pattern.

[PATCH] read-rtl.c: split out read_rtx_operand from read_rtx_code

2016-09-23 Thread David Malcolm
This patch moves the body of the RTL operand-parsing loop (about 180 lines of code) from read_rtx_code out into a new function (read_rtx_operand). Hopefully this is a reasonable cleanup in itself, but it's also useful for the RTL frontend I'm working on. Successfully bootstrapped®rtested on x86_6

Re: [PATCH] print-rtx.c: add 'h', v' and 'p' prefixes to regnos

2016-09-29 Thread David Malcolm
On Wed, 2016-09-28 at 18:49 +0200, Bernd Schmidt wrote: > On 09/28/2016 06:36 PM, Jeff Law wrote: > > > A "p" prefix for pseudos might still be a good idea, but there's > > > still > > > the issue of a real "p0" register name causing confusion. > > So how do you think we should deal with distinguis

<    26   27   28   29   30   31   32   33   34   35   >