From patchwork Sat Dec 30 10:54:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 854094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-469902-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="w8NrQtkk"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z80j05kxXz9sBZ for ; Sat, 30 Dec 2017 21:54:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:cc:message-id:date:mime-version:content-type; q= dns; s=default; b=LerC+tXg5EaEtWS5veEOAfAwfAffcV3kR6/LiYGtbrEjyk jQyjFdDx+OkbiqsxKftwG17+bW+crxbq/Y8bnuVURe46QYT2Y2mdRiYlvtzhjFZv rEZhufWcqQh5CSu9WxcqDCNQX+tm490qFBG6IKKpWwzDq9HEnU3EOrvCu5vuc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:cc:message-id:date:mime-version:content-type; s= default; bh=rg2M9G1fwE7shPJ59qjMwR0tzgQ=; b=w8NrQtkkJ7xMkKmbQk+9 d8VaGs4wN2rAqL/lKSgRCE6wAOaRsmTwRI3iPkEzU7yNtKl+u0ZpuQrYP9YPaUAE jXJ2e72tAh2D3tNuk5A/9etze3HLSLl4k1s1fVBuzD3hslWXItM0R8/s2HsrJlqx c67cm6UE5PryUri79KkYNMI= Received: (qmail 93814 invoked by alias); 30 Dec 2017 10:54:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 93792 invoked by uid 89); 30 Dec 2017 10:54:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=Hx-languages-length:1534 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 30 Dec 2017 10:54:47 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1eVEmr-00006I-60 from Tom_deVries@mentor.com ; Sat, 30 Dec 2017 02:54:45 -0800 Received: from [172.30.72.138] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Sat, 30 Dec 2017 10:54:42 +0000 To: Jakub Jelinek From: Tom de Vries Subject: [testsuite, PR83612] Fix 'memory cannot be printed' in gcc.dg/ubsan/object-size-9.c CC: GCC Patches Message-ID: <33a6fb61-daac-0ab1-5e80-c698961a9d31@mentor.com> Date: Sat, 30 Dec 2017 11:54:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Hi, I ran into the following failure: ... FAIL: gcc.dg/ubsan/object-size-9.c -O2 output pattern test, is gcc.dg/ubsan/object-size-9.c:11:13: runtime error: load of address 0x000000600ff2 with insufficient space for an object of type 'char' 0x000000600ff2: note: pointer points here ... The failure is because the test-case expects the sanitizer to access the memory and print its contents, but the memory happens not to be not accessible. I've applied the same fix as was applied in c-c++-common/ubsan/object-size-9.c for PR sanitizer/64078: add an alignment attribute to the variable to ensure that the memory after the variable is accessible. Tested on x86_64. Committed as obvious. Thanks, - Tom Fix 'memory cannot be printed' in gcc.dg/ubsan/object-size-9.c 2017-12-30 Tom de Vries PR testsuite/83612 * gcc.dg/ubsan/object-size-9 (t): Add alignment attribute. --- gcc/testsuite/gcc.dg/ubsan/object-size-9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/ubsan/object-size-9.c b/gcc/testsuite/gcc.dg/ubsan/object-size-9.c index e0a2980..41c4a94 100644 --- a/gcc/testsuite/gcc.dg/ubsan/object-size-9.c +++ b/gcc/testsuite/gcc.dg/ubsan/object-size-9.c @@ -3,7 +3,7 @@ /* { dg-options "-fsanitize=undefined" } */ struct T { int c; char d[]; }; -struct T t = { 1, "a" }; +struct T t __attribute__ ((aligned(4096))) = { 1, "a" }; int baz (int i)