From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70646 invoked by alias); 1 Nov 2016 15:01:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 70611 invoked by uid 89); 1 Nov 2016 15:01:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=IIRC, iirc X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Nov 2016 15:01:15 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 359D6AB9F; Tue, 1 Nov 2016 15:01:13 +0000 (UTC) Subject: Re: [PATCH, RFC] Introduce -fsanitize=use-after-scope (v2) To: Jakub Jelinek References: <20160512104156.GY28550@tucnak.redhat.com> <57348F45.5020700@suse.cz> <20160818133609.GN14857@tucnak.redhat.com> <98f408c5-7e1e-6fd8-e589-34f8de2f4455@suse.cz> <20161007111347.GF7282@tucnak.redhat.com> <20161021142617.GG7282@tucnak.redhat.com> <3a109250-0440-7438-8e1f-7e5c6d8b6580@suse.cz> <20161027172358.GN3541@tucnak.redhat.com> <782727c2-9173-24ab-4e4c-07918dc16bf6@suse.cz> <20161101145350.GS3541@tucnak.redhat.com> Cc: GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <043f1088-c3ca-bcc2-3c4e-362a9df52753@suse.cz> Date: Tue, 01 Nov 2016 15:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161101145350.GS3541@tucnak.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00032.txt.bz2 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 commit the patch as soon as following patch would be accepted. The patch >> fixes false positives when running asan-bootstrap. > > 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? It's only with those changes as -fsanitize-address-use-after-scope is enabled by default with -fsanitize=address. Current bootstrap-asan works fine. I'll re-trigger the bootstrap again, but IIRC the main culprit was ASAN_MARK poisoning done at switch labels (which should be partially fixed with a newer version of the patch). Martin > >> >From b62e4d7ffe659ec338ef83e84ccb572a07264283 Mon Sep 17 00:00:00 2001 >> From: marxin >> Date: Tue, 20 Sep 2016 10:31:25 +0200 >> Subject: [PATCH 1/4] Fix ASAN bootstrap uninitialized warning. >> >> gcc/ChangeLog: >> >> 2016-09-26 Martin Liska >> >> * ipa-devirt.c (record_targets_from_bases): Initialize a >> variable. >> * omp-low.c (lower_omp_target): Remove a variable from >> scope defined by a switch statement. >> * tree-dump.c (dequeue_and_dump): Likewise. >> >> gcc/java/ChangeLog: >> >> 2016-09-26 Martin Liska >> >> * mangle.c (mangle_type): Remove a variable from >> scope defined by a switch statement. >> --- >> gcc/ipa-devirt.c | 2 +- >> gcc/omp-low.c | 11 ++++------- >> gcc/tree-dump.c | 8 +++----- >> 3 files changed, 8 insertions(+), 13 deletions(-) >> >> diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c >> index 49e2195..5c0ae72 100644 >> --- a/gcc/ipa-devirt.c >> +++ b/gcc/ipa-devirt.c >> @@ -2862,7 +2862,7 @@ record_targets_from_bases (tree otr_type, >> { >> while (true) >> { >> - HOST_WIDE_INT pos, size; >> + HOST_WIDE_INT pos = 0, size; >> tree base_binfo; >> tree fld; >> >> diff --git a/gcc/omp-low.c b/gcc/omp-low.c >> index e5b9e4c..62c9e5c 100644 >> --- a/gcc/omp-low.c >> +++ b/gcc/omp-low.c >> @@ -15803,11 +15803,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) >> push_gimplify_context (); >> fplist = NULL; >> >> + tree var, x; >> for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c)) >> switch (OMP_CLAUSE_CODE (c)) >> { >> - tree var, x; >> - >> default: >> break; >> case OMP_CLAUSE_MAP: >> @@ -16066,12 +16065,11 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) >> vec_alloc (vkind, map_cnt); >> unsigned int map_idx = 0; >> >> + tree ovar, nc, s, purpose, var, x, type; >> + unsigned int talign; >> for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c)) >> switch (OMP_CLAUSE_CODE (c)) >> { >> - tree ovar, nc, s, purpose, var, x, type; >> - unsigned int talign; >> - >> default: >> break; >> >> @@ -16442,10 +16440,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) >> if (offloaded || data_region) >> { >> tree prev = NULL_TREE; >> + tree var, x; >> for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c)) >> switch (OMP_CLAUSE_CODE (c)) >> { >> - tree var, x; >> default: >> break; >> case OMP_CLAUSE_FIRSTPRIVATE: >> @@ -16594,7 +16592,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) >> for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)) >> switch (OMP_CLAUSE_CODE (c)) >> { >> - tree var; >> default: >> break; >> case OMP_CLAUSE_MAP: >> diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c >> index df47181..89f72a0 100644 >> --- a/gcc/tree-dump.c >> +++ b/gcc/tree-dump.c >> @@ -420,8 +420,6 @@ dequeue_and_dump (dump_info_p di) >> /* Now handle the various kinds of nodes. */ >> switch (code) >> { >> - int i; >> - >> case IDENTIFIER_NODE: >> dump_string_field (di, "strg", IDENTIFIER_POINTER (t)); >> dump_int (di, "lngt", IDENTIFIER_LENGTH (t)); >> @@ -435,6 +433,7 @@ dequeue_and_dump (dump_info_p di) >> >> case STATEMENT_LIST: >> { >> + int i; >> tree_stmt_iterator it; >> for (i = 0, it = tsi_start (t); !tsi_end_p (it); tsi_next (&it), i++) >> { >> @@ -447,7 +446,7 @@ dequeue_and_dump (dump_info_p di) >> >> case TREE_VEC: >> dump_int (di, "lngt", TREE_VEC_LENGTH (t)); >> - for (i = 0; i < TREE_VEC_LENGTH (t); ++i) >> + for (int i = 0; i < TREE_VEC_LENGTH (t); ++i) >> { >> char buffer[32]; >> sprintf (buffer, "%u", i); >> @@ -707,9 +706,8 @@ dequeue_and_dump (dump_info_p di) >> break; >> case OMP_CLAUSE: >> { >> - int i; >> fprintf (di->stream, "%s\n", omp_clause_code_name[OMP_CLAUSE_CODE (t)]); >> - for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t)]; i++) >> + for (int i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t)]; i++) >> dump_child ("op: ", OMP_CLAUSE_OPERAND (t, i)); >> } >> break; >> -- >> 2.10.1 >> > > > Jakub >