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: 26775 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