From patchwork Mon Feb 11 10:03:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1039730 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-495782-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gUqJNH8J"; 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 43yhFr4Br1z9sMr for ; Mon, 11 Feb 2019 21:03:53 +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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=e612mMQP8kRi3KDR A2GAe4QN6gGPGwz/fjyduDrhmoQePbF8A7PVqqnaGzSvzVRlIDkwM66mDpc+y9/5 ondIr1gGg4VLtVxvAsK8XOfYAnVpiDbkIlPUW3tIhcvg7UFCSWB5tuV9rM06R6Dx HpdebyhT0N2JxYO6MsenI8bI1ZU= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=MoBVWhU0UIeoGuhW/Wu5nf GtYIM=; b=gUqJNH8JOyLdPgxtgPEqgN+ND8m3Fjh/aaCyoHhjcKa/KcbIASnogn KxDUskzVWHUEaP2CC+1pyLxhfvhh13NRTZ26nH1L0fq421jfiCITRz55i30UaH+1 kCwVY2KLvfTF1f5ct6Zz0bhL3rWtPLidzFLR6ZyWXUaHqYtQNPoS4= Received: (qmail 128015 invoked by alias); 11 Feb 2019 10:03:46 -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 128002 invoked by uid 89); 11 Feb 2019 10:03:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=ebotcazou@adacore.com, ebotcazouadacorecom X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Feb 2019 10:03:45 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5784D81382 for ; Mon, 11 Feb 2019 11:03:43 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O2_FC2jclHRd for ; Mon, 11 Feb 2019 11:03:43 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 3893A8137C for ; Mon, 11 Feb 2019 11:03:43 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Disable store merging in asan_expand_mark_ifn Date: Mon, 11 Feb 2019 11:03:41 +0100 Message-ID: <4495488.sKnqla6Psi@polaris> MIME-Version: 1.0 Hi, asan_expand_mark_ifn does manual store merging but doesn't take into account the alignment, so this can break on strict-alignment platforms. Tested on SPARC/Solaris 11, where this fixes this regression: FAIL: gcc.dg/asan/use-after-scope-5.c -O0 output pattern test FAIL: gcc.dg/asan/use-after-scope-5.c -O1 output pattern test FAIL: gcc.dg/asan/use-after-scope-5.c -O2 output pattern test FAIL: gcc.dg/asan/use-after-scope-5.c -O3 -fomit-frame-pointer -funroll- loops -fpeel-loops -ftracer -finline-functions output pattern test FAIL: gcc.dg/asan/use-after-scope-5.c -O3 -g output pattern test FAIL: gcc.dg/asan/use-after-scope-5.c -Os output pattern test FAIL: gcc.dg/asan/use-after-scope-5.c -O2 -flto -flto-partition=none output pattern test FAIL: gcc.dg/asan/use-after-scope-5.c -O2 -flto output pattern test OK for mainline? 2019-02-11 Eric Botcazou * asan.c (asan_expand_mark_ifn): Always use a size of 1 byte for the stores on strict-alignment platforms. Index: asan.c =================================================================== --- asan.c (revision 268508) +++ asan.c (working copy) @@ -3226,10 +3226,13 @@ asan_expand_mark_ifn (gimple_stmt_iterat for (unsigned HOST_WIDE_INT offset = 0; offset < shadow_size;) { unsigned size = 1; - if (shadow_size - offset >= 4) - size = 4; - else if (shadow_size - offset >= 2) - size = 2; + if (!STRICT_ALIGNMENT) + { + if (shadow_size - offset >= 4) + size = 4; + else if (shadow_size - offset >= 2) + size = 2; + } unsigned HOST_WIDE_INT last_chunk_size = 0; unsigned HOST_WIDE_INT s = (offset + size) * ASAN_SHADOW_GRANULARITY;