[PATCH 1/4] -Wmisleading-indentation: don't warn in presence of entirely blank lines

2015-10-29 Thread David Malcolm
Attempting to bootstrap gcc with -Wmisleading-indentation enabled I ran into a few failures where the indentation, although bad, was arguably not misleading. In regrename.c:scan_rtx_address: 1308 case PRE_MODIFY: 1309/* If the target doesn't claim to handle autoinc, this must be

[PATCH 3/4] Fix misleading indentation in tree-nested.c

2015-10-29 Thread David Malcolm
tree-nested.c has this code: 2333 for (c = gimple_omp_taskreg_clauses (stmt); 2334 c; 2335 c = OMP_CLAUSE_CHAIN (c)) 2336if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE 2337 || OMP_CLAUSE_CODE (c) ==

[PATCH 0/4] -Wmisleading-indentation

2015-10-29 Thread David Malcolm
-Wall Bootstrapped®rtested the combination of patches with x86_64-pc-linux-gnu; config-list.mk build using gcc6 with -Wmisleading-indentation enabled is in-progress. OK for trunk? David Malcolm (4): -Wmisleading-indentation: don't warn in presence of entirely blank lines Fix misleading i

[PATCH 2/4] Fix misleading indentation in tree-ssa-loop-unswitch.c

2015-10-29 Thread David Malcolm
tree-ssa-loop-unswitch.c has this bad indentation at line 452: 449if (dump_file && (dump_flags & TDF_DETAILS)) 450 fprintf (dump_file, ";; Not unswitching, loop is not expected" 451 " to iterate\n"); 452 return false; which leads to this war

[PATCH 4/4] Add -Wmisleading-indentation to -Wall

2015-10-29 Thread David Malcolm
Our documentation describes -Wall as enabling "all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros." I believe that -Wmisleading-indentation meets these criteria, and is likely to

Re: [PATCH 1/4] -Wmisleading-indentation: don't warn in presence of entirely blank lines

2015-10-29 Thread David Malcolm
On Thu, 2015-10-29 at 13:35 -0400, Patrick Palka wrote: > On Thu, Oct 29, 2015 at 12:49 PM, David Malcolm wrote: > > Attempting to bootstrap gcc with -Wmisleading-indentation enabled I ran > > into a few failures where the indentation, although bad, was arguably > > not m

[PATCH 0/2] Levenshtein-based suggestions (v3)

2015-10-30 Thread David Malcolm
On Thu, 2015-09-17 at 13:31 -0600, Jeff Law wrote: > On 09/16/2015 02:34 AM, Richard Biener wrote: > > > > Btw, this looks quite expensive - I'm sure we want to limit the effort > > here a bit. > A limiter is reasonable, though as it's been pointed out this only fires > during error processing, so

[PATCH 1/2] Implement Levenshtein distance

2015-10-30 Thread David Malcolm
This patch adds an implementation of Levenshtein distance to gcc, along with unit testing of the algorithm. The unit testing is implemented via a plugin within gcc.dg/plugin. (I'd prefer to do this via the unit testing patches I've been proposing in a separate patch kit, but to avoid depending on

[PATCH 2/2] C FE: suggest corrections for misspelled field names

2015-10-30 Thread David Malcolm
This is similar to the field-name part of the v2 patch: https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01090.html with the following changes: - don't call unit tests from lookup_field_fuzzy (instead, see patch 1 in the kit) - use a cutoff: if more than half of the letters were misspelle

[PATCH] Better error messages for merge-conflict markers (v3)

2015-10-30 Thread David Malcolm
This is a rebased version of this patch from back in April: v2: https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00944.html which in turn is a rewrite of this one: v1: https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01087.html The idea is to more gracefully handle merger conflict markers in the sou

Re: [PATCH 4b] diagnostic-show-locus.c changes: Insertions

2015-10-30 Thread David Malcolm
On Thu, 2015-10-29 at 22:49 -0600, Jeff Law wrote: > On 10/28/2015 12:09 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * diagnostic-show-locus.c (struct point_state): New struct. > > (class colorizer): New class. > > (class layout_point): New class. > &

Re: [PATCH 4/4] Add -Wmisleading-indentation to -Wall

2015-11-02 Thread David Malcolm
On Sun, 2015-11-01 at 17:06 -0500, Patrick Palka wrote: > On Fri, Oct 30, 2015 at 5:03 AM, Richard Biener > wrote: > > On Thu, Oct 29, 2015 at 6:38 PM, Jeff Law wrote: > >> On 10/29/2015 10:49 AM, David Malcolm wrote: > >>> > >>> Our documentation

Re: [PATCH 4/4] Add -Wmisleading-indentation to -Wall

2015-11-02 Thread David Malcolm
On Mon, 2015-11-02 at 11:21 -0500, David Malcolm wrote: > On Sun, 2015-11-01 at 17:06 -0500, Patrick Palka wrote: > > On Fri, Oct 30, 2015 at 5:03 AM, Richard Biener > > wrote: > > > On Thu, Oct 29, 2015 at 6:38 PM, Jeff Law wrote: > > >> On 10/2

Status of rich location work (was Re: [PATCH 06/10] Track expression ranges in C frontend)

2015-11-02 Thread David Malcolm
On Fri, 2015-10-30 at 00:15 -0600, Jeff Law wrote: > On 10/23/2015 02:41 PM, David Malcolm wrote: > > As in the previous version of this patch > > "Implement tree expression tracking in C FE (v2)" > > the patch now captures ranges for all C expressions during pa

Re: [PATCH 4/4] Add -Wmisleading-indentation to -Wall

2015-11-02 Thread David Malcolm
On Mon, 2015-11-02 at 13:39 -0500, Patrick Palka wrote: > On Mon, 2 Nov 2015, David Malcolm wrote: > > > On Sun, 2015-11-01 at 17:06 -0500, Patrick Palka wrote: > >> On Fri, Oct 30, 2015 at 5:03 AM, Richard Biener > >> wrote: > >>> On Thu, Oct 29, 2015

Re: Status of rich location work (was Re: [PATCH 06/10] Track expression ranges in C frontend)

2015-11-02 Thread David Malcolm
On Mon, 2015-11-02 at 14:14 -0500, David Malcolm wrote: > On Fri, 2015-10-30 at 00:15 -0600, Jeff Law wrote: > > On 10/23/2015 02:41 PM, David Malcolm wrote: > > > As in the previous version of this patch > > > "Implement tree expression tracking in C FE (v2)"

[PATCH] PR driver/67613 - spell suggestions for misspelled command line options

2015-11-04 Thread David Malcolm
This patch adds hints to the option-not-found error in the driver, using the Levenshtein distance implementation posted here: "[PATCH 0/2] Levenshtein-based suggestions (v3)" https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03379.html It splits out the identifier-based implementation into a new spe

Re: [PATCH 4b] diagnostic-show-locus.c changes: Insertions

2015-11-06 Thread David Malcolm
On Thu, 2015-10-29 at 22:49 -0600, Jeff Law wrote: > On 10/28/2015 12:09 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * diagnostic-show-locus.c (struct point_state): New struct. > > (class colorizer): New class. > > (class layout_point): New class. > &

[PATCH/RFC] C++ FE: expression ranges (work in progress)

2015-11-06 Thread David Malcolm
Caveat: this patch is a work-in-progress, but I thought it was worth posting to check that the concept is OK. This patch builds on top of the patch kit: "[PATCH 00/10] Overhaul of diagnostics (v5)" https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02536.html of which patches 1-4 are now in trunk. N

RFC: Experimental use of Sphinx for GCC documentation

2015-11-08 Thread David Malcolm
I've been experimenting with using Sphinx [1] for GCC's documentation. You can see an HTML sample of GCC docs built with Sphinx here: https://dmalcolm.fedorapeople.org/gcc/2015-08-31/rst-experiment/gcc.html (it's a work-in-progress; i.e. there are bugs). Compare with: https://gcc.gnu.org/onlined

Re: [PATCH 10/12] always define EH_RETURN_HANDLER_RTX

2015-11-09 Thread David Malcolm
On Mon, 2015-11-09 at 11:47 -0500, tbsaunde+...@tbsaunde.org wrote: > From: Trevor Saunders > > gcc/ChangeLog: > > 2015-11-09 Trevor Saunders > > * defaults.h (EH_RETURN_HANDLER_RTX): New default definition. > * df-scan.c (df_get_exit_block_use_set): Adjust. > * except.c (e

Re: RFC: Experimental use of Sphinx for GCC documentation

2015-11-09 Thread David Malcolm
On Mon, 2015-11-09 at 16:54 +, Kyrill Tkachov wrote: > Hi David, > > On 08/11/15 13:55, David Malcolm wrote: > > I've been experimenting with using Sphinx [1] for GCC's documentation. > > > > You can see an HTML sample of GCC docs built with Sphinx here:

Re: RFC: Experimental use of Sphinx for GCC documentation

2015-11-09 Thread David Malcolm
On Sun, 2015-11-08 at 16:16 +0100, Arnaud Charlet wrote: > We've switched the Ada doc to sphinx indeed, so can only be > in favor of this change for the rest of GCC. > > We do have also a texi2rst script which handles 90% of the work, the > rest requiring manual adaptations. I can send the script

[PATCH 02/02] C FE: add fix-it hint for . vs ->

2015-11-10 Thread David Malcolm
This is the most trivial example of a real fix-it example I could think of: if the user writes ptr.field rather than ptr->field. gcc/c/ChangeLog: * c-typeck.c (build_component_ref): Special-case POINTER_TYPE when generating a "not a structure of union" error message, and

[PATCH 01/02] PR/62314: add ability to add fixit-hints

2015-11-10 Thread David Malcolm
This patch adds the ability to add "fix-it hints" to a rich_location, which will be displayed when the corresponding diagnostic is printed. It does not actually add any fix-it hints (that comes in the second patch), but it adds test coverage of the machinery and printing, by using the existing dia

[PATCH] libcpp: add examples to source_location description

2015-11-10 Thread David Malcolm
This is a followup to: [PATCH 10/10] Compress short ranges into source_location which adds some worked examples of what a source_location/location_t can encode. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu (although it only touches a comment). OK for trunk? libcpp/ChangeLog:

Re: [PATCH 01/02] PR/62314: add ability to add fixit-hints

2015-11-10 Thread David Malcolm
On Tue, 2015-11-10 at 17:26 +0100, Bernd Schmidt wrote: > On 11/10/2015 05:35 PM, David Malcolm wrote: > > + /* Nasty workaround to convince the linker to add > > + rich_location::add_fixit_insert > > + rich_location::add_fixit_remove > > + rich_

Re: RFC: Experimental use of Sphinx for GCC documentation

2015-11-10 Thread David Malcolm
On Mon, 2015-11-09 at 16:37 -0700, Sandra Loosemore wrote: > On 11/08/2015 06:55 AM, David Malcolm wrote: > > I've been experimenting with using Sphinx [1] for GCC's documentation. > > > > [snip] > > > > The primary advantages of .rst/sphinx over .texi/

Re: [RFC] Remove first_pass_instance from pass_vrp

2015-11-12 Thread David Malcolm
On Thu, 2015-11-12 at 15:06 +0100, Richard Biener wrote: > On Thu, Nov 12, 2015 at 3:04 PM, Richard Biener > wrote: > > On Thu, Nov 12, 2015 at 2:49 PM, Tom de Vries > > wrote: > >> On 12/11/15 13:26, Richard Biener wrote: > >>> > >>> On Thu, Nov 12, 2015 at 12:37 PM, Tom de Vries > >>> wrote:

Re: [PATCH, 11/16] Update testcases after adding kernels pass group

2015-11-12 Thread David Malcolm
On Thu, 2015-11-12 at 15:43 +0100, Richard Biener wrote: > On Thu, Nov 12, 2015 at 3:31 PM, Tom de Vries wrote: > > On 11/11/15 12:03, Richard Biener wrote: > >> > >> On Mon, 9 Nov 2015, Tom de Vries wrote: > >> > >>> On 09/11/15 16:35, Tom de Vries wrote: > > Hi, > > this patc

Re: [PATCH 02/02] C FE: add fix-it hint for . vs ->

2015-11-12 Thread David Malcolm
On Tue, 2015-11-10 at 17:55 +, Joseph Myers wrote: > On Tue, 10 Nov 2015, David Malcolm wrote: > > > This is the most trivial example of a real fix-it example I could think > > of: if the user writes > > ptr.field > > rather than ptr->field. > > &g

Re: [PATCH 0/2] Levenshtein-based suggestions (v3)

2015-11-12 Thread David Malcolm
On Sun, 2015-11-01 at 23:44 -0700, Jeff Law wrote: > On 10/30/2015 06:47 AM, David Malcolm wrote: > > > The typename suggestion seems to be at least somewhat controversial, > > whereas (I hope) the misspelled field names suggestion is more > > acceptable. > > >

Re: [PATCH 0/2] Levenshtein-based suggestions (v3)

2015-11-13 Thread David Malcolm
On Fri, 2015-11-13 at 07:57 +0100, Marek Polacek wrote: > Probably coming too late, sorry. > On Thu, Nov 12, 2015 at 09:08:36PM -0500, David Malcolm wrote: > > index 4335a87..eb4e1fc 100644 > > --- a/gcc/c/c-typeck.c > > +++ b/gcc/c/c-typeck.c > > @@ -47,6 +47,7 @

Re: [PATCH] Remove first_pass_instance from pass_vrp

2015-11-13 Thread David Malcolm
On Fri, 2015-11-13 at 09:12 -0500, David Malcolm wrote: [...snip...] > > diff --git a/gcc/passes.c b/gcc/passes.c > > index dd8d00a..e634c5c 100644 > > --- a/gcc/passes.c > > +++ b/gcc/passes.c > > @@ -81,6 +81,13 @@ opt_pass::clone () > >internal_erro

Re: [PATCH] Remove first_pass_instance from pass_vrp

2015-11-13 Thread David Malcolm
On Fri, 2015-11-13 at 14:57 +0100, Tom de Vries wrote: > On 13/11/15 11:35, Richard Biener wrote: > > On Thu, Nov 12, 2015 at 4:33 PM, David Malcolm wrote: > >> On Thu, 2015-11-12 at 15:06 +0100, Richard Biener wrote: > >>> On Thu, Nov 12, 2015 at 3:04 PM, Richard

Re: Benchmarks of v2 (was Re: [PATCH 0/5] RFC: Overhaul of diagnostics (v2))

2015-11-13 Thread David Malcolm
On Wed, 2015-10-14 at 11:00 +0200, Richard Biener wrote: > On Tue, Oct 13, 2015 at 5:32 PM, David Malcolm wrote: > > On Thu, 2015-09-24 at 10:15 +0200, Richard Biener wrote: > >> On Thu, Sep 24, 2015 at 2:25 AM, David Malcolm wrote: > >> > On Wed, 2015-09-23 at 15:

libcpp/C FE source range patch committed (r230331).

2015-11-13 Thread David Malcolm
On Mon, 2015-11-02 at 14:14 -0500, David Malcolm wrote: > On Fri, 2015-10-30 at 00:15 -0600, Jeff Law wrote: > > On 10/23/2015 02:41 PM, David Malcolm wrote: > > > As in the previous version of this patch > > > "Implement tree expression tracking in C FE (v2)"

[PATCH] C++ FE: offer suggestions for misspelled field names

2015-11-13 Thread David Malcolm
This is analogous to: "[PATCH 2/2] C FE: suggest corrections for misspelled field names" https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03380.html but for the C++ frontend. OK for trunk if it passes bootstrap®rtest? gcc/c/ChangeLog: * c-typeck.c (lookup_field_fuzzy): Move determinat

Re: [PATCH] C++ FE: offer suggestions for misspelled field names

2015-11-13 Thread David Malcolm
On Fri, 2015-11-13 at 15:35 -0500, David Malcolm wrote: > This is analogous to: > "[PATCH 2/2] C FE: suggest corrections for misspelled field names" > https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03380.html > but for the C++ frontend. > > OK for trunk if it p

Re: libcpp/C FE source range patch committed (r230331).

2015-11-14 Thread David Malcolm
On Sat, 2015-11-14 at 09:50 -0500, David Edelsohn wrote: > This patch causes numerous new testsuite failure on AIX caused by the > compiler crashing during compilation, e.g. > > gcc.c-torture/execute/20020206-1.c > > in GCC libcpp > > 991 linemap_assert (line >= LINEMAPS_MACRO_LOWEST_LOCAT

[PATCH/RFC] C++ FE: expression ranges (v2)

2015-11-14 Thread David Malcolm
(v2 of the patch, fixing some issues, and rebasing to be on top of r230393 i.e. after the merge of delayed-folding). This patch is analogous to: "[PATCH 06/10] Track expression ranges in C frontend" https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02535.html in that it adds range information to th

Re: [PATCH, 6/6] Remove first_pass_instance

2015-11-15 Thread David Malcolm
On Sun, 2015-11-15 at 12:08 +0100, Tom de Vries wrote: > On 15/11/15 11:55, Tom de Vries wrote: > > [ was: Re: [PATCH] Remove first_pass_instance from pass_vrp ] > > > > This patch series removes first_pass_instance. > > > > 1Remove first_pass_instance from pass_vrp > > 2Remove

Re: [PATCH 00/16] Unit tests framework (v3)

2015-11-16 Thread David Malcolm
On Mon, 2015-11-16 at 19:17 +0100, Bernd Schmidt wrote: > So Jeff and I just had a chat, and we came up with some thoughts about > how to proceed. I think we both agree that it would be good to have a > special testing backend, along with frontends designed to be able to > read in gimple or rtl

[PATCH] Fix uninitialized src_range within c_expr (Re: libcpp/C FE source range patch committed (r230331))

2015-11-16 Thread David Malcolm
On Sat, 2015-11-14 at 23:32 -0500, David Malcolm wrote: > On Sat, 2015-11-14 at 09:50 -0500, David Edelsohn wrote: > > This patch causes numerous new testsuite failure on AIX caused by the > > compiler crashing during compilation, e.g. > > > > gcc.c-torture/execute/2

Re: [PATCH] Fix uninitialized src_range within c_expr (Re: libcpp/C FE source range patch committed (r230331))

2015-11-17 Thread David Malcolm
On Mon, 2015-11-16 at 22:34 +0100, Bernd Schmidt wrote: > On 11/16/2015 09:50 PM, David Malcolm wrote: > > The root cause is uninitialized data. Specifically, the C parser's > > struct c_expr gained a "src_range" field, and it turns out there are a > > few pla

Re: [PATCH] Fix uninitialized src_range within c_expr (Re: libcpp/C FE source range patch committed (r230331))

2015-11-17 Thread David Malcolm
On Tue, 2015-11-17 at 16:24 +0100, Bernd Schmidt wrote: > On 11/17/2015 04:13 PM, David Malcolm wrote: > > On Mon, 2015-11-16 at 22:34 +0100, Bernd Schmidt wrote: > >> > >> Should c_expr perhaps acquire a constructor so that this problem is > >> avoided

Re: [PATCH 01/02] PR/62314: add ability to add fixit-hints

2015-11-18 Thread David Malcolm
On Wed, 2015-11-18 at 14:57 -0700, Jeff Law wrote: > On 11/10/2015 09:35 AM, David Malcolm wrote: > > This patch adds the ability to add "fix-it hints" to a rich_location, > > which will be displayed when the corresponding diagnostic is printed. > > > > It d

[PATCH; committed] Fix typo in doc/gty.texi

2015-11-19 Thread David Malcolm
Committed to trunk (as r230609) as obvious, having verified that the docs build. gcc/ChangeLog: * doc/gty.texi (Support for inheritance): Fix missing parentheses in example. --- gcc/doc/gty.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/doc/gty.te

[PATCH 02/15] Add selftests to bitmap.c

2015-11-19 Thread David Malcolm
Jeff pre-approved the plugin version of this (as a new file unittests/test-bitmap.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03284.html with: > OK if/when prereqs are approved. Minor twiddling if we end up moving it > elsewhere or standardizing/reducing header files is pre-approved. This

[PATCH 01/15] Selftest framework (unittests v4)

2015-11-19 Thread David Malcolm
This is effectively v4 of the unittests proposal; for the earlier versions see: * v1: https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00765.html * v2: https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01224.html * v3: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02947.html This patch adds a selftest

[PATCH 08/15] Add selftests to gimple.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-gimple.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03304.html > Comment indicates addition. But code actually generates a > MULT_EXPR. Please fix. Fixed > OK if/when prereqs are approved. Minor twiddling if we end > up moving it e

[PATCH 09/15] Add hash-map-tests.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-hash-map.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03301.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files is > pre-approved. This version moves the

[PATCH 07/15] Fix warning in function-tests.c

2015-11-19 Thread David Malcolm
Upon porting from gtest.h to selftest.h I ran into this warning which is fatal during bootstrap: In file included from ../../../src/gcc/toplev.c:89:0: ../../../src/gcc/function-tests.c: In member function ‘virtual void {anonymous}::function_test_fndecl_int_void::run()’: ../../../src/gcc/selftest.

[PATCH 13/15] Add selftests to tree.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-tree.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03303.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files is > pre-approved. This version puts the tests

[PATCH 04/15] Add selftests to et-forest.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03295.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files > is pre-approved. gcc/ChangeLog: * et-forest.c: Include "selfte

[PATCH 10/15] Add hash-set-tests.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-hash-set.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03300.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files is > pre-approved. This version moves the

[PATCH 05/15] Add selftests to fold-const.c

2015-11-19 Thread David Malcolm
Jeff approved an older version of this (as a separate unittests/test-folding.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03305.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files > is pre-approved. gcc/ChangeLog:

[PATCH 15/15] RFC: Add ggc-tests.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-ggc.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03306.html > Not terribly happy with that counter to used to create a big list > to detect recursion. But I'm not offhand sure how to avoid without > exposing more of the ggc system t

[PATCH 06/15] Add function-tests.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-functions.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03310.html with: > There's some if (0) code in here that needs to be eliminated. (done) > The RTL case in particular is probably stretching the limits of what > we can do wit

[PATCH 14/15] Add selftests to vec.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-vec.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03308.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files is > pre-approved. This version puts the tests

[PATCH 03/15] Add selftests to tree-cfg.c

2015-11-19 Thread David Malcolm
Jeff approved an older version of this: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03285.html with: > Unless there's a good reason, drop the presumably redundant tests > and this is OK. Save preapprovald for these changes as the bitmap > patch. This version removes the redundant tests, and mo

[PATCH 00/15] Unittests framework v4: -fself-test

2015-11-19 Thread David Malcolm
ider desirable for such relatively > simple data structures. > > Thoughts? I like the idea. Here's another iteration of the patch kit, which implements it (mostly). David Malcolm (15): Selftest framework (unittests v4) Add selftests to bitmap.c Add selftests to tree-cfg.c Add

[PATCH 11/15] Add selftests to input.c

2015-11-19 Thread David Malcolm
Jeff conditionally approved an earlier version of this (as unittests/test-locations.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03307.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files is > pre-approved. > > Cons

[PATCH 12/15] Add rtl-tests.c

2015-11-19 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-rtl.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03302.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files is >pre-approved. This version puts the tests i

Re: [PATCH 01/15] Selftest framework (unittests v4)

2015-11-19 Thread David Malcolm
On Thu, 2015-11-19 at 18:35 +0100, Bernd Schmidt wrote: > In general I'm much happier with this approach, and I think this series > is close to ready, but I want to bring up some questions that could use > wider discussion. > > This patch adds a selftest.h/.c to gcc, with an API loosely > > mode

[PATCH] Fix PR objc/68438 (uninitialized source ranges)

2015-11-20 Thread David Malcolm
x86_64-pc-linux-gnu; adds 15 PASS results to gcc.sum. OK for trunk? >From afdae8b15f71164d0d05e790078519b38bd674a4 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 20 Nov 2015 11:12:47 -0500 Subject: [PATCH] Fix PR objc/68438 (uninitialized source ranges) gcc/c/ChangeLog: PR objc/68438

Re: [PATCH] Fix uninitialized src_range within c_expr (Re: libcpp/C FE source range patch committed (r230331))

2015-11-21 Thread David Malcolm
On Sat, 2015-11-21 at 13:54 -0500, David Edelsohn wrote: > On Tue, Nov 17, 2015 at 3:12 PM, David Malcolm wrote: > > On Tue, 2015-11-17 at 16:24 +0100, Bernd Schmidt wrote: > >> On 11/17/2015 04:13 PM, David Malcolm wrote: > >> > On Mon, 2015-11-16 at 22

Re: [PATCH] Fix PR objc/68438 (uninitialized source ranges)

2015-11-22 Thread David Malcolm
On Fri, 2015-11-20 at 23:28 +, Joseph Myers wrote: > On Fri, 20 Nov 2015, David Malcolm wrote: > > > The source ranges are verified using the same unit-testing plugin used > > for C expressions. This leads to a wart, which is that it means having > > a .m test f

Re: [PATCH/RFC] C++ FE: expression ranges (v2)

2015-11-23 Thread David Malcolm
On Mon, 2015-11-23 at 10:59 +0100, Richard Biener wrote: > On Sat, Nov 21, 2015 at 9:21 AM, Jakub Jelinek wrote: > > On Sat, Nov 21, 2015 at 02:16:49AM -0500, Jason Merrill wrote: > >> On 11/19/2015 03:46 PM, Jason Merrill wrote: > >> >On 11/15/2015 12:01 AM, David

[PATCH] PR c/68473: sanitize source range-printing within certain macro expansions

2015-11-23 Thread David Malcolm
This patch fixes PR c/68473 by bulletproofing the new diagnostic_show_locus implementation against ranges that finish before they start (which can happen when using the C preprocessor), falling back to simply printing a caret. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu; adds 7 new PA

Re: [PATCH] PR c/68473: sanitize source range-printing within certain macro expansions

2015-11-23 Thread David Malcolm
On Mon, 2015-11-23 at 18:59 +0100, Bernd Schmidt wrote: > On 11/23/2015 06:52 PM, David Malcolm wrote: > > This patch fixes PR c/68473 by bulletproofing the new > > diagnostic_show_locus implementation against ranges that finish before > > they start (which can happen when usi

Re: [PATCH] Fix PR objc/68438 (uninitialized source ranges)

2015-11-23 Thread David Malcolm
On Mon, 2015-11-23 at 10:25 -0700, Jeff Law wrote: > On 11/23/2015 04:13 AM, Joseph Myers wrote: > > On Sun, 22 Nov 2015, David Malcolm wrote: > > > >> Is there (or could there be) a precanned dg- directive to ask if ObjC is > >> available? > > > > I

Re: [PATCH/RFC] C++ FE: expression ranges (v2)

2015-11-24 Thread David Malcolm
On Tue, 2015-11-24 at 10:40 +0100, Richard Biener wrote: > On Mon, Nov 23, 2015 at 8:25 PM, Jason Merrill wrote: > > On 11/23/2015 12:07 PM, Marek Polacek wrote: > >> > >> On Mon, Nov 23, 2015 at 05:57:54PM +0100, Jakub Jelinek wrote: > >>> > >>&

Re: [PATCH 01/15] Selftest framework (unittests v4)

2015-11-24 Thread David Malcolm
On Tue, 2015-11-24 at 13:44 -0700, Jeff Law wrote: > On 11/19/2015 11:44 AM, Bernd Schmidt wrote: > > On 11/19/2015 07:08 PM, David Malcolm wrote: > >> gcc_assert terminates the process and no further testing is done, > >> whereas the approach the kit tries to run

[PATCH 1/2] RFC: C++: attempt to provide location_t in more places

2015-11-25 Thread David Malcolm
This patch avoids the need for calls to protected_set_expr_location in the followup patch by adding location_t params to the following functions: - build_new - cp_build_indirect_ref - cp_build_unary_op - cp_build_c_cast - cp_build_modify_expr It's not clear to me whether I should be pass

[PATCH/RFC 0/2] C++ FE: expression ranges (v3)

2015-11-25 Thread David Malcolm
On Sat, 2015-11-21 at 02:16 -0500, Jason Merrill wrote: > On 11/19/2015 03:46 PM, Jason Merrill wrote: > > On 11/15/2015 12:01 AM, David Malcolm wrote: > >> As with the C frontend, there's an issue with tree nodes that > >> don't have locations: VAR_DECL, IN

[PATCH 2/2] RFC: C++ FE: expression ranges (work in progress) v3

2015-11-25 Thread David Malcolm
Changes from previous version: - all new calls to protected_set_expr_location removed; instead the location is passed into a tree-building function, using the preceding patch. - removal of #if 0 code - generates meaningful ranges for new expressions, using cp_lexer_previous_token. - share

Re: [PATCH 01/15] Selftest framework (unittests v4)

2015-11-25 Thread David Malcolm
On Thu, 2015-11-19 at 19:44 +0100, Bernd Schmidt wrote: > On 11/19/2015 07:08 PM, David Malcolm wrote: > > gcc_assert terminates the process and no further testing is done, > > whereas the approach the kit tries to run as much of the testsuite as > > possible, and then fail i

Re: [PATCH 01/15] Selftest framework (unittests v4)

2015-11-25 Thread David Malcolm
On Wed, 2015-11-25 at 11:55 +0100, Bernd Schmidt wrote: > On 11/25/2015 03:26 AM, David Malcolm wrote: > > Consider the case where an assumption that the host is little-endian > > assumption creeps into one of the bitmap functions. Some time later, > > another developer updat

Re: [UPC 01/22] front-end changes

2015-12-01 Thread David Malcolm
On Tue, 2015-12-01 at 00:19 -0800, Gary Funck wrote: > On 12/01/15 09:12:44, Eric Botcazou wrote: > > > All languages (c, c++, fortran, go, lto, objc, obj-c++) have been > > > bootstrapped; no test suite regressions were introduced, > > > relative to the GCC trunk. > > > > That's not all languages

Re: [PATCH] RFC: Use Levenshtein spelling suggestions in Fortran FE

2015-12-01 Thread David Malcolm
eck-operator.f90: New testcase. > * gfortran.dg/spellcheck-procedure.f90: New testcase. > * gfortran.dg/spellcheck-structure.f90: New testcase. > > --- > > David Malcolm nice Levenshtein distance spelling check helpers > were used in some parts of other frontends.

Re: [PATCH] RFC: Use Levenshtein spelling suggestions in Fortran FE

2015-12-01 Thread David Malcolm
On Tue, 2015-12-01 at 18:51 +0100, Bernhard Reutner-Fischer wrote: > On 1 December 2015 at 18:28, David Malcolm wrote: > > On Tue, 2015-12-01 at 13:55 +0100, Bernhard Reutner-Fischer wrote: > > > >> +/* Lookup function FN fuzzily, taking names in FUN into account. */

