[PATCH] Fix PR gcov-profile/46266

2016-09-27 Thread Martin Liška
Following patch prevents emission of gcno file (notes file) for statements that do not point to original source file, like: $ echo "int main(){}" > x.c In this case the location points to a builtin. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed?

Re: [PATCH, RFC] gcov: dump in a static dtor instead of in an atexit handler

2016-10-03 Thread Martin Liška
On 10/03/2016 03:03 PM, Rainer Orth wrote: > Hi Martin, > >> On 09/30/2016 02:31 PM, Rainer Orth wrote: >>> this would be i386-pc-solaris2.12. I'm not sure if the constructor >>> priority detection works in a cross scenario. >>> >>> I'm attaching the resulting assembly (although for Solaris as,

[PATCH, 02/N] Introduce tests for -fsanitize-address-use-after-scope

2016-10-03 Thread Martin Liška
Following patch adjusts expected test dumps and also introduces various new tests. Martin >From 4ddafab1e533a1d3580d2f883955d61fe23aa353 Mon Sep 17 00:00:00 2001 From: marxin Date: Mon, 19 Sep 2016 17:39:29 +0200 Subject: [PATCH 3/3] Introduce tests for

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-10-03 Thread Martin Liška
On 08/18/2016 03:36 PM, Jakub Jelinek wrote: > On Thu, May 12, 2016 at 04:12:21PM +0200, Martin Liška wrote: >> --- a/gcc/asan.c >> +++ b/gcc/asan.c >> @@ -243,6 +243,11 @@ static unsigned HOST_WIDE_INT asan_shadow_offset_value; >> static bool asan_shadow_offs

Re: [PATCH] Set -fprofile-update=atomic when -pthread is present

2016-10-03 Thread Martin Liška
On 08/18/2016 05:53 PM, Jeff Law wrote: > On 08/18/2016 09:51 AM, Andi Kleen wrote: >>> I'd prefer to make updates atomic in multi-threaded applications. >>> The best proxy we have for that is -pthread. >>> >>> Is it slower, most definitely, but odds are we're giving folks >>> garbage data

[PATCH] Remove HIST_TYPE_CONST_DELTA counter type (PR, gcov-profile/23332).

2016-09-26 Thread Martin Liška
Following patch removes old type of GCOV counter that was used in times when RTL instrumentation was done. Patch is preapproved by Honza. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Martin >From 75d56f7882d1bc40f7c638462bb6fec3b84c3732 Mon Sep 17 00:00:00 2001 From:

[PATCH, OBVIOUS] Fix documentation of gcov tool

2016-09-26 Thread Martin Liška
gcov program produces a different output compared to what's mentioned in documentation. Attached patch changes that. Installed as obvious. Martin >From 76d40ef712b42b60f74087a6ecbd6ee163554d5b Mon Sep 17 00:00:00 2001 From: marxin Date: Mon, 26 Sep 2016 13:51:55 +0200 Subject:

Re: [PATCH] Fix handling of -fsanitize-recover* options.

2016-09-26 Thread Martin Liška
On 09/23/2016 02:48 PM, Jakub Jelinek wrote: > On Fri, Sep 23, 2016 at 01:53:48PM +0200, Martin Liška wrote: >> 3) -fsanitize=leak is combinable with -fsanitize=address or >>-fsanitize=thread > > Is it really combinable with -fsanitize=thread? I thought only libasan

[PATCH] Remove __gcov_merge_delta (PR bootstrap/77749)

2016-09-27 Thread Martin Liška
Hello. Following patch removes forgotten hunks connected to removal of __gcov_merge_delta counter. I'm running make profiledbootstrap, ready to install the patch after it finishes? Thanks, Martin >From e0123fe1cefe5f5cced239c36ebccd53c38feb25 Mon Sep 17 00:00:00 2001 From: marxin

Re: [PATCH, RFC] gcov: dump in a static dtor instead of in an atexit handler

2016-09-29 Thread Martin Liška
On 09/29/2016 11:00 AM, Rainer Orth wrote: > Hi Martin, > >> On 08/12/2016 04:08 PM, Martin Liška wrote: >>> On 08/10/2016 02:53 PM, Nathan Sidwell wrote: >>>> On 08/10/16 06:43, Martin Liška wrote: >>>>> Hello. >>>>> >>

[PATCH] Fix host_size_t_cst_p predicate

