From patchwork Wed Apr 18 11:51:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 900072 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-91610-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="NfyfDOgf"; 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 40R0nw5Whvz9s3Z for ; Wed, 18 Apr 2018 21:51:32 +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=RjqwHd+RUHBk/eUQ3lujFTcaI0eSotv NRPyIdBPo2OcBXDWMkcOmUaHlOvTzvrtQzk/BDNZgDp6LhPxfzsYH0Zmq+oI6h+a cR7Qw7ZLypYBZTR7O08PO6qqV5NmPKUrRyQVjj0r1pzjIPj2+noIY/N4yx7uenkq M9bAUIi7myfE= 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=vdxBINj0/Bn3JC2yekgpRrgbJ4M=; b=NfyfD OgfJ5VEyjA2EmEGJ+x+DtbgTtj7TtsT3QFrEiGMVoAtV8AqcLRtv2N+eJIsv2pzg mgcQViwdohNDVPCYGZuArFZcu0jBydwkUUPoSed0h9el53XuKrlvv6O5z6u2PgTn CnMmFzOPr6yjFHBseLWcwpEkDdOL0uX/dCaJTk= Received: (qmail 65875 invoked by alias); 18 Apr 2018 11:51:25 -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 65862 invoked by uid 89); 18 Apr 2018 11:51:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=4512 X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library From: Stefan Liebler Subject: [PATCH] Use volatile global counters in test-tgmath.c. Date: Wed, 18 Apr 2018 13:51:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18041811-0008-0000-0000-000004ECA756 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041811-0009-0000-0000-00001E80B178 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-18_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804180108 Hi, If build with -Os on s390x, the test-tgmath fails with: float functions not called often enough (-10000) Within compile_testf(), the counter (count_float) is saved before the complex functions are called. Afterwards the saved counter differs to the current-counter. But the tests with the complex functions do not increment count_float! Instead count_float is saved to a register before calling totalorder and totalordermag which both increment count_float. The compiler is allowed to do that as totalorderf and totalordermagf is declared with __attribute__ ((__const__)) in math/bits/mathcalls.h. Thus this patch adjusts the global counters to be volatile. Then count_float is saved after totalordermag. Okay to commit? Bye Stefan --- ChangeLog: * math/test-tgmath.c (count_double, count_float, count_ ldouble, count_cdouble, count_cfloat, count_cldouble): Use volatile int. commit 03fd4e7e0fd1d2f6dedee49bdbefde7b23a644e1 Author: Stefan Liebler Date: Mon Apr 16 16:55:25 2018 +0200 Use volatile global counters in test-tgmath.c. If build with -Os on s390x, the test-tgmath fails with: float functions not called often enough (-10000) Within compile_testf(), the counter (count_float) is saved before the complex functions are called. Afterwards the saved counter differs to the current-counter. But the tests with the complex functions do not increment count_float! Instead count_float is saved to a register before calling totalorder and totalordermag which both increment count_float. The compiler is allowed to do that as totalorderf and totalordermagf is declared with __attribute__ ((__const__)) in math/bits/mathcalls.h. Thus this patch adjusts the global counters to be volatile. Then count_float is saved after totalordermag. ChangeLog: * math/test-tgmath.c (count_double, count_float, count_ ldouble, count_cdouble, count_cfloat, count_cldouble): Use volatile int. diff --git a/math/test-tgmath.c b/math/test-tgmath.c index 6d8e7fd..2b0787c 100644 --- a/math/test-tgmath.c +++ b/math/test-tgmath.c @@ -45,12 +45,12 @@ complex float fz; complex double dz; complex long double lz; -int count_double; -int count_float; -int count_ldouble; -int count_cdouble; -int count_cfloat; -int count_cldouble; +volatile int count_double; +volatile int count_float; +volatile int count_ldouble; +volatile int count_cdouble; +volatile int count_cfloat; +volatile int count_cldouble; #define NCALLS 134 #define NCALLS_INT 4