[PATCH] Machine-readable RTL dumps: print_rtx_function

2016-09-29 Thread David Malcolm
This patch adds a new function, print_rtx_function, intended for use for generating function dumps suitable for parsing by the RTL frontend, but also intended to be human-readable, and human-authorable. I put the function in its own file (rather than print-rtl.c) to avoid having to recompile all t

[PATCH] read-md.c: track column numbers

2016-09-29 Thread David Malcolm
This patch adds rudimentary column-number tracking to read-md.c, to give more precise locations for messages for problems in .md files (and in the RTL frontend I'm working on): ../../src/gcc/config/i386/i386.md:1204:22: error: unknown rtx code `define_mood_iterator' ../../src/gcc/config/i386/i386

Re: [PATCH] Cleanup of input.c

2016-09-30 Thread David Malcolm
On Mon, 2016-09-26 at 14:30 +, Bernd Edlinger wrote: > Hi, > > this started, because I saw get_next_line returns -1 on error, > instead > of false: PR 77699. > > But when I was there I also saw that read_line_num is using memmove > on > non-aliased src & dest, instead of memcpy. But then I s

Re: [PATCH] Machine-readable RTL dumps: print_rtx_function

2016-10-03 Thread David Malcolm
On Sun, 2016-10-02 at 07:04 -0500, Segher Boessenkool wrote: > On Thu, Sep 29, 2016 at 11:36:29AM -0600, Jeff Law wrote: > > On 09/29/2016 11:25 AM, Bernd Schmidt wrote: > > > On 09/29/2016 07:47 PM, David Malcolm wrote: > > > > This patch adds a new function

Re: [PATCHv2] Cleanup of input.c

2016-10-03 Thread David Malcolm
On Sun, 2016-10-02 at 13:07 +, Bernd Edlinger wrote: > Hi Dave, > > here is the new version of the input.c patch: > > I have updated the comments, and revised the test case as requested. > I have additionally done a bootstrap with build config=bootstrap > -asan. Thanks. A couple of nits in

Re: [BUILDROBOT] Selftest failed for i686-wrs-vxworks

2016-10-05 Thread David Malcolm
c /dev/null -fself-test > xgcc: fatal error: environment variable 'WIND_BASE' not defined > compilation terminated. > make[2]: *** [s-selftest] Error 1 > [...] > make[1]: *** [all-gcc] Error 2 > > On Thu, 30 Jun 2016 16:09:23 -0400, David Malco

[PATCH 01/16] read-md.c: Add various cleanups to ~rtx_reader

2016-10-05 Thread David Malcolm
Various global data items relating to reading .md files are currently initialized in rtx_reader::read_md_files, and are not cleaned up. The selftests for the RTL frontend require supporting multiple reader instances being alive one after another in-process, so this lack of cleanup would become a l

[PATCH 02/16] (approved) Add selftest::read_file

2016-10-05 Thread David Malcolm
Jeff: "Seems reasonable. Install when you have a need." 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.

[PATCH 03/16] (approved) selftest.h: add temp_override fixture

2016-10-05 Thread David Malcolm
Jeff: "When you need it, this is fine." 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 it

[PATCH 07/16] read-md: add some helper functions

2016-10-05 Thread David Malcolm
Add some functions for use by the RTL frontend. gcc/ChangeLog: * read-md.c (require_char): New function. (require_word_ws): New function. (peek_char): New function. * read-md.h (peek_char): New decl. (require_char): New decl. (require_word_ws): New d

[PATCH 00/16] RTL frontend (v3)

2016-10-05 Thread David Malcolm
lftesting and check-rtl for target aarch64-linux-gnu. I'm working on doing a full test across all our supported targets (and there are likely some target-specific failures in there at the moment). There are still some FIXMEs, TODOs and #if 0 in there, but I thought it was worth postin

[PATCH 09/16] Split class rtx_reader into base_rtx_reader vs rtx_reader

2016-10-05 Thread David Malcolm
This moves read_rtx and friends into rtx_reader, and splits rtx_reader into two classes: class base_rtx_reader: has responsibility for reading chars, managing include files, top-level directives etc. It is the read-md.o part. class rtx_reader, a subclass, has the code for reading hierarchical rt

[PATCH 08/16] (partially-approved): Introduce selftest::locate_file

2016-10-05 Thread David Malcolm
Jeff: > I do think we should go ahead and plan for a target subdirectory. With > that added, this should be OK once dependencies are in. Loading RTL dumps from files rather than embedding them as strings in the source requires a way to locate the relevant files. This patch adds a selftest::locat

[PATCH 06/16] Introduce emit_status::ensure_regno_capacity

2016-10-05 Thread David Malcolm
gcc/ChangeLog: * emit-rtl.c (gen_reg_rtx): Move regno_pointer_align and regno_reg_rtx resizing logic to... (emit_status::ensure_regno_capacity): ...this new method. (init_emit): Allocate regno_reg_rtx using ggc_cleared_vec_alloc rather than ggc_vec_alloc.

[PATCH 05/16] Introduce rtl_data::init_stack_alignment

2016-10-05 Thread David Malcolm
Move this part of "expand"'s initialization of crtl into its own method so that it can used by the RTL frontend when postprocessing RTL dumps. gcc/ChangeLog: * cfgexpand.c (pass_expand::execute): Move stack initializations to rtl_data::init_stack_alignment and call it. * em

[PATCH 11/16] df selftests (v3)

2016-10-05 Thread David Malcolm
Changes since v2: * moved dump from a string literal to an external file * update for addition of selftest::location to rtl_dump_test * remove debug prints gcc/ChangeLog: * df-core.c: Include selftest.h and selftest-rtl.h. (selftest::dataflow_test::dataflow_test): New ctor.

[PATCH 04/16] (approved) Expose forcibly_ggc_collect and run it after all selftests

2016-10-05 Thread David Malcolm
Jeff: > Seems reasonable and doesn't depend on earlier patches, right? > Assuming that's correct it seems fine for the trunk whenever you want to > install it. gcc/ChangeLog: * ggc-tests.c (forcibly_ggc_collect): Rename to... (selftest::forcibly_ggc_collect): ...this, and remove "s

[PATCH 16/16] Add "__RTL" to cc1

2016-10-05 Thread David Malcolm
This patch implements Richi's idea of having a custom __RTL marker in C function definitions, to indicate that the body of the function is to be parsed as RTL, rather than C: int __RTL test_fn_1 (int i) { (function "times_two" (insn-chain (note 1 0 4 (nil) NOTE_INSN_DELETED) ;; etc

[PATCH 12/16] combine.c selftests (v2)

2016-10-05 Thread David Malcolm
Changed in v2: * moved dumps from a string literal to external files (sharing a dump with read-rtl-function.c) * update for addition of selftest::location to rtl_dump_test gcc/ChangeLog: * combine.c: Include selftest.h and selftest-rtl.h. (try_combine): Add assertion on this_basic_

[PATCH 13/16] cse.c selftests

2016-10-05 Thread David Malcolm
Changed in v2: * move test dumps into external files * update for addition of selftest::location to rtl_dump_test Blurb from v1: 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 bo

[PATCH 14/16] RTL interpreter (work-in-progress)

2016-10-05 Thread David Malcolm
This patch is much less polished than the rest of the kit; it's more of an idea, showing an RTL interpreter. My hope is that something like this could be used to build a valgrind for RTL, allowing us to run RTL fragments with a variety of inputs, for sanity checking. For example: capture the resu

[PATCH 15/16] RTL frontend (rtl1), on top of dump reader

2016-10-05 Thread David Malcolm
This patch implements the RTL frontend, using the function_reader class from earlier in the patch kit. Compared to this patch in v1 of the kit, most of the work has been split into earlier patches. Other changes relative to v1 include: * fix autodeps (by renaming RTL_OBJS to rtl_OBJS in rtl/Make-

[PATCH 10/16] Introduce class function_reader (v3)

2016-10-05 Thread David Malcolm
This patch implements class function_reader, which implements the dump-parsing functionality used in the rest of the kit. Changed in v3: * rather than hardcoding the selftest input dumps as escaped C strings in the source code, move them out into separate files, using selftest::locate_file * updat

RTL frontend input format again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-06 Thread David Malcolm
On Thu, 2016-10-06 at 15:30 +0200, Bernd Schmidt wrote: > On 10/05/2016 06:15 PM, David Malcolm wrote: > > +;; MEM[(struct isl_obj *)&obj1] = &isl_obj_map_vtable; > > +(insn 1045 0 1046 2 (set (reg:SI 480) > > +(high:SI (symbol_ref:SI ("isl_obj_map_vtable

Re: RTL frontend input format again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-06 Thread David Malcolm
On Thu, 2016-10-06 at 15:53 -0400, David Malcolm wrote: > On Thu, 2016-10-06 at 15:30 +0200, Bernd Schmidt wrote: > > On 10/05/2016 06:15 PM, David Malcolm wrote: > > > +;; MEM[(struct isl_obj *)&obj1] = &isl_obj_map_vtable; > > > +(insn 1045 0 1046 2 (set (

Re: PR35503 - warn for restrict pointer

2016-10-07 Thread David Malcolm
On Fri, 2016-10-07 at 10:33 +0530, Prathamesh Kulkarni wrote: > On 22 September 2016 at 23:15, Joseph Myers > wrote: > > On Thu, 22 Sep 2016, Prathamesh Kulkarni wrote: > > > > > Would that be acceptable ? I am not sure how to make %Z check if > > > the > > > argument has type vec * > > > since v

Re: RTL frontend input format again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-07 Thread David Malcolm
On Fri, 2016-10-07 at 12:38 +0200, Bernd Schmidt wrote: > On 10/06/2016 09:53 PM, David Malcolm wrote: > > A benefit of keeping the INSN_UIDs is that if you've spent half an > > hour > > single-stepping through RTL modification and know that INSN_UID > > 1045 is

Re: [PATCH 10/16] Introduce class function_reader (v3)

2016-10-07 Thread David Malcolm
On Wed, 2016-10-05 at 18:00 +0200, Bernd Schmidt wrote: > On 10/05/2016 06:15 PM, David Malcolm wrote: > > * errors.c: Use consistent pattern for bconfig.h vs config.h > > includes. > > (progname): Wrap with #ifdef GENERATOR_FILE. > > (error): Likewise

[PATCH] Add "__RTL" to cc1 (v2)

2016-10-07 Thread David Malcolm
On Wed, 2016-10-05 at 16:09 +, Joseph Myers wrote: > On Wed, 5 Oct 2016, David Malcolm wrote: > > > @@ -1752,6 +1759,35 @@ c_parser_declaration_or_fndef (c_parser > > *parser, bool fndef_ok, > >c_parser_skip_to_end_of_block_or_statement (pa

[PATCH] RTL frontend (rtl1), on top of dump reader (v4)

2016-10-07 Thread David Malcolm
On Thu, 2016-10-06 at 17:23 +0200, Bernd Schmidt wrote: > Let me just make a first pass over this for minor/obvious issues. > > > +we have little control of the input to that specific pass. We > > "control over" maybe? Fixed. > > +The testsuite is below @file{gcc/testsuite/rtl.dg}. > > Not sure

Re: RTL frontend input format again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-07 Thread David Malcolm
On Fri, 2016-10-07 at 15:58 +0200, Bernd Schmidt wrote: > On 10/07/2016 03:26 PM, David Malcolm wrote: > > > > We could simply print the INSN_UID for CODE_LABELs; something like > > this > > (see the "(code_label 16" below): > > I think that sh

[PATCH] go-lang.c: remove a redundant cast

2016-10-07 Thread David Malcolm
Amongst many other changes, r146451 added this cast: -#define GET_MODE_CLASS(MODE) mode_class[MODE] +#define GET_MODE_CLASS(MODE) ((enum mode_class) mode_class[MODE]) making a cast in go-lang.c redundant; remove it. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk? gc

[PATCH] Split print_rtx into subroutines

2016-10-11 Thread David Malcolm
print_rtx is a ~550 line function, the bulk of which is a ~400-line switch statement, with a fair amount to #if logic. This patch simplifies things by moving the switch statement into its own subroutine, and by moving the more complicated cases into their own subroutines. No functional changes (b

Re: [PATCH 01/16] read-md.c: Add various cleanups to ~rtx_reader

2016-10-11 Thread David Malcolm
On Wed, 2016-10-05 at 17:51 +0200, Bernd Schmidt wrote: > On 10/05/2016 06:14 PM, David Malcolm wrote: > > The selftests for the RTL frontend require supporting multiple > > reader instances being alive one after another in-process, so > > this lack of cleanu

Re: fix -fmax-errors & notes

2016-10-11 Thread David Malcolm
On Tue, 2016-10-11 at 06:34 -0400, Nathan Sidwell wrote: > Hi, > Jonathan & I were chatting at the cauldron about how -fmax-errors > kills any > notes about the final error. That's because we bail out just after > emitting the > final error. This patch fixes the problem by bailing out just befo

[PATCH] print_rtx_function: integrate dumping of the CFG into the insn chain

2016-10-12 Thread David Malcolm
On Fri, 2016-10-07 at 15:58 +0200, Bernd Schmidt wrote: > On 10/07/2016 03:26 PM, David Malcolm wrote: > > > > We could simply print the INSN_UID for CODE_LABELs; something like > > this > > (see the "(code_label 16" below): > > I think that should

[PATCH] Add a "compact" mode to print_rtx_function

2016-10-12 Thread David Malcolm
On Fri, 2016-10-07 at 15:58 +0200, Bernd Schmidt wrote: > On 10/07/2016 03:26 PM, David Malcolm wrote: > > > > We could simply print the INSN_UID for CODE_LABELs; something like > > this > > (see the "(code_label 16" below): > > I think that should

[PATCH] (v2) Add a "compact" mode to print_rtx_function

2016-10-12 Thread David Malcolm
On Wed, 2016-10-12 at 19:31 +0200, Bernd Schmidt wrote: > On 10/12/2016 07:48 PM, David Malcolm wrote: > > This patch implements a "compact" mode for print_rtx_function, > > implementing most of the ideas above. > > > > Example of output can be seen here: &g

[PATCH] Tweaks to print_rtx_function

2016-10-12 Thread David Malcolm
On Wed, 2016-10-12 at 19:31 +0200, Bernd Schmidt wrote: > On 10/12/2016 07:48 PM, David Malcolm wrote: [...snip...] > > I think the only remaining item from our discussion above is what > > to do > > about the numbering of pseudos in the dumps (currently it just

Re: [PATCH] Tweaks to print_rtx_function

2016-10-13 Thread David Malcolm
On Thu, 2016-10-13 at 12:24 +0200, Bernd Schmidt wrote: > On 10/12/2016 11:04 PM, David Malcolm wrote: > > > > This patch implements: > > * the renumbering of non-virtual pseudos, using > > LAST_VIRTUAL_REGISTER + 1 as a base. > > * omitting the edge "

[PATCH] Omit INSN_LOCATION from compact dumps

2016-10-13 Thread David Malcolm
On Thu, 2016-10-13 at 12:21 +0200, Bernd Schmidt wrote: > On 10/12/2016 10:37 PM, David Malcolm wrote: > > It didn't pass, due to this change: > > > > (print_rtx_operand_code_i): When printing source locations, > > wrap > > xloc.file in quotes. [..

[PATCH] read-md.c: Move various state to within class rtx_reader

2016-10-14 Thread David Malcolm
On Wed, 2016-10-12 at 22:57 +0100, Richard Sandiford wrote: > Sorry, haven't had time to read the full series yet, but: > > David Malcolm writes: > > On Wed, 2016-10-05 at 17:51 +0200, Bernd Schmidt wrote: > > > On 10/05/2016 06:14 PM, David Malcolm wrote: >

Re: fix -fmax-errors & notes

2016-10-14 Thread David Malcolm
On Thu, 2016-10-13 at 06:48 -0400, Nathan Sidwell wrote: > On 10/11/16 16:07, David Malcolm wrote: > > > This logic is running when the next diagnostic is about to be > > emitted. > > But what if the user has selected -Wfatal-errors and there's a > > single &

Re: [PATCH] Add "__RTL" to cc1 (v2)

2016-10-14 Thread David Malcolm
On Thu, 2016-10-13 at 15:49 +0200, Richard Biener wrote: > On Fri, Oct 7, 2016 at 5:58 PM, David Malcolm > wrote: > > On Wed, 2016-10-05 at 16:09 +, Joseph Myers wrote: > > > On Wed, 5 Oct 2016, David Malcolm wrote: > > > > > > > @@ -1752,6 +1759,35

Re: [PATCH] Add "__RTL" to cc1 (v2)

2016-10-14 Thread David Malcolm
On Fri, 2016-10-14 at 11:33 +0200, Richard Biener wrote: > On Thu, Oct 13, 2016 at 3:51 PM, Bernd Schmidt > wrote: > > On 10/13/2016 03:49 PM, Richard Biener wrote: > > > > > > Does it really run a single pass only? Thus you can't do a { dg > > > -do run } > > > test > > > with __RTL? > > > >

Re: [PATCH] Add "__RTL" to cc1 (v2)

2016-10-14 Thread David Malcolm
On Fri, 2016-10-14 at 21:27 +0200, Bernd Schmidt wrote: > On 10/14/2016 09:25 PM, David Malcolm wrote: > > > > The behavior probably should be that it runs the remainder of the > > RTL > > passes from some specified point, and generates valid assembler (so > > tha

[PATCH] (v2) Tweaks to print_rtx_function

2016-10-14 Thread David Malcolm
On Thu, 2016-10-13 at 16:18 +0200, Bernd Schmidt wrote: > On 10/13/2016 04:08 PM, David Malcolm wrote: > > I thought it might be useful to brainstorm [1] some ideas on this, > > so here are various possible ways it could be printed for this use > > -case:

Re: fix -fmax-errors & notes

2016-10-14 Thread David Malcolm
On Fri, 2016-10-14 at 15:50 -0400, Nathan Sidwell wrote: > On 10/14/16 15:17, David Malcolm wrote: > > > "Limits the maximum number of error messages to @var{n}, at which > > point > > GCC bails out rather than attempting to continue processing the > > sou

[wwwdocs, coding conventions] Mention OVERRIDE/FINAL

2016-10-14 Thread David Malcolm
On Fri, 2016-10-14 at 16:27 +0100, Pedro Alves wrote: > On 10/12/2016 03:13 PM, Bernd Schmidt wrote: > > On 10/12/2016 04:09 PM, Pedro Alves wrote: > > > > > > Thanks. Here's a follow up patch that I was just testing. > > > > > > Need this if building with "g++ -std=gnu++11", with gcc < 4.7. > >

[PATCH] read-md.c: Move various state to within class rtx_reader (v3)

2016-10-17 Thread David Malcolm
On Mon, 2016-10-17 at 12:37 +0100, Richard Sandiford wrote: > David Malcolm writes: > > @@ -2388,8 +2389,10 @@ gen_mnemonic_setattr (htab_t mnemonic_htab, > > rtx insn) > > static int > > mnemonic_htab_callback (void **slot, void *info ATTRIBUTE_UNUSED)

Re: [PATCH 09/16] Split class rtx_reader into base_rtx_reader vs rtx_reader

2016-10-18 Thread David Malcolm
rtl.o everywhere due to read-rtl.c needing insn-constants.h, which is built by genconstants, which would be a circular dependency, hence the split between BUILD_MD vs BUILD_RTL in Makefile.in to break this cycle. On Tue, 2016-10-11 at 17:53 +0200, Bernd Schmidt wrote: > On 10/05/2016 06:15 P

Re: RTL frontend input format again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-19 Thread David Malcolm
On Fri, 2016-10-07 at 15:58 +0200, Bernd Schmidt wrote: > On 10/07/2016 03:26 PM, David Malcolm wrote: > > > > We could simply print the INSN_UID for CODE_LABELs; something like > > this > > (see the "(code_label 16" below): > > I think that should

Re: RTL frontend input format again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-19 Thread David Malcolm
On Wed, 2016-10-19 at 16:41 +0200, Bernd Schmidt wrote: > On 10/19/2016 04:35 PM, David Malcolm wrote: > > > In r241120 I dropped all dumping of the JUMP_LABEL when adding the > > "compact" mode. > > > > I'm now running into an issue with this as I

Re: RTL frontend input format again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-19 Thread David Malcolm
On Wed, 2016-10-19 at 19:22 +0200, Bernd Schmidt wrote: > On 10/19/2016 07:19 PM, David Malcolm wrote: > > I already dropped LABEL_NUSES in compact mode in r241120; I think > > it's > > possible to regenerate that information. > > > > But how would we go abo

RTL frontend, insn recognition, and pointer equality

2016-10-19 Thread David Malcolm
I've updated the RTL frontend to the new "compact" dump format and have it "mostly working", for some definition of that term [1]. I'm focusing on the "__RTL" extension to cc1, rather than having a true "rtl1" frontend. I've run into an issue with insn recognition relating to pointer equality of

INSN_UIDs again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-20 Thread David Malcolm
On Thu, 2016-10-06 at 15:30 +0200, Bernd Schmidt wrote: > On 10/05/2016 06:15 PM, David Malcolm wrote: > > +;; MEM[(struct isl_obj *)&obj1] = &isl_obj_map_vtable; > > +(insn 1045 0 1046 2 (set (reg:SI 480) > > +(high:SI (symbol_ref:SI ("isl_obj_map_vtable

Re: INSN_UIDs again (was Re: [PATCH 15/16] RTL frontend (rtl1), on top of dump reader)

2016-10-20 Thread David Malcolm
On Thu, 2016-10-20 at 16:11 +0200, Bernd Schmidt wrote: > On 10/20/2016 03:55 PM, David Malcolm wrote: > > Currently the jump insn in question looks like this: > > > > (cjump_insn (set (pc) > > (label_ref 20)) > > (nil))

Re: Implement -Wduplicated-branches (PR c/64279)

2016-10-20 Thread David Malcolm
On Thu, 2016-10-20 at 16:24 +0200, Marek Polacek wrote: > On Thu, Oct 20, 2016 at 10:11:55AM -0400, Jason Merrill wrote: > > On Wed, Oct 19, 2016 at 7:07 AM, Marek Polacek > > wrote: > > > But since integer csts and various decls > > > don't carry location info, this works only partially, so the >

Re: RTL frontend, insn recognition, and pointer equality

2016-10-20 Thread David Malcolm
On Thu, 2016-10-20 at 13:02 +0200, Bernd Schmidt wrote: > > On 10/20/2016 11:22 AM, Bernd Schmidt wrote: > > On 10/20/2016 01:49 AM, David Malcolm wrote: > > > > > > (b) for all codes for which rtx_equal_p requires pointer > > > equality, add > > >

[PATCH] Start adding selftests for print_rtx

2016-10-20 Thread David Malcolm
On Thu, 2016-10-20 at 17:43 +0200, Bernd Schmidt wrote: > On 10/20/2016 04:51 PM, David Malcolm wrote: > >(0|scratch:DI) > > > > with the insn as a whole looking like: > > > >(cinsn (set (mem/v:BLK (0|scratch:DI) [0 A8]) >

[PATCH] Start adding target-specific selftests

2016-10-21 Thread David Malcolm
On Fri, 2016-10-21 at 12:04 +0200, Bernd Schmidt wrote: > On 10/21/2016 02:36 AM, David Malcolm wrote: > > + /* Test dumping of hard regs. This is inherently target > > -specific due > > + to the name. */ > > +#ifdef I386_OPTS_H > > + ASSERT_RTL_DUMP_EQ (&

[PATCH] print_rtx: implement support for reuse IDs

2016-10-21 Thread David Malcolm
ich pointer-equality could occur, outside of a match_dup. On Thu, 2016-10-20 at 17:43 +0200, Bernd Schmidt wrote: > On 10/20/2016 04:51 PM, David Malcolm wrote: > >(0|scratch:DI) > > > > with the insn as a whole looking like: > > >

Ping Re: [PATCH] go-lang.c: remove a redundant cast

2016-10-21 Thread David Malcolm
On Fri, 2016-10-07 at 15:12 -0400, David Malcolm wrote: > Amongst many other changes, r146451 added this cast: > > -#define GET_MODE_CLASS(MODE) mode_class[MODE] > +#define GET_MODE_CLASS(MODE) ((enum mode_class) mode_class[MODE]) > > making a cast in go-lang.c re

[committed] Implement ~line_maps ()

2016-10-25 Thread David Malcolm
line_maps instances such as the global line_table are GC-managed, but the htab within location_adhoc_data_map.htab is not GC-managed. Previously this was deleted manually by a call to location_adhoc_data_fini within toplev::main. However, on adding a call to forcibly_ggc_collect after the selftes

[committed] input.c/libcpp: fix lifetimes of path buffers

2016-10-25 Thread David Malcolm
Running "make selftest-valgrind" showed various leaks of the form: 408 bytes in 24 blocks are definitely lost in loss record 572 of 679 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x1B0D057: xmalloc (xmalloc.c:148) by 0x1ACCAA1: append_file_to_dir(c

[PATCH] Introduce class rtx_writer

2016-10-26 Thread David Malcolm
On Tue, 2016-10-25 at 14:47 +0200, Bernd Schmidt wrote: > On 10/21/2016 10:27 PM, David Malcolm wrote: > > Thanks. I attemped to use those fields of recog_data, but it > > doesn't > > seem to be exactly what's needed here. > > Yeah, I may have been confus

[PATCH] Show INSN_UIDs in compact mode

2016-10-26 Thread David Malcolm
On Thu, 2016-10-20 at 16:11 +0200, Bernd Schmidt wrote: > On 10/20/2016 03:55 PM, David Malcolm wrote: > > Currently the jump insn in question looks like this: > > > > (cjump_insn (set (pc) > > (label_ref 20)) > > (nil))

Re: [PATCH 0/3] use rtx_insn * more

2016-11-02 Thread David Malcolm
On Wed, 2016-11-02 at 00:05 -0400, Trevor Saunders wrote: > On Mon, Oct 31, 2016 at 07:37:54AM -0600, Jeff Law wrote: > > On 10/28/2016 01:13 PM, tbsaunde+...@tbsaunde.org wrote: > > > From: Trevor Saunders > > > > > > HI, > > > > > > This series changes various variables type from rtx to rtx_in

[PATCH 2/2] C++ FE: handle misspelled identifiers and typenames

2016-06-30 Thread David Malcolm
This is a port of the C frontend's r237714 [1] to the C++ frontend: https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01052.html offering spelling suggestions for misspelled identifiers, macro names, and some keywords (e.g. "singed" vs "signed" aka PR c/70339). Unlike the C frontend, there doesn't s

[PATCH 1/2] C: convert return type of lookup_name_fuzzy from tree to const char *

2016-06-30 Thread David Malcolm
The followup patch implements lookup_name_fuzzy for the C++ frontend. It's cleaner for that implementation to return a const char *, so this patch updates the implementation in the C frontend to have the same return type. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu (in combination wit

Re: [BUILDROBOT] Selftest failed for i686-wrs-vxworks

2016-06-30 Thread David Malcolm
On Thu, 2016-06-30 at 08:38 -0400, Nathan Sidwell wrote: > Jan-Benedict, > > > I haven't given it any additional manual testing so far. It's > > pre-installation though. Maybe I'd just set WIND_BASE to some > > arbitrary value, just to make xgcc pass it's initial start-up test > > so > > that it c

Re: [PATCH 2/4] PR c++/62314: add fixit hint for "expected ';' after class definition"

2016-07-01 Thread David Malcolm
On Mon, 2016-05-02 at 12:40 +0200, Bernd Schmidt wrote: > On 04/28/2016 04:28 PM, David Malcolm wrote: > > whereas clang reportedly emits: > > > > test.c:2:12: error: expected ';' after struct > > struct a {} > > ^ > >

[PATCH] simplify-rtx.c: start adding selftests

2016-07-01 Thread David Malcolm
This patch starts adding selftests to simplify-rtx.c, to ensure that RTL expressions are simplified as we expect. It adds a new ASSERT_RTX_EQ macro that checks for pointer equality of two rtx values. If they're non-equal, it aborts, printing both expressions. For example: ../../src/gcc/simplify

[PATCH] simplify-rtx.c: start adding selftests (v2)

2016-07-06 Thread David Malcolm
On Sun, 2016-07-03 at 18:12 +0100, Richard Sandiford wrote: > David Malcolm writes: > > This patch starts adding selftests to simplify-rtx.c, to ensure > > that > > RTL expressions are simplified as we expect. > > > > It adds a new ASSERT_RTX_EQ macro that check

Re: [PATCH 0/9] separate shrink-wrapping

2016-07-08 Thread David Malcolm
On Fri, 2016-07-08 at 07:11 -0500, Segher Boessenkool wrote: > On Fri, Jul 08, 2016 at 12:42:34PM +0200, Bernd Schmidt wrote: > > On 06/14/2016 11:24 PM, Segher Boessenkool wrote: > > > On Wed, Jun 08, 2016 at 06:43:23PM +0200, Bernd Schmidt wrote: > > > > On 06/08/2016 05:16 PM, Segher Boessenkool

[PING] Re: [PATCH] input.c: add lexing selftests and a test matrix for line_table states

2016-07-08 Thread David Malcolm
Ping. I believe I need review of the selftest.h change; the rest I think I can self-approve, if need be. https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01340.html On Fri, 2016-06-17 at 17:41 -0400, David Malcolm wrote: > This patch adds explicit testing of lexing a source file, > genera

[PATCH] Support running the selftests under valgrind

2016-07-08 Thread David Malcolm
This patch adds a new phony target to gcc/Makefile.in to make it easy to run the selftests under valgrind, via "make selftest-valgrind". This phony target isn't a dependency of anything; it's purely for convenience (it takes about 4-5 seconds on my box). Doing so uncovered a few leaks in the selft

[PATCH] RFC: On-demand locations within string-literals

2016-07-08 Thread David Malcolm
This patch implements precise tracking of source locations for the individual chars within string literals, so that we can e.g. underline specific ranges in -Wformat diagnostics. It should also enable fixing PR inline-asm/57950 ("wrong line numbers in error messages for inline assembler statements

Re: [PATCH] Support running the selftests under valgrind

2016-07-09 Thread David Malcolm
On Fri, 2016-07-08 at 22:55 -0700, Andrew Pinski wrote: > On Fri, Jul 8, 2016 at 12:46 PM, David Malcolm > wrote: > > This patch adds a new phony target to gcc/Makefile.in to make it > > easy > > to run the selftests under valgrind, via "make selftest-valgrind&qu

Re: Importing gnulib into the gcc tree

2016-07-10 Thread David Malcolm
On Sun, 2016-07-10 at 22:13 +0100, Manuel López-Ibáñez wrote: > On 10 July 2016 at 17:04, Manuel López-Ibáñez > wrote: > > Hi Ayush, > > > > Some suggestions: > > Also, it may be a good idea to configure with: > > --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --enable > -multilib >

Re: Implement -Wswitch-fallthrough

2016-07-11 Thread David Malcolm
On Mon, 2016-07-11 at 22:20 +0200, Marek Polacek wrote: > On Mon, Jul 11, 2016 at 10:11:52PM +0200, Jakub Jelinek wrote: > > On Mon, Jul 11, 2016 at 10:08:02PM +0200, Eric Botcazou wrote: > > > > After I'd completed the warning, I kicked off a bootstrap so as > > > > to add > > > > various gcc_fall

Re: Implement -Wswitch-fallthrough

2016-07-11 Thread David Malcolm
On Mon, 2016-07-11 at 22:34 +0200, Jakub Jelinek wrote: > On Mon, Jul 11, 2016 at 10:23:30PM +0200, Marek Polacek wrote: > > On Mon, Jul 11, 2016 at 01:18:02PM -0700, Andi Kleen wrote: > > > > I explained why supporting the classic lint style comment > > > > wouldn't fly. > > > > > > Not convincin

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

2016-07-12 Thread David Malcolm
On Tue, 2016-07-12 at 08:45 -0600, Martin Sebor wrote: > On 07/12/2016 04:01 AM, Florian Weimer wrote: > > On 07/12/2016 11:54 AM, Jakub Jelinek wrote: > > > On Tue, Jul 12, 2016 at 11:51:50AM +0200, Florian Weimer wrote: > > > > On 07/01/2016 08:15 PM, Martin Sebor wrote: > > > > > The attached pa

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

2016-07-13 Thread David Malcolm
On Tue, 2016-07-12 at 16:35 -0600, Martin Sebor wrote: > On 07/12/2016 10:12 AM, Manuel López-Ibáñez wrote: > > On 12/07/16 16:59, Martin Sebor wrote: > > > You're probably right. I suspect I have a tendency to overuse > > > the quotes (e.g, the -Wplacement-new warning also quotes the > > > sizes)

Re: [C PATCH] Ignore invisible bindings for misspelling hints (PR c/71858)

2016-07-14 Thread David Malcolm
ommon/attributes-1.c.jj 2016-06-23 > 14:31:57.0 +0200 > +++ gcc/testsuite/c-c++-common/attributes-1.c 2016-07-14 > 14:51:34.871006659 +0200 > @@ -1,5 +1,5 @@ > /* { dg-do compile } */ > -/* { dg-prune-output "undeclared here \\(not in a function\\); did > you me

Re: [C PATCH] Ignore invisible bindings for misspelling hints (PR c/71858)

2016-07-14 Thread David Malcolm
On Thu, 2016-07-14 at 19:47 +0200, Jakub Jelinek wrote: > On Thu, Jul 14, 2016 at 01:22:27PM -0400, David Malcolm wrote: > > I wrote a patch for this, similar to yours, but with a slightly > > different approach for handling builtins. > > > > I think it's rea

Re: [PATCH] Tweak diagnostic-token.ranges.c testcase (PR testsuite/71865)

2016-07-14 Thread David Malcolm
On Thu, 2016-07-14 at 16:55 +0200, Jakub Jelinek wrote: > Hi! > > As mentioned in the PR, this testcase behaves differently on > powerpc*/spu/s390* targets, because in non-iso modes they predefine > conditional macros like bool and that affects the behavior of the > suggestions. > > We should cer

Re: [PATCH 2/2] C++ FE: handle misspelled identifiers and typenames

2016-07-14 Thread David Malcolm
On Wed, 2016-07-13 at 16:12 -0600, Jeff Law wrote: > On 06/30/2016 12:53 PM, David Malcolm wrote: > > This is a port of the C frontend's r237714 [1] to the C++ frontend: > > https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01052.html > > offering spelling suggestions

Re: [PATCH 2/2] Add selftests for fibonacci_heap

2016-07-19 Thread David Malcolm
On Tue, 2016-07-12 at 15:17 +0200, marxin wrote: Thanks for writing selftests! FWIW, some spelling nits below (I'm not a reviewer, and not familiar with our fibonacci heap implementation). > gcc/ChangeLog: > > 2016-07-13 Martin Liska > > * Makefile.in: Include fibonacci_heap.c >

[PATCH] selftest.c: gracefully handle NULL in assert_streq

2016-07-19 Thread David Malcolm
If a NULL is passed in as the expected or actual value for an ASSERT_STREQ, the call to strcmp within selftest::assert_streq can segfault, leading to a failure of -fself-test without indicating which test failed. Handle this more gracefully by checking for NULL, so that information on the failing

[committed] Fix copy&paste bug in function-tests.c

2016-07-19 Thread David Malcolm
I made a copy&paste error when writing selftest::verify_three_block_rtl_cfg, forgetting to update the basic block ptr when asserting the value of "flags". Fixed thusly. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. Verified -fself-test of stage1 on powerpc-ibm-aix7.1.3.0. Committed t

Re: [PATCH] simplify-rtx.c: start adding selftests (v2)

2016-07-19 Thread David Malcolm
On Wed, 2016-07-13 at 13:38 -0600, Jeff Law wrote: > On 07/06/2016 01:30 PM, David Malcolm wrote: > > > > > > This might be a bit confusing when more tests are added, since > > > pointer equality is only useful in certain specific cases (e.g. > > > when you

[PATCH v2] C++ FE: handle misspelled identifiers and typenames

2016-07-20 Thread David Malcolm
Changes in v2: - split out the non-C++ parts already approved by Jeff (I've committed these as r238522). - updated to mirror the fixes for PR c/71858 Jakub made to the corresponding C implementation in r238352, skipping anticipated decls of builtin functions - rewritten to more closely

Re: [PATCH] RFC: On-demand locations within string-literals

2016-07-20 Thread David Malcolm
On Fri, 2016-07-08 at 17:49 -0400, David Malcolm wrote: [...] > Also, this patch currently makes the assumption (in charset.c) > that there's a 1:1 correspondence between bytes in the source > character set and bytes in the execution character set. This can > be the case if bot

Re: [PATCH] Fix source locations of bad enum values (PR c/71610 and PR c/71613)

2016-07-20 Thread David Malcolm
On Wed, 2016-07-20 at 16:16 -0400, Jason Merrill wrote: > On Thu, Jun 30, 2016 at 1:49 PM, Jason Merrill > wrote: > > This needs a template testcase. > > Did you get this reply before? It bounced from the mailing list, but > I thought you would have gotten it directly. I did; sorry for not resp

Re: [PATCH 2/2] C++ FE: handle misspelled identifiers and typenames

2016-07-21 Thread David Malcolm
On Thu, 2016-07-21 at 09:00 +0200, Uros Bizjak wrote: > Hello! > > > > gcc/ChangeLog: > > > PR c/70339 > > > * diagnostic-show-locus.c (diagnostic_show_locus): If this is > > > the > > > same location as last time, don't skip if we have fix-it hints. > > > Clarify the skipping logic by converting

Re: [PATCH 2/2] C++ FE: handle misspelled identifiers and typenames

2016-07-21 Thread David Malcolm
On Thu, 2016-07-21 at 10:28 -0400, David Malcolm wrote: > On Thu, 2016-07-21 at 09:00 +0200, Uros Bizjak wrote: > > Hello! > > > > > > gcc/ChangeLog: > > > > PR c/70339 > > > > * diagnostic-show-locus.c (diagnostic_show_locus): If this is > &g

Re: [PATCH 2/2] C++ FE: handle misspelled identifiers and typenames

2016-07-21 Thread David Malcolm
On Thu, 2016-07-21 at 10:38 -0400, David Malcolm wrote: > On Thu, 2016-07-21 at 10:28 -0400, David Malcolm wrote: > > On Thu, 2016-07-21 at 09:00 +0200, Uros Bizjak wrote: > > > Hello! > > > > > > > > gcc/ChangeLog: > > > > > PR c/70339 &

[PATCH] Add a STATIC_ASSERT on sizeof (struct cp_token)

2016-07-22 Thread David Malcolm
On Fri, 2016-07-22 at 13:06 +0200, Jakub Jelinek wrote: > On Fri, Jul 22, 2016 at 12:44:07PM +0200, Marek Polacek wrote: > > --- gcc/gcc/cp/parser.h > > +++ gcc/gcc/cp/parser.h > > @@ -46,7 +46,7 @@ struct GTY (()) cp_token { > > Otherwise, this value is RID_MAX. */ > >ENUM_BITFIELD (rid

Re: [PATCH] RFC: On-demand locations within string-literals

2016-07-23 Thread David Malcolm
On Sat, 2016-07-23 at 15:35 -0600, Martin Sebor wrote: > On 07/08/2016 03:49 PM, David Malcolm wrote: > > This patch implements precise tracking of source locations for the > > individual chars within string literals, so that we can e.g. > > underline > > specific ran

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