2016-10-27 Thread Martin Liška
Running simple test-case w/o the proper header file causes ICE: strncmp ("a", "b", -1); 0xe74462 tree_to_uhwi(tree_node const*) ../../gcc/tree.c:7324 0x90a23f host_size_t_cst_p ../../gcc/fold-const-call.c:63 0x90a23f fold_const_call(combined_fn, tree_node*, tree_node*, tree_node*,

Re: ineffective dg-skip-if directive in asan/use-after-scope-8.c

2016-11-08 Thread Martin Liška
On 11/08/2016 05:28 PM, Martin Sebor wrote: > Hi Martin, > > I noticed a new failure in the use-after-scope-8.c test on powerpc64le: > > FAIL: gcc.dg/asan/use-after-scope-8.c -O0 (test for excess errors) > > with the error being > > use-after-scope-8.c:9:16: error: invalid register name

Re: [PATCH] Remove unneeded gcc_assert in gimplifier (PR sanitizer/78270)

2016-11-09 Thread Martin Liška
On 11/09/2016 02:29 PM, Jakub Jelinek wrote: > On Wed, Nov 09, 2016 at 02:16:45PM +0100, Martin Liška wrote: >> As shown in the attached test-case, the assert cannot always be true. >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> >> Ready

[PATCH] Remove unneeded gcc_assert in gimplifier (PR sanitizer/78270)

2016-11-09 Thread Martin Liška
As shown in the attached test-case, the assert cannot always be true. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From b55459461f3f7396a094be6801082715ddb4b30d Mon Sep 17 00:00:00 2001 From: marxin Date: Wed, 9 Nov

Re: [PATCH] Fix folding of memcmp("a", "a", 2) (PR, tree-optimization/78257)

2016-11-09 Thread Martin Liška
On 11/09/2016 02:58 PM, Richard Biener wrote: > On Wed, Nov 9, 2016 at 2:56 PM, Martin Liška <mli...@suse.cz> wrote: >> Hello. >> >> Following patch fixes [1] (f0 function), where we have off-by-one error. >> Patch can bootstrap on ppc64le-redhat-linux and survi

[PATCH] Fix folding of memcmp("a", "a", 2) (PR, tree-optimization/78257)

2016-11-09 Thread Martin Liška
Hello. Following patch fixes [1] (f0 function), where we have off-by-one error. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78257#c0 >From d7c46e5eb4d295d7653eae188cae04a8f7f0719f Mon

Re: Question about lambda function variables

2016-11-08 Thread Martin Liška
On 11/08/2016 10:12 AM, Jakub Jelinek wrote: > On Tue, Nov 08, 2016 at 09:58:13AM +0100, Martin Liška wrote: >> Problematic is lambda function (use-after-scope-ice-1.ii.004t.gimple): >> C::AsyncCloseConnectionWithErrorMsg(const A&)::<lambda()> (const struct >&

Re: Fix build of jit (was Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v3))

2016-11-08 Thread Martin Liška
On 11/07/2016 05:17 PM, Jakub Jelinek wrote: > On Mon, Nov 07, 2016 at 11:07:13AM -0500, David Malcolm wrote: >> The patch (r241896) introduced an error in the build of the jit: >> >> ../../src/gcc/jit/jit-builtins.c:62:1: error: invalid conversion from >> ‘int’ to ‘gcc::jit::built_in_attribute’

Question about lambda function variables

2016-11-08 Thread Martin Liška
Hello. After I've installed the patch, there's a small fallout I've been working on. On of issue I met are lambda functions where we current ICE: $ cat /tmp/use-after-scope-ice-1.ii class A { public: A () : value (123) {} int value; }; template class B { public: template B (F p1) :

[PATCH] use-after-scope fallout

2016-11-08 Thread Martin Liška
Hello. This is fallout fix where I changed: 1) Fix ICE for lambda functions (added test-case: use-after-scope-4.C) 2) Fix ICE in gimplify_switch_expr, at gimplify.c:2269 (fixed by not adding artificial variables) 3) PR testsuite/78242 - I basically removed the test (not interesting) 4) LEAF and

Re: [PATCH] Introduce -fprofile-update=maybe-atomic

2016-11-11 Thread Martin Liška
On 11/10/2016 06:31 PM, Nathan Sidwell wrote: > On 11/10/2016 08:24 AM, Martin Liška wrote: >> On 11/10/2016 05:17 PM, David Edelsohn wrote: >>> Maybe instead of adding "maybe", we need to change the severity of the >>> warning so that the warning is

[PATCH] Fix PR sanitizer/78270 (part 2)

2016-11-11 Thread Martin Liška
Hello. Due to a stupid mistake I did, following patch is needed for the test-case to properly save previous gimplify_ctxp->live_switch_vars. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. I was able to run asan bootstrap on x86_64-linux-gnu and kernel build with

[PATCH] Dump probability for edges a frequency for BBs

2016-11-11 Thread Martin Liška
Hello. I spent quite time during this stage1 playing with predictors and we found with Honza multiple situations where a prediction was oddly calculated. Thus, we're suggesting to enhance default dump format to show BB frequencies and edge probabilities, as follows: main (int a) { int _1;

[PATCH] Introduce -fdump-ipa-clones dump output

2016-11-11 Thread Martin Liška
Hello. Motivation for the patch is to dump IPA clones that were created by all inter-procedural optimizations. Usage of such input is to track set of functions where a code from another function can eventually occur. Usage of the dump file can be seen here: [1]. Patch can bootstrap on

Re: [PATCH] Support no newline in print_gimple_stmt

2016-11-11 Thread Martin Liška
On 11/11/2016 01:10 PM, Richard Biener wrote: > On Thu, Nov 10, 2016 at 4:36 PM, Martin Liška <mli...@suse.cz> wrote: >> I've just noticed that tree-ssa-dse wrongly prints a new line to dump file. >> For the next stage1, I'll go through usages of print_gimple_stmt and remo

