From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123907 invoked by alias); 12 Oct 2017 16:49: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 122585 invoked by uid 89); 12 Oct 2017 16:49:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2398 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; Thu, 12 Oct 2017 16:49:28 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B5B77E384 for ; Thu, 12 Oct 2017 16:49:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B5B77E384 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub@redhat.com Received: from tucnak.zalov.cz (ovpn-116-223.ams2.redhat.com [10.36.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 20D5F51C76; Thu, 12 Oct 2017 16:49:26 +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 v9CGnNuZ013424; Thu, 12 Oct 2017 18:49:24 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v9CGnL1m010877; Thu, 12 Oct 2017 18:49:21 +0200 Date: Thu, 12 Oct 2017 17:05:00 -0000 From: Jakub Jelinek To: Vladimir Makarov Cc: gcc-patches Subject: Re: patch to fix PR82353 Message-ID: <20171012164921.GY14653@tucnak> Reply-To: Jakub Jelinek References: <20171011211106.GQ14653@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-10/txt/msg00771.txt.bz2 Hi! On Wed, Oct 11, 2017 at 06:41:05PM -0400, Vladimir Makarov wrote: > > Tested on x86_64-linux -m32/-m64, and verified with cc1plus before your > > change, ok for trunk? BTW, I think it is quite fragile to scan for the reload messages, so I've cooked up a runtime test that fails before your patch and succeeds with your patch. Tested on x86_64-linux with -m32/-m64 (both with your patch reverted and without), ok for trunk? 2017-10-12 Jakub Jelinek PR sanitizer/82353 * g++.dg/ubsan/pr82353-2.C: New test. * g++.dg/ubsan/pr82353-2-aux.cc: New file. * g++.dg/ubsan/pr82353-2.h: New file. --- gcc/testsuite/g++.dg/ubsan/pr82353-2.C.jj 2017-10-12 18:39:43.712341186 +0200 +++ gcc/testsuite/g++.dg/ubsan/pr82353-2.C 2017-10-12 18:39:23.000000000 +0200 @@ -0,0 +1,20 @@ +// PR sanitizer/82353 +// { dg-do run } +// { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined -std=c++11 -O2 -w" } +// { dg-additional-sources "pr82353-2-aux.cc" } + +#include "pr82353-2.h" + +unsigned long f, g; +bool h, k, j, i; +unsigned char l, m; +short n; +unsigned o; +F p; + +int +main () +{ + foo (); + bar (); +} --- gcc/testsuite/g++.dg/ubsan/pr82353-2-aux.cc.jj 2017-10-12 18:39:39.375393412 +0200 +++ gcc/testsuite/g++.dg/ubsan/pr82353-2-aux.cc 2017-10-12 18:38:47.000000000 +0200 @@ -0,0 +1,32 @@ +// PR sanitizer/82353 + +#include "pr82353-2.h" + +B a; +E b; +B C::c0; +unsigned D::d0; + +void +foo () +{ + a.b1 = p.f2.e2.b1 = 5; +} + +void +bar () +{ + int c = p.f2.e4.d1.a0 - -~p.f4 * 89; + q.c0.b0 = i > g * a.b0 * h - k % a.b1; + if ((~(m * j) && -~p.f4 * 90284000534361) % ~m * j) + b.e2.b0 << l << f; + o = -~p.f4 * 89; + int d = p.f4; + if (b.e2.b0) + b.e2.b1 = c; + bool e = ~-~p.f4; + a.b1 % e; + if (k / p.f2.e2.b1) + b.e4.d0 = g * a.b0 * h; + n = j; +} --- gcc/testsuite/g++.dg/ubsan/pr82353-2.h.jj 2017-10-12 18:39:46.671305554 +0200 +++ gcc/testsuite/g++.dg/ubsan/pr82353-2.h 2017-10-12 18:32:04.000000000 +0200 @@ -0,0 +1,31 @@ +extern unsigned long f, g; +extern bool h, i, j, k; +extern unsigned char l, m; +extern short n; +extern unsigned o; +struct B { + short b0 : 27; + long b1 : 10; +}; +struct A { + int a0 : 5; +}; +struct C { + static B c0; +}; +struct D { + static unsigned d0; + A d1; +}; +struct E { + B e2; + D e4; +}; +struct F { + E f2; + short f4; +}; +extern F p; +extern C q; +void foo (); +void bar (); Jakub