[PATCH 04/10] Fix g++.dg/template/crash55.C

2015-12-03 Thread David Malcolm
The patch kit changes the output of this case: 1 //PR c++/27668 2 3 template // { dg-error "nested-name-specifier|two or more|valid type" } 4 struct A {}; 5 6 template void foo(A); // { dg-error "cast|argument" "" { target c++98_only } } but only for c++98, from: g++.dg/templ

[PATCH 10/10] Fix g++.dg/warn/Wconversion-real-integer2.C

2015-12-03 Thread David Malcolm
This testcase's output is changed by the patchkit from printing at the "=": BEFORE: g++.dg/warn/Wconversion-real-integer2.C: In function 'void h()': g++.dg/warn/Wconversion-real-integer2.C:32:12: warning: conversion to 'float' alters 'int' constant value [-Wfloat-conversion] vfloat = INT_MAX

[PATCH 08/10] Fix g++.dg/ubsan/pr63956.C

2015-12-03 Thread David Malcolm
With the location patch, various errors in g++.dg/ubsan/pr63956.C change: 8 constexpr int 9 fn1 (int a, int b) 10 { 11if (b != 2) 12 a <<= b; 13return a; 14 } 15 16 constexpr int i1 = fn1 (5, 3); 17 constexpr int i2 = fn1 (5, -2); // { d