[PATCH] Fix print_node for CONSTRUCTORs

2016-11-10 Thread Martin Liška
Hello. Following patch fixes indentation of print_node when printing a constructor that has some equal elements. Current implementation caches tree to prevent deep debug outputs. Such behavior is undesired for ctor elements. Apart from that, I switch to hash_set for a table that is used for tree

Re: [PATCH] Introduce -fprofile-update=maybe-atomic

2016-11-10 Thread Martin Liška
PING^2 On 10/31/2016 10:13 AM, Martin Liška wrote: > PING^1 > > On 10/13/2016 05:34 PM, Martin Liška wrote: >> Hello. >> >> As it's very hard to guess from GCC driver whether a target supports atomic >> updates >> for GCOV counter or not, I decided to com

Re: [PATCH] Remove unneeded gcc_assert in gimplifier (PR sanitizer/78270)

2016-11-10 Thread Martin Liška
On 11/09/2016 02:47 PM, Martin Liška wrote: > On 11/09/2016 02:29 PM, Jakub Jelinek wrote: >> On Wed, Nov 09, 2016 at 02:16:45PM +0100, Martin Liška wrote: >>> As shown in the attached test-case, the assert cannot always be true. >>> Patch can bootstrap on ppc64l

[PATCH] Support no newline in print_gimple_stmt

2016-11-10 Thread Martin Liška
I've just noticed that tree-ssa-dse wrongly prints a new line to dump file. For the next stage1, I'll go through usages of print_gimple_stmt and remove extra new lines like: gcc/auto-profile.c: print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); gcc/auto-profile.c- fprintf (dump_file,

Re: [PATCH] Introduce -fprofile-update=maybe-atomic

2016-11-10 Thread Martin Liška
On 11/10/2016 04:43 PM, Nathan Sidwell wrote: > On 11/10/2016 05:19 AM, Martin Liška wrote: > >>> On 10/13/2016 05:34 PM, Martin Liška wrote: >>>> Hello. >>>> >>>> As it's very hard to guess from GCC driver whether a target supports >>

Re: [PATCH] Introduce -fprofile-update=maybe-atomic

2016-11-10 Thread Martin Liška
On 11/10/2016 05:17 PM, David Edelsohn wrote: > Maybe instead of adding "maybe", we need to change the severity of the > warning so that the warning is not emitted by default. Adding the warning option to -Wextra can be solution. Is it acceptable approach? Martin

Re: [PATCH] Make direct emission of time profiler counter

2016-11-07 Thread Martin Liška
On 11/05/2016 09:38 AM, Jan Hubicka wrote: > Looks OK if it passes. > > Honza Thanks, fixed on trunk as r241894. Martin

Re: [PATCH, 02/N] Introduce tests for -fsanitize-address-use-after-scope (v3)

2016-11-07 Thread Martin Liška
Third version of the patch. Martin >From e790d926afd3d2d6ad41d14d1e91698bf651b41a Mon Sep 17 00:00:00 2001 From: marxin Date: Mon, 19 Sep 2016 17:39:29 +0200 Subject: [PATCH 2/2] Introduce tests for -fsanitize-address-use-after-scope gcc/testsuite/ChangeLog: 2016-09-26 Martin

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v3)

2016-11-07 Thread Martin Liška
Hello. After discussion with Jakub, I'm resending new version of the patch, where I changed following: 1) gimplify_ctxp->live_switch_vars is used to track variables introduced in switch_expr. Every time a case_label_expr is seen, these are unpoisoned. It's quite conservative, however it

[PATCH, OBVIOUS] Replace NULL with false as a return value

2016-10-19 Thread Martin Liška
Hello. Replacing NULL with false in a method with the boolean return type should be obvious. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Martin >From 9071aa82e0203cf71fcc743f2e94aa7151986b6e Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 18 Oct

[PATCH] Do not disable aggressive loop opts for, -fsanitize=unreachable or leak

2016-10-19 Thread Martin Liška
Hello. This patch allows aggressive loop optimizations and strict overflow when -fsanitize=unreachabne or -fsanitize=leak is (are) enabled. That would help kernel people to have assumption that every functions should either end with jmp ret or by __builtin___ubsan_handle_builtin_unreachable.

Re: [PATCH] Do not merge BBs with a different EH landing pads (PR, tree-optimization/77943)

2016-10-14 Thread Martin Liška
On 10/13/2016 11:39 AM, Richard Biener wrote: > Yes, as said, the patch is ok as-is. > > Richard. Installed, I've just tested the patch on 5 and 6 branch. May I install it as well? M.

Re: [PATCH] Check \0-termination of string in c_getstr (simplified version)

2016-10-14 Thread Martin Liška
On 10/14/2016 11:38 AM, Richard Biener wrote: > On Thu, Oct 13, 2016 at 5:23 PM, Martin Liška <mli...@suse.cz> wrote: >> Hello. >> >> After receiving feedback from Richi and Wilco Dijkstra, I decided to fully >> not >> support not null-terminate

