From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90661 invoked by alias); 7 Sep 2016 20:40:34 -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 90651 invoked by uid 89); 7 Sep 2016 20:40:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=tracks, Hx-languages-length:1530 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Sep 2016 20:40:32 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9793A7568; Wed, 7 Sep 2016 20:40:30 +0000 (UTC) Received: from laptop.zalov.cz (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u87KeRcv012992 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 7 Sep 2016 16:40:29 -0400 Received: from laptop.zalov.cz (localhost [127.0.0.1]) by laptop.zalov.cz (8.15.2/8.15.2) with ESMTP id u87KePfF025633; Wed, 7 Sep 2016 22:40:26 +0200 Received: (from jakub@localhost) by laptop.zalov.cz (8.15.2/8.15.2/Submit) id u87KeLGT025632; Wed, 7 Sep 2016 22:40:21 +0200 Date: Wed, 07 Sep 2016 20:41:00 -0000 From: Jakub Jelinek To: Richard Biener Cc: Dodji Seketeli , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] -fsanitize=thread fixes (PR sanitizer/68260) Message-ID: <20160907204020.GA21831@laptop.zalov.cz> Reply-To: Jakub Jelinek References: <20160906203359.GN14857@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00407.txt.bz2 On Wed, Sep 07, 2016 at 09:07:45AM +0200, Richard Biener wrote: > > @@ -493,6 +504,8 @@ instrument_builtin_call (gimple_stmt_ite > > if (!tree_fits_uhwi_p (last_arg) > > || memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST) > > return; > > + if (lookup_stmt_eh_lp (stmt)) > > + remove_stmt_from_eh_lp (stmt); > > These changes look bogus to me -- how can the tsan instrumentation > function _not_ throw when the original function we replace it can? The __tsan*atomic* functions are right now declared to be nothrow, so the patch just matches how they are declared. While the sync-builtins.def use #define ATTR_NOTHROWCALL_LEAF_LIST (flag_non_call_exceptions ? \ ATTR_LEAF_LIST : ATTR_NOTHROW_LEAF_LIST) I guess I could use the same for the tsan atomics, but wonder if it will work properly when the libtsan is built with exceptions disabled and without -fnon-call-exceptions. Perhaps it would, at least if it is built with -fasynchronous-unwind-tables (which is the case for x86_64 and aarch64 and tsan isn't supported elsewhere). > > It seems you are just avoiding the ICEs for now "wrong-code". (and > how does this relate to -fnon-call-exceptions as both are calls?) > > The instrument_expr case seems to leave the original stmt in-place > (and thus the EH). Those are different. For loads and stores there is just added call that logs in the load or store, but for atomics the atomics are done inside of the library and the library tracks everything. Jakub