[PATCH 03/10] Fix g++.dg/gomp/loop-1.C

2015-12-03 Thread David Malcolm
The patch kit affects the locations of the errors reported by g++.dg/gomp/loop-1.C. I reviewed the new locations, and they seemed sane. This patch updates the locations of omp_for_cond to use the location of the cond if available, falling back to the existing behavior of using input_location othe

[PATCH 02/10] Fix g++.dg/cpp0x/nsdmi-template14.C

2015-12-03 Thread David Malcolm
When building new-expressions, we use cp_lexer_previous_token and access its location to get the final position in the source range. Within g++.dg/cpp0x/nsdmi-template14.C, the previous token within a new expr can have been purged, leading to UNKNOWN_LOCATION. g++.dg/cpp0x/nsdmi-template14.C:11

[PATCH 07/10] Fix g++.dg/template/ref3.C

2015-12-03 Thread David Malcolm
Testcase g++.dg/template/ref3.C: 1 // PR c++/28341 2 3 template struct A {}; 4 5 template struct B 6 { 7A<(T)0> b; // { dg-error "constant|not a valid" } 8A a; // { dg-error "constant|not a valid" } 9 }; 10 11 B b; The output of t

[PATCH 09/10] Fix g++.dg/warn/pr35635.C

2015-12-03 Thread David Malcolm
This testcase was broken by the patch kit; upon investigation the best fix is to try to use the location of the relevant expression when warning about conversions, rather than input_location, falling back to the latter via EXPR_LOC_OR_LOC. One dg-warning needed moving, since the caret is on the "?

