From patchwork Thu Jul 12 14:22:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 943065 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=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-94211-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ZXosExCQ"; 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 41RJ742VqFz9rxx for ; Fri, 13 Jul 2018 00:22:40 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:mime-version:content-type :message-id; q=dns; s=default; b=ZNPCT+Gdmk2nBCjDtW/piMNnluu9/oG /S0Z73r0sKXFWe0FSmgtw+65UdGi0qvDj35bYDHhQtVTH2IUUBV6nOvhfNZ6RtTM 8g5KXcieC7Hl7F8KAJdL5iiKxqLE7YLcJnetdKNphNODJ+8kv0MtRJe0QzOK6mUf TAzXWvDQta0g= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:mime-version:content-type :message-id; s=default; bh=4QgE2dMcUI2WbZDKqo9z2Lyppco=; b=ZXosE xCQKo3xJG+6ZEl6p3Zh/ZhKwkzP5fMfA/oqu81lUtHeHkqKeJVY0KWYsK2s3UXzo 3pkDnfgO0zcqm1HZj3IzHt1PKbxgpFAYHiqQJ/wsrrOrXhhLnjQkhA3l0s8yZkaF CynwmlSXnZpSLI2OG0LvI9kc9MS7PoaFcRNf5Y= Received: (qmail 27087 invoked by alias); 12 Jul 2018 14:22:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 27078 invoked by uid 89); 12 Jul 2018 14:22:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library From: Stefan Liebler Subject: Fix string/tst-xbzero-opt if build with gcc head. Date: Thu, 12 Jul 2018 16:22:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 x-cbid: 18071214-0028-0000-0000-000002DAED03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071214-0029-0000-0000-000023929970 Message-Id: Fix string/tst-xbzero-opt is build with gcc head. On s390x, the test string/tst-xbzero-opt is failing if build with GCC head: FAIL: no clear/prepare: expected 32 got 0 FAIL: no clear/test: expected some got 0 FAIL: ordinary clear/prepare: expected 32 got 0 INFO: ordinary clear/test: found 0 patterns (memset not eliminated) PASS: explicit clear/prepare: expected 32 got 32 PASS: explicit clear/test: expected 0 got 0 In setup_no_clear / setup_ordinary_clear, GCC is omitting the memcpy loop in prepare_test_buffer. Thus count_test_patterns does not find any of the test_pattern. This patch introduces a compiler barrier just after filling the buffer. If okay, shall this be committed before or after the release? Bye Stefan Reviewed-by: Carlos O'Donell --- ChangeLog: * string/tst-xbzero-opt.c (prepare_test_buffer): Add compiler barrier. commit 65f9b078c5053faa93e1f572282463685a869864 Author: Stefan Liebler Date: Thu Jul 12 16:07:26 2018 +0200 Fix string/tst-xbzero-opt if build with gcc head. On s390x, the test string/tst-xbzero-opt is failing if build with gcc head: FAIL: no clear/prepare: expected 32 got 0 FAIL: no clear/test: expected some got 0 FAIL: ordinary clear/prepare: expected 32 got 0 INFO: ordinary clear/test: found 0 patterns (memset not eliminated) PASS: explicit clear/prepare: expected 32 got 32 PASS: explicit clear/test: expected 0 got 0 In setup_no_clear / setup_ordinary_clear, GCC is omitting the memcpy loop in prepare_test_buffer. Thus count_test_patterns does not find any of the test_pattern. This patch introduces a compiler barrier just after filling the buffer and the filling of the test_pattern is not omitted. ChangeLog: * string/tst-xbzero-opt.c (prepare_test_buffer): Add compiler barrier. diff --git a/string/tst-xbzero-opt.c b/string/tst-xbzero-opt.c index cf7041f37a..4c2be0c197 100644 --- a/string/tst-xbzero-opt.c +++ b/string/tst-xbzero-opt.c @@ -106,6 +106,9 @@ prepare_test_buffer (unsigned char *buf) for (unsigned int i = 0; i < PATTERN_REPS; i++) memcpy (buf + i*PATTERN_SIZE, test_pattern, PATTERN_SIZE); + /* Force the compiler to really copy the pattern to buf. */ + __asm__ __volatile__ ("" ::: "memory"); + if (swapcontext (&uc_co, &uc_main)) abort (); }