From patchwork Fri Mar 29 12:37:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 87818 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 CF3F13858D34 for ; Fri, 29 Mar 2024 12:38:13 +0000 (GMT) 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.223.131]) by sourceware.org (Postfix) with ESMTPS id 388593858D20 for ; Fri, 29 Mar 2024 12:37:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 388593858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 388593858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711715873; cv=none; b=Ql5LRKKWk5mZWpRaDiPgJdE/WFXY01WxpiNdhNRafUCA0N1XFoZdie8BjJm1wFGfj9W9SWN82HmOc8eHe05narOgic4z7a7nEHjeKZNH93QkTMbxS5ybTp0OusPufomX/Fqb8VhpVHLLNCnY/397JteOsGipJYY95sNPn1q1t8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711715873; c=relaxed/simple; bh=CAoILKV/2gfIgH432/Q8M6DE5Hepv2MOWeRSSqgenp8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=pNWDfGwfjhY/466LUVv/tw0wgtuHyTiaqE60xtpznZuKWJjxryn0CzSzvmcRu2+BcQ5525UGEN69rNeps+SWEOGwVGYW+91rhb2SKXQpOCcbEECgLBfw4mZtdrKmD98GsbcK3ISY3+yK52wp9fyRB4AxuRUCNHBAk5z1auyIrQY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 449035C537 for ; Fri, 29 Mar 2024 12:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1711715870; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UaRRcQLU+FzpS9tWOofc7q5ucFhcBuTuj+svNZFM5fI=; b=C2bvDtVsgmtvVRTLqBlO5d1CkakZI2QOg90las6NDXS1xX0zC7/pw+LfmaahCS2hvytSLx KPazl77vj8ENUYX03z04ARLOGf5KURdtSHoh3sbp7FWFCTIpfDZlIr1dgp4AtSAuaJnAcU yJu3mFxMyH39VO2jjL0oLYUA6rpn8pU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1711715870; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UaRRcQLU+FzpS9tWOofc7q5ucFhcBuTuj+svNZFM5fI=; b=7i03gFtYhF4a5GkAufjavPhvXmWdsjmVYvFDw2hfqZO4dSY3pSSqgzOrdwepf2v1IBWmOG uDvfO1zU7LIJrFBw== Authentication-Results: smtp-out2.suse.de; none Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 2C5C113A9F for ; Fri, 29 Mar 2024 12:37:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id VwgiCR62Bma5QwAAn2gu4w (envelope-from ) for ; Fri, 29 Mar 2024 12:37:50 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/testsuite] Fix gdb.ada/verylong.exp on 32-bit target Date: Fri, 29 Mar 2024 13:37:51 +0100 Message-Id: <20240329123751.16934-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Score: 0.78 X-Spamd-Result: default: False [0.78 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_DN_NONE(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.12)[-0.579]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[gnu.org:url]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org In an aarch32-linux chroot on an aarch64-linux system, I run into: ... (gdb) print x^M $1 = 9223372036854775807^M (gdb) FAIL: gdb.ada/verylong.exp: print x ... A passing version on aarch64-linux looks like: ... (gdb) print x^M $1 = 170141183460469231731687303715884105727^M (gdb) PASS: gdb.ada/verylong.exp: print x ... The difference is caused by the size of the type Long_Long_Long_Integer, which is: - a 128-bit signed on 64-bit targets, and - a 64-bit signed on 32-bit target. Fix this by detecting the size of the Long_Long_Long_Integer type, and handling it. Tested on aarch64-linux and aarch32-linux. PR testsuite/31574 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31574 [1] https://gcc.gnu.org/onlinedocs/gnat_rm/Implementation-Defined-Characteristics.html --- gdb/testsuite/gdb.ada/verylong.exp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) base-commit: 221918140b0b4a52674491d7ab4487da02d063a7 diff --git a/gdb/testsuite/gdb.ada/verylong.exp b/gdb/testsuite/gdb.ada/verylong.exp index 28b65a10f64..4a3e0b9eeb2 100644 --- a/gdb/testsuite/gdb.ada/verylong.exp +++ b/gdb/testsuite/gdb.ada/verylong.exp @@ -29,15 +29,29 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "START" ${testdir}/prog.adb] runto "prog.adb:$bp_location" -gdb_test "print x" " = 170141183460469231731687303715884105727" -gdb_test "print x / 2" " = 85070591730234615865843651857942052863" -gdb_test "print (x / 4) * 2" " = 85070591730234615865843651857942052862" +set lll_int_size 0 +gdb_test_multiple "ptype Long_Long_Long_Integer" "" { + -re -wrap "type = <8-byte integer>" { + set lll_int_size 8 + set max 9223372036854775807 + } + -re -wrap "type = <16-byte integer>" { + set lll_int_size 16 + set max 170141183460469231731687303715884105727 + } +} + +require {expr $lll_int_size == 8 || $lll_int_size == 16} + +gdb_test "print x" " = $max" +gdb_test "print x / 2" " = [expr $max / 2]" +gdb_test "print (x / 4) * 2" " = [expr ($max / 4) * 2]" gdb_test "print x - x" " = 0" -gdb_test "print x - 99 + 1" " = 170141183460469231731687303715884105629" -gdb_test "print -x" " = -170141183460469231731687303715884105727" -gdb_test "print +x" " = 170141183460469231731687303715884105727" +gdb_test "print x - 99 + 1" " = [expr $max - 99 + 1]" +gdb_test "print -x" " = -$max" +gdb_test "print +x" " = $max" gdb_test "print 170141183460469231731687303715884105727" \ " = 170141183460469231731687303715884105727" -gdb_test "print x = 170141183460469231731687303715884105727" \ +gdb_test "print x = $max" \ " = true"