[PATCH 00/10] C++ expression ranges v4

2015-12-03 Thread David Malcolm
in the hope it will make review easier. (The kit would be applied as a single commit; I've been testing it as one). The following 10-patch kit bootstraps®rtests successfully on x86_64-pc-linux-gnu. It adds 213 new PASS results to g++.sum, and changes the location of 154 PASS results there

[PATCH 05/10] Fix location of dg-error within g++.dg/template/pr64100.C

2015-12-03 Thread David Malcolm
Here's what it now emits (if caret-printing were enabled): g++.dg/template/pr64100.C: In instantiation of ‘class foo’: g++.dg/template/pr64100.C:8:16: required from here g++.dg/template/pr64100.C:5:41: error: invalid use of incomplete type ‘class foo’ static_assert(noexcept(((foo *)1)->~fo

[PATCH 06/10] Fix g++.dg/template/pseudodtor3.C

2015-12-03 Thread David Malcolm
gcc/testsuite/ChangeLog: * g++.dg/template/pseudodtor3.C: Update column numbers in dg-error directives. --- gcc/testsuite/g++.dg/template/pseudodtor3.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/g++.dg/template/pseudodtor3.C b/gcc/testsui

[PATCH 01/10] C++ FE: expression ranges v4

2015-12-03 Thread David Malcolm
Changes in this version: - removal of gcc_assert (m_loc != UNKNOWN_LOCATION) from cp_expr ctor - uses protected_set_expr_location or cp_expr::set_location/set_range, rather than attempting to add location_t arguments - adds location support and test coverage based on issues seen in the analogou

[PATCH] Fix missing range information for "%q+D" format code

2015-12-03 Thread David Malcolm
There are about 220 or so diagnostics in trunk that use "%q+D" in their format string, which, as well as printing a quoted decl, overwrites any location_t supplied to the diagnostic, instead using the location of the associated decl. During development of the location range patch kit I adjusted th

Re: [PATCH 02/10] Fix g++.dg/cpp0x/nsdmi-template14.C

2015-12-03 Thread David Malcolm
On Thu, 2015-12-03 at 15:33 -0500, Jason Merrill wrote: > On 12/03/2015 09:55 AM, David Malcolm wrote: > > This patch adds bulletproofing to detect purged tokens, and avoid using > > them. > > > > Alternatively, is it OK to access purged tokens for this kind of thing? &g

Re: [PATCH 07/10] Fix g++.dg/template/ref3.C

2015-12-03 Thread David Malcolm
On Thu, 2015-12-03 at 15:38 -0500, Jason Merrill wrote: > On 12/03/2015 09:55 AM, David Malcolm wrote: > > Testcase g++.dg/template/ref3.C: > > > > 1 // PR c++/28341 > > 2 > > 3 template struct A {}; > > 4 > &

[PATCH 02/10 v2] Fix g++.dg/cpp0x/nsdmi-template14.C (v2)

2015-12-04 Thread David Malcolm
On Thu, 2015-12-03 at 17:17 -0500, Jason Merrill wrote: > On 12/03/2015 04:43 PM, David Malcolm wrote: > > On Thu, 2015-12-03 at 15:33 -0500, Jason Merrill wrote: > >> On 12/03/2015 09:55 AM, David Malcolm wrote: > >>> This patch adds bulletproofing to detect

[PATCH] Add XFAIL to g++.dg/template/ref3.C (PR c++/68699)

2015-12-04 Thread David Malcolm
On Fri, 2015-12-04 at 11:01 -0500, Jason Merrill wrote: > On 12/03/2015 05:08 PM, David Malcolm wrote: > > On Thu, 2015-12-03 at 15:38 -0500, Jason Merrill wrote: > >> On 12/03/2015 09:55 AM, David Malcolm wrote: > >>> Testcase g++.dg/template/ref3.C: > &g

Re: [PATCH 01/10] C++ FE: expression ranges v4

2015-12-04 Thread David Malcolm
On Fri, 2015-12-04 at 12:10 -0500, Jason Merrill wrote: > On 12/03/2015 09:55 AM, David Malcolm wrote: > > @@ -362,10 +362,11 @@ convert_to_real_1 (tree type, tree expr, bool fold_p) > > case REAL_TYPE: > > /* Ignore the conversion if we don't

Re: [PATCH] Fix missing range information for "%q+D" format code

2015-12-04 Thread David Malcolm
On Fri, 2015-12-04 at 12:09 +0100, Bernd Schmidt wrote: > On 12/03/2015 09:33 PM, David Malcolm wrote: > > The attached patch updates the handling of %q+D, simplifying > > the implementation, and ensuring that it retains the range > > information of the decl, giving: > >

<    6   7   8   9   10   11   12   13   14   15   >