From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53316 invoked by alias); 24 Nov 2017 14:26:18 -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 53306 invoked by uid 89); 24 Nov 2017 14:26:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hx-languages-length:1217 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; Fri, 24 Nov 2017 14:26:17 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1DB00800A4; Fri, 24 Nov 2017 14:26:16 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com [10.36.116.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B870360A98; Fri, 24 Nov 2017 14:26:15 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vAOEQD5f005040; Fri, 24 Nov 2017 15:26:13 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vAOEQC44005039; Fri, 24 Nov 2017 15:26:12 +0100 Date: Fri, 24 Nov 2017 14:58:00 -0000 From: Jakub Jelinek To: Maxim Kuvyrkov Cc: GCC Patches Subject: Re: [C++ PATCH] Fix -fsanitize={null,alignment} of references (PR c++/79572) Message-ID: <20171124142611.GY14653@tucnak> Reply-To: Jakub Jelinek References: <20170323203705.GX11094@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg02209.txt.bz2 On Fri, Nov 24, 2017 at 05:16:27PM +0300, Maxim Kuvyrkov wrote: > Using __builtin_printf causes this test to fail sporadically when > cross-testing. Stdout and stderr output can get mixed in > cross-testing, so dejagnu might see > == > g++.dg/ubsan/null-8.C:18:7: runtime error: reference binding to null > pointer of type iref is NULL > 'const int' > == > instead of > == > g++.dg/ubsan/null-8.C:18:7: runtime error: reference binding to null > pointer of type 'const int' > iref is NULL > == > > Is it essential for this testcase to use __builtin_printf or simple > "fprintf (stderr, ...)" would do just fine? That would mean bringing in stdio.h, which is very much undesirable. If you want, just revert the patch, verify the testcase FAILs, and then tweak it to say: __attribute__((noinline, noclone)) void bar (const *x, int y) { asm volatile ("" : : "g" (x), "g" (y) : "memory"); } and change __builtin_printf ("iref %d\n", iref); to bar ("iref %d\n", iref); and __builtin_printf ("iref is NULL\n"); to bar ("iref is NULL\n", 0); If the test still FAILs and is fixed after you reapply the patch, the change is preapproved. Jakub