From patchwork Mon Feb 20 10:16:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 65245 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D9053833C41 for ; Mon, 20 Feb 2023 10:16:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D9053833C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676888200; bh=p5CPrOoPOh58G7j4KIlnUpoFLYOgNpQgL1WIPRWyPmk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kViE2X8m5qEPSdRrYo+22iu12V1GglbmCx3DLpsTeSv9khK6pKLgDVCqQa0MfCCJ5 vbNsW0u+PsHg+nz61e5R7VJ2B2oESxjWypxs++Yleb/lVvG6Mb9hhV3cu7LF/EY33N gOSVKzV3K+zlJGCNF4pwF+sVEH+sqH0Wluwk2m4A= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D0F923953829 for ; Mon, 20 Feb 2023 10:16:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0F923953829 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 012851FFA0 for ; Mon, 20 Feb 2023 10:16:15 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E07E7139DB for ; Mon, 20 Feb 2023 10:16:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ADu2NW5I82NRIAAAMHmgww (envelope-from ) for ; Mon, 20 Feb 2023 10:16:14 +0000 To: gdb-patches@sourceware.org Subject: [pushed] [gdb/testsuite] Fix gdb.threads/schedlock.exp for gcc 4.8.5 Date: Mon, 20 Feb 2023 11:16:24 +0100 Message-Id: <20230220101624.24054-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Since commit 9af467b8240 ("[gdb/testsuite] Fix gdb.threads/schedlock.exp on fast cpu"), the test-case fails for gcc 4.8.5. The problem is that for gcc 4.8.5, the commit turned a two-line loop: ... (gdb) next 78 while (*myp > 0) (gdb) next 81 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; (gdb) next 78 while (*myp > 0) ... into a three-line loop: ... (gdb) next 83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; (gdb) next 84 cnt++; (gdb) next 85 } (gdb) next 83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; (gdb) ... and the test-case doesn't expect this. Fix this by reverting back to the original loop shape as much as possible by: - removing the cnt++ line - replacing "while (1)" with "while (one)", where one is a volatile variable set to 1. Tested on x86_64-linux, using compilers: - gcc 4.8.5, 7.5.0, 12.2.1 - clang 4.0.1, 13.0.1 --- gdb/testsuite/gdb.threads/schedlock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) base-commit: c50e4ced39b19ae49748634356c8c37e18427129 diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c index c4e77948ad4..fec896883ce 100644 --- a/gdb/testsuite/gdb.threads/schedlock.c +++ b/gdb/testsuite/gdb.threads/schedlock.c @@ -75,13 +75,12 @@ volatile int call_function = 0; void *thread_function(void *arg) { int my_number = (long) arg; unsigned long long int *myp = (unsigned long long int *) &args[my_number]; - volatile unsigned int cnt = 0; + volatile unsigned int one = 1; - while (1) + while (one) { /* schedlock.exp: main loop. */ MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; - cnt++; } pthread_exit(NULL);