[PATCH] Do not fixup edges for a thunk in LTRANS (PR lto/78049)

2016-10-20 Thread Martin Liška
Hello. Following patch fixes issue mentioned in $subject. Problem is connected to thunks that become expanded during WPA phase of LTO. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From a41a5b1e3b7451c711c520b38f4603c2976a4b02 Mon Sep

Re: [PATCH] Fix not caught use-after-scope with -O1 (PR sanitize/78106)

2016-10-25 Thread Martin Liška
On 10/25/2016 01:52 PM, Jakub Jelinek wrote: > On Tue, Oct 25, 2016 at 01:40:03PM +0200, Martin Liška wrote: >> While reading and trying to understand sanopt code, I've noticed that we can >> possibly >> optimize out a ASAN_CHECK when there's a BB in between DOM(BB) and BB

Re: [RFC] Speed-up -fprofile-update=atomic

2016-10-25 Thread Martin Liška
On 10/24/2016 03:51 PM, Richard Biener wrote: > It's quite ad-hoc :/ The IFN will also be a memory optimization > barrier unless you add special support > for it in the alias oracle - so the performance measurement needs to > be taken with a grain of salt > (same is true for all atomics of

[PATCH] Fix 2 typos in IPA ICF pass

2016-10-25 Thread Martin Liška
Hi. Simple fix for a typo in IPA ICF. It cant' cause a regression as cl_target_option_eq function is called in equals_wpa function. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From e4f9f913c32109a2773145870333ae88fc9cdae2 Mon Sep 17

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-10-25 Thread Martin Liška
On 10/21/2016 04:26 PM, Jakub Jelinek wrote: > My memory is weak, but isn't this something the sanopt pass > (sanopt_optimize) is already doing similarly for e.g. ASAN_CHECK, UBSAN_NULL > and UBSAN_VPTR checks? For ASAN_MARK, you actually don't care about any > calls, those shouldn't unpoison or

[PATCH] Fix not caught use-after-scope with -O1 (PR sanitize/78106)

2016-10-25 Thread Martin Liška
Hello. While reading and trying to understand sanopt code, I've noticed that we can possibly optimize out a ASAN_CHECK when there's a BB in between DOM(BB) and BB which can call a freeing function. Ready to be installed after it survives regression tests? Martin >From

Re: [RFC] Speed-up -fprofile-update=atomic

2016-10-24 Thread Martin Liška
On 10/17/2016 02:03 PM, Richard Biener wrote: > On Mon, Oct 17, 2016 at 1:46 PM, Martin Liška <mli...@suse.cz> wrote: >> On 10/13/2016 11:43 AM, Richard Biener wrote: >>> On Wed, Oct 12, 2016 at 3:52 PM, Martin Liška <mli...@suse.cz> wrote: >>>> On

Re: [PATCH] Don't use priority {cd}tors if not supported by a target (PR, gcov-profile/78086)

2016-11-14 Thread Martin Liška
PING^1 On 10/31/2016 01:13 PM, Martin Liška wrote: > On 10/31/2016 11:07 AM, Rainer Orth wrote: >> Hi Martin, >> >>> Using priority {cd}tors on a target that does not support that can cause >>> failures (see the PR). >>> Apart from that, I deci

[PATCH] vimrc: fix TAB settings

2016-11-14 Thread Martin Liška
Hello. Following patch adds TAB settings to contrib/vimrc file. Hope it looks reasonable? Thanks, Martin >From 84eb32c4e84b87d690033f7505b8570427ab8468 Mon Sep 17 00:00:00 2001 From: marxin Date: Sun, 13 Nov 2016 12:05:48 +0100 Subject: [PATCH] vimrc: fix TAB settings ---

[OBVIOUS] [PATCH] Fix documentation reference (PR web/71666)

2016-11-25 Thread Martin Liška
The patch is selecting the proper section where -fprofile-generate is documented. Martin >From 00a7b92ef9bc7158a3e7202deb9b18b8d95dd5d2 Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 25 Nov 2016 15:11:48 +0100 Subject: [PATCH] Fix documentation reference (PR web/71666)

[PATCH] Fill bitregion_{start,end} in store_constructor (PR, tree-optimization/78428).

2016-11-23 Thread Martin Liška
Following patch fixes situation where we do a store to a bitfield which is at boundary of a record. This leads to usage of wider store, leading to overwriting a following memory location. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Apart from that, the reported

Re: [PATCH] i386.c: Initialize function pointers to NULL to prevent, -Wmaybe-uninitialized

2016-11-23 Thread Martin Liška
On 11/23/2016 11:12 AM, Jakub Jelinek wrote: > On Wed, Nov 23, 2016 at 11:06:23AM +0100, Martin Liška wrote: >> I see broken bootstrap due to: >> >> .././../gcc/config/i386/i386.c: In function ‘rtx_def* >> ix86_expand_builtin(tree, rtx, rtx, machine_mode, int)’: >&g

[PATCH] i386.c: Initialize function pointers to NULL to prevent, -Wmaybe-uninitialized

2016-11-23 Thread Martin Liška
I see broken bootstrap due to: .././../gcc/config/i386/i386.c: In function ‘rtx_def* ix86_expand_builtin(tree, rtx, rtx, machine_mode, int)’: .././../gcc/config/i386/i386.c:38407:18: error: ‘fcn’ may be used uninitialized in this function [-Werror=maybe-uninitialized] emit_insn (fcn

Re: [PATCH] Don't use priority {cd}tors if not supported by a target (PR, gcov-profile/78086)

2016-11-23 Thread Martin Liška
PING^2 On 11/14/2016 01:12 PM, Martin Liška wrote: > PING^1 > > On 10/31/2016 01:13 PM, Martin Liška wrote: >> On 10/31/2016 11:07 AM, Rainer Orth wrote: >>> Hi Martin, >>> >>>> Using priority {cd}tors on a target that does not support that can caus

Re: [RFC][PATCH] Speed-up use-after-scope (re-writing to SSA)

2016-11-23 Thread Martin Liška
I started review process in libsanitizer: https://reviews.llvm.org/D26965 And I have a question that was asked in the review: can we distinguish between load and store in case of having usage of ASAN_POISON? Load looks as follows: int main (int argc, char **argv) { char *ptr; if (argc !=

Re: [PATCH] Add sem_item::m_hash_set (PR ipa/78309) (v2)

2016-11-23 Thread Martin Liška
On 11/21/2016 04:50 PM, Jan Hubicka wrote: > OK, > thanks! > Honza Hi. Patch to trunk is already installed. Equal patch can be installed to gcc-6 branch, however gcc-5 branch needs more hunks to be adjusted. I did so, both patches survive regression tests and the patch for gcc-5 provides equal

[PATCH] Fix PR bootstrap/78493

2016-11-23 Thread Martin Liška
Hello. As described in the PR, the patch fixes profiled bootstrap on x86_64-linux-gnu. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. And profiled bootstrap on x86_64-linux-gnu finishes successfully. Ready to be installed? Martin >From

Re: [RFC][PATCH] Speed-up use-after-scope (re-writing to SSA)

2016-11-22 Thread Martin Liška
On 11/16/2016 05:28 PM, Jakub Jelinek wrote: > On Wed, Nov 16, 2016 at 05:01:31PM +0100, Martin Liška wrote: >> + use_operand_p use_p; >> + imm_use_iterator imm_iter; >> + FOR_EACH_IMM_USE_FAST (use_p, imm_iter, poisoned_var) >> +{ >> +

Re: [PATCH] Fix PR bootstrap/78493

2016-11-24 Thread Martin Liška
On 11/24/2016 10:09 AM, Jakub Jelinek wrote: > On Thu, Nov 24, 2016 at 09:51:49AM +0100, Richard Biener wrote: >> On Thu, Nov 24, 2016 at 9:36 AM, Jakub Jelinek wrote: >>> On Thu, Nov 24, 2016 at 09:26:25AM +0100, Richard Biener wrote: > Alternately, given all the problems

Re: [PATCH] Dump probability for edges a frequency for BBs

2016-11-24 Thread Martin Liška
On 11/24/2016 09:29 AM, Richard Biener wrote: > Please guard with ! TDF_GIMPLE, otherwise the output will not be parseable > with the GIMPLE FE. > > RIchard. Done and verified that and it provides equal dumps for -fdump*-gimple. Installed as r242837. Thanks for review. Martin >From

Re: [PATCH] Fix Ada bootstrap

2016-11-25 Thread Martin Liška
On 11/25/2016 10:20 AM, Richard Biener wrote: > > Bootstrap and testing in progress. > > Richard. > > 2016-11-25 Richard Biener > > * gimple-fold.c (fold_stmt_1): Check may_propagate_copy > before valueizing return stmts. > > Index: gcc/gimple-fold.c >

[PATCH] Add sem_item::m_hash_set (PR ipa/78309)

2016-11-15 Thread Martin Liška
Hi. As seen on ppc64le during compilation of Firefox with LTO, combining inchash value with a pointer, enum value and an integer, one can eventually get zero value. Thus I decided to introduce a new flag that would distinguish between not set hash value and a valid and (possibly) zero value.

Re: [RFC][PATCH] Speed-up use-after-scope (re-writing to SSA)

2016-11-16 Thread Martin Liška
On 11/16/2016 01:25 PM, Martin Liška wrote: > Hello > > Following patch is a candidate that re-writes VAR_DECLs that are > is_gimple_reg_type with: > my_char_25 = ASAN_POISON (); > > that is eventually transformed to: > __builtin___asan_report_use_after_sco

Re: [PATCH] Add sem_item::m_hash_set (PR ipa/78309) (v2)

2016-11-16 Thread Martin Liška
On 11/15/2016 05:46 PM, Jan Hubicka wrote: > Yep, zero is definitly valid hash value:0 > > Patch is OK. We may consider backporting it to release branches. > Honza Thanks, sending v2 as I found an error in the previous version. Changes from last version: - comments for ctors are just in header

[RFC][PATCH] Speed-up use-after-scope (re-writing to SSA)

2016-11-16 Thread Martin Liška
Hello Following patch is a candidate that re-writes VAR_DECLs that are is_gimple_reg_type with: my_char_25 = ASAN_POISON (); that is eventually transformed to: __builtin___asan_report_use_after_scope_noabort ("my_char", 1); at places where my_char_25 is used. That introduces a new entry point

Re: [PATCH] Fix PR sanitizer/78270 (part 2)

2016-11-16 Thread Martin Liška
I'm pinging this as it breaks ASAN bootstrap. On 11/11/2016 02:44 PM, Martin Liška wrote: > Hello. > > Due to a stupid mistake I did, following patch is needed for the test-case > to properly save previous gimplify_ctxp->live_switch_vars. > > Patch can bootstrap on

Re: [PATCH] Fix PR sanitizer/78270 (part 2)

2016-11-16 Thread Martin Liška
On 11/16/2016 12:35 PM, Jakub Jelinek wrote: > On Fri, Nov 11, 2016 at 02:44:40PM +0100, Martin Liška wrote: >> Hello. >> >> Due to a stupid mistake I did, following patch is needed for the test-case >> to properly save previous gimplify_ctxp->live_switch_vars. >&g

Re: [RFC][PATCH] Speed-up use-after-scope (re-writing to SSA)

2016-11-16 Thread Martin Liška
As the patch quite significantly slowed down tramp3d, there's analysis of # of variables which are poisoned by the sanitizer: == normal variables == 24 B: 348x (5.80%) 16 B: 273x (4.55%) 8 B: 237x (3.95%) 1 B: 177x (2.95%) 4 B: 119x (1.98%) 40 B: 89x (1.48%) 144 B:

Re: [RFC][PATCH] Speed-up use-after-scope (re-writing to SSA)

2016-11-16 Thread Martin Liška
On 11/16/2016 02:07 PM, Jakub Jelinek wrote: > On Wed, Nov 16, 2016 at 01:25:04PM +0100, Martin Liška wrote: >> >> + >> +/* Expand the ASAN_{LOAD,STORE} builtins. */ > > Stale comment. Fixed. > >> + >> +bool >> +as

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-01 Thread Martin Liška
On 10/27/2016 07:23 PM, Jakub Jelinek wrote: > Ok for trunk with that change. > > Jakub Hello. I'll commit the patch as soon as following patch would be accepted. The patch fixes false positives when running asan-bootstrap. Patch can bootstrap on ppc64le-redhat-linux and survives

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-01 Thread Martin Liška
On 11/01/2016 03:53 PM, Jakub Jelinek wrote: > On Tue, Nov 01, 2016 at 03:47:54PM +0100, Martin Liška wrote: >> On 10/27/2016 07:23 PM, Jakub Jelinek wrote: >>> Ok for trunk with that change. >>> >>> Jakub >> >> Hello. >> >> I'll c

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-01 Thread Martin Liška
On 10/27/2016 07:23 PM, Jakub Jelinek wrote: > On Thu, Oct 27, 2016 at 04:40:30PM +0200, Martin Liška wrote: >> On 10/21/2016 04:26 PM, Jakub Jelinek wrote: >>> On Wed, Oct 12, 2016 at 04:07:53PM +0200, Martin Liška wrote: >>>>> Ok, first let me list some

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-02 Thread Martin Liška
On 11/01/2016 03:53 PM, Jakub Jelinek wrote: > What kind of false positives it is for each case? Is it with normal > asan-bootstrap (without your -fsanitize-use-after-scope changes), or > only with those changes, or only with those changes and > -fsanitize-use-after-scope used during bootstrap?

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-02 Thread Martin Liška
On 11/01/2016 04:12 PM, Jakub Jelinek wrote: > On Tue, Nov 01, 2016 at 03:53:46PM +0100, Martin Liška wrote: >> @@ -1504,7 +1505,7 @@ non_rewritable_lvalue_p (tree lhs) >> >> static void >> maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs,

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-02 Thread Martin Liška
On 11/02/2016 10:40 AM, Richard Biener wrote: > On Tue, Nov 1, 2016 at 4:12 PM, Jakub Jelinek <ja...@redhat.com> wrote: >> On Tue, Nov 01, 2016 at 03:53:46PM +0100, Martin Liška wrote: >>> @@ -1504,7 +1505,7 @@ non_rewritable_lvalue_p (tree lhs) >>> >>>

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-02 Thread Martin Liška
On 11/02/2016 10:59 AM, Jakub Jelinek wrote: > On Wed, Nov 02, 2016 at 10:36:44AM +0100, Martin Liška wrote: >> On 11/01/2016 03:53 PM, Jakub Jelinek wrote: >>> What kind of false positives it is for each case? Is it with normal >>> asan-bootstrap (without your -fsanit

[PATCH] Convert character arrays to string csts

2016-11-03 Thread Martin Liška
Hello. This is small follow-up of the patches I sent to string folding. The patch transforms character array defined in an initializer to string constant: +const char global[] = {'a', 'b', 'c', 'd', '\0'}; Apart from that, it also enables string folding of local symbols like: + const char

Re: [PATCH] Create x.gcov file for binary w/o x.gcda file (PR, gcov-profile/65831)

2016-11-03 Thread Martin Liška
On 08/04/2016 02:52 PM, Nathan Sidwell wrote: > On 08/04/16 08:27, Martin Liška wrote: >> Hi. >> >> Following patch is grabbed from the PR, where I just applied the patch >> and wrote a test-case which removes x.gcda file before running gcov tool. >> >>

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-03 Thread Martin Liška
On 11/02/2016 03:51 PM, Jakub Jelinek wrote: > On Wed, Nov 02, 2016 at 03:38:25PM +0100, Martin Liška wrote: >> it converts: >> foo () >> { >> char a; >> char * p; >> char _1; >> int _2; >> int _8; >> int _9; >> >>

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-03 Thread Martin Liška
s can be done even in stage3. I know that it's much urgent to have it done first. I'm currently testing patch for the switch + declaration. Hopefully I'll send it today. > > On Thu, Nov 03, 2016 at 02:34:47PM +0100, Martin Liška wrote: >> I'm having a semi-working patch that comes up with the

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-03 Thread Martin Liška
On 11/03/2016 03:03 PM, Jakub Jelinek wrote: > On Thu, Nov 03, 2016 at 03:02:21PM +0100, Martin Liška wrote: >>> But how would you be able to find out if there isn't any return *ptr; after >>> the scope or similar (as MEM_REF)? With is_gimple_reg, they will be turned >>

[PATCH] Make direct emission of time profiler counter

2016-11-03 Thread Martin Liška
Hello. As Honza noticed we spent quite some time in __gcov_time_profiler: perf report for Postgres make check command: 4.10% postgres postgres[.]__gcov_time_profiler Thus I rewrote the profiling code directly to GIMPLE statements: _4 = __gcov7.main[0]; if (_4 == 0) goto ; else

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-10-27 Thread Martin Liška
On 10/21/2016 04:26 PM, Jakub Jelinek wrote: > On Wed, Oct 12, 2016 at 04:07:53PM +0200, Martin Liška wrote: >>> Ok, first let me list some needed follow-ups that don't need to be handled >>> right away: >>> - r237814-like changes for ASAN_MARK I've spent quite

Re: [PATCH] Fix host_size_t_cst_p predicate

2016-10-27 Thread Martin Liška
On 10/27/2016 03:35 PM, Richard Biener wrote: > On Thu, Oct 27, 2016 at 9:41 AM, Martin Liška <mli...@suse.cz> wrote: >> Running simple test-case w/o the proper header file causes ICE: >> strncmp ("a", "b", -1); >> >> 0xe74462 tree_to_uh

Re: [PATCH] Fix host_size_t_cst_p predicate

2016-10-31 Thread Martin Liška
On 10/31/2016 01:12 AM, Richard Sandiford wrote: > Richard Biener <richard.guent...@gmail.com> writes: >> On Thu, Oct 27, 2016 at 5:06 PM, Martin Liška <mli...@suse.cz> wrote: >>> On 10/27/2016 03:35 PM, Richard Biener wrote: >>>> On Thu, Oct 27, 201

[PATCH] Don't use priority {cd}tors if not supported by a target (PR, gcov-profile/78086)

2016-10-31 Thread Martin Liška
Hi. Using priority {cd}tors on a target that does not support that can cause failures (see the PR). Apart from that, I decided to use priority 100 for both gcov_init and gcov_exit functions as the reserved range includes priority 100. Moreover, I enhanced test-cases we have. Patch can

Re: [PATCH] Introduce -fprofile-update=maybe-atomic

2016-10-31 Thread Martin Liška
PING^1 On 10/13/2016 05:34 PM, Martin Liška wrote: > Hello. > > As it's very hard to guess from GCC driver whether a target supports atomic > updates > for GCOV counter or not, I decided to come up with a new option value > (maybe-atomic), > that would be transformed in

Re: [PATCH] Don't use priority {cd}tors if not supported by a target (PR, gcov-profile/78086)

2016-10-31 Thread Martin Liška
On 10/31/2016 11:07 AM, Rainer Orth wrote: > Hi Martin, > >> Using priority {cd}tors on a target that does not support that can cause >> failures (see the PR). >> Apart from that, I decided to use priority 100 for both gcov_init and >> gcov_exit functions as >> the reserved range includes

Re: [PATCH] Fix host_size_t_cst_p predicate

2016-10-31 Thread Martin Liška
>> <richard.sandif...@arm.com> wrote: >>>> Richard Biener <richard.guent...@gmail.com> writes: >>>>> On Mon, Oct 31, 2016 at 10:10 AM, Martin Liška <mli...@suse.cz> wrote: >>>>>> On 10/31/2016 01:12 AM, Richard Sandiford wrote: >>>&g

Re: [PATCH] Make direct emission of time profiler counter

2016-11-04 Thread Martin Liška
On 11/04/2016 10:18 AM, Christophe Lyon wrote: > On 3 November 2016 at 16:11, Jan Hubicka wrote: >>> >>> 2016-10-31 Martin Liska >>> >>> * libgcov-profiler.c (__gcov_time_profiler): Remove. >>> (__gcov_time_profiler_atomic): Likewise. >>> >>>

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-04 Thread Martin Liška
On 11/02/2016 03:35 PM, Jakub Jelinek wrote: > On Wed, Nov 02, 2016 at 03:27:42PM +0100, Martin Liška wrote: >>> So is there anything I should do wrt -Wswitch-unreachable? >>> >>> Marek >>> >> >> Probably not. I'm having a patch

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-04 Thread Martin Liška
On 11/04/2016 10:32 AM, Jakub Jelinek wrote: > Hi! > > On Fri, Nov 04, 2016 at 10:17:31AM +0100, Martin Liška wrote: >> diff --git a/gcc/gimplify.c b/gcc/gimplify.c >> index 813777d..86ce793 100644 >> --- a/gcc/gimplify.c >> +++ b/gcc/gimplify.c >> @@ -1678

Re: [PATCH] Convert character arrays to string csts

2016-11-04 Thread Martin Liška
On 11/03/2016 01:46 PM, Richard Biener wrote: > On Thu, Nov 3, 2016 at 1:12 PM, Martin Liška <mli...@suse.cz> wrote: >> Hello. >> >> This is small follow-up of the patches I sent to string folding. >> The patch transforms character array defined in an

Re: [PATCH] Make direct emission of time profiler counter

2016-11-04 Thread Martin Liška
On 11/04/2016 11:14 AM, Martin Liška wrote: > Hello. > > Sorry for the breakage, I'm attaching untested patch which fixes that. > I'm going to trigger regression tests. > > Martin Regression tests have finished on ppc64le-redhat-linux. Ready to be installed? Martin

Re: [PATCH] Convert character arrays to string csts

2016-11-04 Thread Martin Liška
On 11/03/2016 02:00 PM, Jan Hubicka wrote: >> On 11/03/2016 01:12 PM, Martin Liška wrote: >>> + tree init = DECL_INITIAL (decl); >>> + if (init >>> + && TREE_READONLY (decl) >>> + && can_convert_ctor_to_string_cst (init)) >&

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-02 Thread Martin Liška
On 11/02/2016 03:20 PM, Marek Polacek wrote: > On Wed, Nov 02, 2016 at 11:10:53AM +0100, Jakub Jelinek wrote: >> On Wed, Nov 02, 2016 at 10:59:26AM +0100, Jakub Jelinek wrote: Which is gimplified as: int * ptr; switch (argc) , case 1: > { int a;

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-02 Thread Martin Liška
On 11/02/2016 03:51 PM, Jakub Jelinek wrote: > On Wed, Nov 02, 2016 at 03:38:25PM +0100, Martin Liška wrote: >> it converts: >> foo () >> { >> char a; >> char * p; >> char _1; >> int _2; >> int _8; >> int _9; >> >>

Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2)

2016-11-02 Thread Martin Liška
On 11/02/2016 02:16 PM, Richard Biener wrote: > On Wed, Nov 2, 2016 at 2:06 PM, Jakub Jelinek wrote: >> On Wed, Nov 02, 2016 at 01:59:00PM +0100, Richard Biener wrote: Yeah, that is what I meant. The issue is how to report uses of such SSA_NAME when there is no

Re: [PATCH, RFC] gcov: dump in a static dtor instead of in an atexit handler

2016-10-13 Thread Martin Liška
On 10/13/2016 04:31 PM, Rainer Orth wrote: > Hi Martin, > >> Good! How does it look with the former solaris targets that does not support >> prioritized ctors? > > still no failures there, neither with ld (which lacks constructor > priority support) nor with gld (which has it). Only Solaris 12

[PATCH] Fold __builtin_str{n}{case}cmp functions (simplified version 4)

2016-10-13 Thread Martin Liška
Simplified version that just supports only null-terminated strings. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From 41c49024a02cff43774903206ad77b2ae161e81a Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 13 Oct 2016

[PATCH] Introduce -fprofile-update=maybe-atomic

2016-10-13 Thread Martin Liška
Hello. As it's very hard to guess from GCC driver whether a target supports atomic updates for GCOV counter or not, I decided to come up with a new option value (maybe-atomic), that would be transformed in a corresponding value (single or atomic) in tree-profile.c. The GCC driver selects the

Re: [PATCH, RFC] gcov: dump in a static dtor instead of in an atexit handler

2016-10-13 Thread Martin Liška
On 10/13/2016 04:04 PM, Rainer Orth wrote: > no, it's from r240990 unlike I'm completely mistaken. However, current > trunk bootstraps are running as we speak. > > Rainer Good! How does it look with the former solaris targets that does not support prioritized ctors? Thanks, Martin

<    4   5   6   7   8   9   10   11   12   13   >