From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70051.outbound.protection.outlook.com [40.107.7.51]) by sourceware.org (Postfix) with ESMTPS id 675753858C50 for ; Tue, 3 May 2022 11:09:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 675753858C50 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=nIZLtQiQYoqYVuRB5jNH/jq1XncYLPjTPW8NJ7b6QNHDWsAeUnbUIl/0Scd6YsysORzz3RX+CvstZd9uGgIQTrVcnOf+NWG36nYjFbEkytp4RUCo8FrqHz+JfI5xtndeAvfAfotlYP8uMVX3eww20Of5CIf2/SQkJBJwdGuPqPUkUOiIeM5fHd8ncwl4EtFdsjeoEW2VPwAgSQKq+LMoFPzYFDl5Czt0d0XGQEI4x6+nrvxwli25muJMiMgAlkzqT7DRcwhX/yaE83NPe8At3MJ6KNcmnxzAWzViOPJJojcCsPBH0Je7G7e6J6phEL9qRY7cwPMDQFFlwV/E7O5eLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=alVn4jil34M6kjNRs70eBypnI/ziqzGkNg15vtlKQt8=; b=XIS5QHuBNLJIIXMEM3+pwLcz5LEbBUaYKWqBRgZ9lpnoun8hp3lU9enCm6WLUUqoostTcp2/4HYvbh0AtEqgW0bG17pRqNRsvlL2E3nfgDIHfackx0hc/ByrJOKJnFgTvLE2DjmN3zQCOAVhbb92Hu5a6me2hPRCic2puheYc8XJhv6BcA62BeRPw4bkaQcpOkI5ThfM5Fbolj/vI4fw1U/5VdNKwFZS1i2dW6YaNLpQRD/LFKc6Z8dAjjF/50DaIEtIiaLTZyRoap7lZqhB60dQvAUWZUolweQE3B3SI+mENSn4qVCfX7Sd/ax8hOPPigQwK9CyZgFY50j3GH4Fqg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from DU2PR04CA0066.eurprd04.prod.outlook.com (2603:10a6:10:232::11) by AM6PR08MB3863.eurprd08.prod.outlook.com (2603:10a6:20b:8b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Tue, 3 May 2022 11:09:55 +0000 Received: from DBAEUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:232:cafe::94) by DU2PR04CA0066.outlook.office365.com (2603:10a6:10:232::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.14 via Frontend Transport; Tue, 3 May 2022 11:09:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT008.mail.protection.outlook.com (100.127.142.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.12 via Frontend Transport; Tue, 3 May 2022 11:09:55 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Tue, 03 May 2022 11:09:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3a778e2a8dab8032 X-CR-MTA-TID: 64aa7808 Received: from f1cf94d98bfe.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2F42600E-B8DA-4422-989F-BB55BB34E38F.1; Tue, 03 May 2022 11:09:48 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f1cf94d98bfe.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 03 May 2022 11:09:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0NW5/QrJPw/DYNVmyVKEVuHI/xxcsjG4MvERmZfB2FMZpmIAYTj6XgmZuXS2Z4WagTf0jBYgWLMoLkWsAfWtGWEcL/OKO6PjDDZ7rpG3B1yQ3+LRIYYZA5YezGlnzjC0tzOEa4E28xtiLSUHHwvNxmz3PvvBHxRkMpF6wfrGR2okL+9IUeV0CFBihpOg/jgFKIPRhDUkc17B5zIPHcc00SCO7McV0Td5JzqzjsOue2HXnjc8sv/QqyIXpi+qTnvM+SO0EZ+6hmRk+UXdm8wEzDGk7mPkjP/HPSg/zp6zLK5B7Pc4FCvDIrSLHDnEUJnNaiAhCB01+MfNkwHxvE1Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=alVn4jil34M6kjNRs70eBypnI/ziqzGkNg15vtlKQt8=; b=JjSy6gU28HSdWGNnGFYnAOaGRm4gvPOBKE04D8+nhgew9L0OdbLc8P+Od+qtUUYbuR5e9h6vJuYAHKhYw74vI+UzletMro6Qno5QUe80Vf1o9qwWgJZCz6gAbjTyQPSImu/eyPcQgnFaeMw3ku914wi2papGbeov1Uu136ZiMkxlFmznrtcjljj0jvGJ/864nvy1g9hSkyokL2B9uj1GHeF4QWAxbMAWO1Bl1IrcO2Q6HBUYoqzjzg8Em2nOy+LB4HFmxeEbMCTl7BWzOpMGMoEMAypkBA3B1E5zEnrdNQlFzUiJntS0SeOnwMgCfnWs4WT4r+XCVATO9XGM6r1VPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AM6PR08MB3878.eurprd08.prod.outlook.com (2603:10a6:20b:8b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.18; Tue, 3 May 2022 11:09:46 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7080:6233:cf8f:a8a6]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7080:6233:cf8f:a8a6%7]) with mapi id 15.20.5206.024; Tue, 3 May 2022 11:09:46 +0000 Message-ID: Date: Tue, 3 May 2022 12:09:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH][gdb/testsuite] Fix gdb.ada/float-bits.exp with -m32 Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org Cc: Tom Tromey References: <20220414131412.GA9234@delia> <2ce6644a-6480-8a78-b53c-c2321956f3d8@arm.com> <98208d6d-817d-b3a8-aebf-d56ac33ff40e@suse.de> <0d550247-8ac6-6ff7-c025-c303e2883ed5@arm.com> <4abe9008-4a35-8e14-0f6e-2cddd3964f83@suse.de> From: Luis Machado In-Reply-To: <4abe9008-4a35-8e14-0f6e-2cddd3964f83@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AM8P190CA0001.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:219::6) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: bda52d35-c123-476b-94ef-08da2cf573f2 X-MS-TrafficTypeDiagnostic: AM6PR08MB3878:EE_|DBAEUR03FT008:EE_|AM6PR08MB3863:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: gSuFzgApNyf1WybMmPeyIW2gkNWYLeT3yOzr/dUDeTA6DQ7N77/wUuRKmk9FhLQ+5M07BYWNxK78cTeaYdM/Uy/vv50+PWySNwCzHHra87rAD7It//USP6JhgR1PRRcWe8nUG8dCJTv8ofnIA7pjIPDDaWaossUQg1ARnkv4zKGZu4w5O48ELSVN7HWdIi2YJjHmUW+XPJfmiXLERncC3bbCBya9BkA1+zlfrYPjHWjjKRa0APWKNzgGDdLRjCGG9dJwjJEkymdV/dz7bK8jHt8aQEAoiINqWjQ4SlN4sS1u05KSP/2IAPWjqccue/SMXqfuHaRCM0UOa5cyhGtdKJ2wbqGp+AAlqek8M0QKoGQGxmQ5KJlKiDwikFeyuAwIcszZ/wf4/ov6p+7KYA71AopyI7jE3q7bI5uk4Axp07CcJIcHVy2yFPH4aUDDrevS/iNlbonJzSYAwc7ytW+IA1mjbYhiT7EFUgr/Ttav/Ty8+h6GbDBvDNlueLOZcBBvNhfUx2XoVMneuAtEecqZ1hEgc9npoFJnNBEkoDJBOVtK18Px289tZN+PmTxcHytu/RauEKHJmqoeRPRgQWwJzXR/o2FwpRocgN1yMSmlI20c908xFLUHBVQUNsIDNmmcmoMqO2jx8riFxBSPKXFSR1dkUZ3lDSquLMgoOmLCShP50XlcU/xsP95o+ABaVnzPqUFzhF+P5nzAATzTR7o5eRBHT4YV7skP8hmpJLiROTOqy+UeCEY2n+ZeekUqykdjkAE5TaGfbB27dOgca29UBsLasDrkrUrUh8Sv2ZGwzQH/mDvcoQII0wLULfvMedDLyKbf6e/lHMnR5oAyOV2Y2rTU0/ZBo9/voRaUp5tSukQ= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(38100700002)(2906002)(86362001)(31696002)(6486002)(2616005)(316002)(186003)(66556008)(83380400001)(66476007)(4326008)(8676002)(966005)(53546011)(31686004)(508600001)(8936002)(6506007)(66946007)(6512007)(84970400001)(5660300002)(26005)(44832011)(36756003)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3878 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 929bb933-dc1d-4752-89ee-08da2cf56eec X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I8W3MQzjidpdY8dpF5Owt6ZkrJlfnfKRp/UFXgAF3p3X5pi8G1Ywk+BXBDYmuli3T1V1meW7lfgAlVaw20pAdLDkZXr4vI0pbibH7ymoxJ3Pq1uFovVHsPMhyaUEJ2H0hJPq8f7lbxo5RzHgP+q9iMmIK1P7/ayFDlY+e8tdXM15e4575W5ADvQMhVIZ9RJApo/IwgZ0QAJZIHas0Li0eBLvDdnEFzFuX+Bi+t8c57nIye+vPrURkha20LfhxVHMeZbjV/Jw3Wnq9+3gSfRx3B95EV+KHFOiA9m6NpdSVd1vy8sp4ICxH5mTCEdrqK0rLCQNPylw2WD9wUV5kcadwEX6nvPDzVxj+GulR55puZzIgvK1eO6ZTniuKg6VyDYC4y8gup9oV86rYRVuuVOyCdwJdwAWg2rCdi6C1DRW4+HzmXV4Hto6Y8+q9FeepZvMTDk/GgZXz07Eem3V3dGh+AFSKBS+jF3E7hdDkpzG90kTQvCHhukDf4I5RvBxXFBs+WMmwUfTaAPWN+VvCb6LGb4oukdWk8JnsyUhdywR86g8TCGqkB5JIYlXQgrqzxIbGZXjQ4r9sCrN/ysSu0Ue1XZXE2exDDLxRbJCU7bm+9nk6JGw7vz90XlSkPRKCbz7UjYwvhmoNHe9eos0iKXR5Uo/QRIizKi9z/WLBuy9z5X2ORFvtRvIW8i9tGxm2SxLu5qNk17waSxb0qB5iZ0Mml0SBpNIxyAKEJdBbDsasyKwBvhVyqv82dku/Fj0Tu+wJRn8kvKlYW97vmf33tbq53AztXbI3PQ01qO66lfdxLflaXeEYbdOp6WbV0fU5TKd64mzLbDSlRfy4Ksh8m5cTg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(82310400005)(31696002)(44832011)(2906002)(31686004)(4326008)(47076005)(8676002)(26005)(70586007)(70206006)(36756003)(316002)(356005)(81166007)(40460700003)(8936002)(5660300002)(86362001)(966005)(2616005)(508600001)(36860700001)(84970400001)(83380400001)(186003)(336012)(6506007)(6512007)(107886003)(6486002)(53546011)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2022 11:09:55.0077 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bda52d35-c123-476b-94ef-08da2cf573f2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3863 X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, URI_DOTEDU autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Tue, 03 May 2022 11:10:02 -0000 On 5/3/22 11:54, Tom de Vries wrote: > On 5/3/22 08:47, Luis Machado wrote: >> On 5/2/22 08:10, Tom de Vries wrote: >>> On 4/25/22 12:31, Luis Machado wrote: >>>> On 4/14/22 14:14, Tom de Vries via Gdb-patches wrote: >>>>> Hi, >>>>> >>>>> With test-case gdb.ada/float-bits.exp and native we get: >>>>> ... >>>>> (gdb) print 16llf#7FFFF7FF4054A56FA5B99019A5C8#^M >>>>> $9 = 5.0e+25^M >>>>> (gdb) PASS: gdb.ada/float-bits.exp: print >>>>> 16llf#7FFFF7FF4054A56FA5B99019A5C8# >>>>> ... >>>>> but with target board unix/-m32 we have instead: >>>>> ... >>>>> (gdb) print 16llf#7FFFF7FF4054A56FA5B99019A5C8#^M >>>>> Cannot export value 2596145952482202326224873165792712 as 96-bits \ >>>>>    unsigned integer (must be between 0 and >>>>> 79228162514264337593543950335)^M >>>>> (gdb) FAIL: gdb.ada/float-bits.exp: print >>>>> 16llf#7FFFF7FF4054A56FA5B99019A5C8# >>>>> ... >>>>> >>>>> Fix this by testing whether 16llf is supported by doing ptype >>>>> long_long_float >>>>> which gets us either: >>>>> ... >>>>> type = <16-byte float>^M >>>>> ... >>>>> or: >>>>> ... >>>>> type = <12-byte float>^M >>>>> ... >>>>> >>>>> Tested on x86_64-linux with native and unix/-m32. >>>> >>>> Unfortunately not all targets support 128-bit long doubles. For arm >>>> and aarch64 the compiler won't generate a 128-bit float, but a >>>> 64-bit float, so the 16ll tests won't be meaningful. >>>> >>> >>> Right, but I'd expect those tests are skipped because 16llf_supported >>> is 0 for 64-bit long double. >> >> They are skipped, but the testcase still assumes some 16llf tests can >> be executed: >> >> gdb_test "print val_long_double" " = 5.0e\\+25" >> >> gdb_test "print val_long_double" " = 5.0e\\+25" \ >>      "print val_long_double after assignment" >> > > Ah, I see, you mean the val_long_double tests that do not use 16llf. > >> The above couple tests won't work correctly, as you're trying to force >> a 128-bit value into a 64-bit variable. >>> >>>> FAIL: gdb.ada/float-bits.exp: print val_long_double >>>> FAIL: gdb.ada/float-bits.exp: print val_long_double after assignment >>>> >>> >>> Can you show me the actual failure mode, that is, copy from gdb.log >>> instead of gdb.sum?  I'm surprised that these fail because AFAICT, >>> the used constant: 5.0e+25 is exactly representable in 64-bit ieee ( >>> I used https://babbage.cs.qc.cuny.edu/ieee-754.old/decimal.html to >>> check this ). >> >> Sure, here it is: >> >> print val_long_double >> $9 = 5.0000000000000002e+25 >> (gdb) FAIL: gdb.ada/float-bits.exp: print val_long_double >> print val_long_double >> $10 = 5.0000000000000002e+25 >> (gdb) FAIL: gdb.ada/float-bits.exp: print val_long_double after >> assignment >> >>> > > I see.  I can reproduce this using reproducer patch posted below, which > gives me: > ... > (gdb) print val_double_2^M > $9 = 5.0000000000000002e+25^M > (gdb) print /x val_double_2^M > $10 = 0x4544adf4b7320335^M > (gdb) > ... > > So, I realize now that my statement about it being exactly representable > was incorrect, it's represented as 2^85 * 1.2924697071141058.  I was > thrown off by the website presenting me a crisp '5.0000000000000000e+25' > as the value, but that's just one way to print it, and glibc evidently > uses a different rounding in printing, which is allowed AFAICT, as per > 'The low-order digit shall be rounded in an implementation-defined manner'. > > So I suppose we could just accept >   " = (5.0e\+25|5.000000000000000\de\+25)" > for 64-bits long double. > >>>> I wonder if it would be best to bail out as soon as we find out the >>>> target has no support for 128-bit floats. I can write a patch for that. >>>> >>> >>> With a rewrite like this: >>> ... >>> -set 16llf_supported 0 >>> +set long_double_bytes 0 >>>   gdb_test_multiple "ptype long_long_float" "" { >>> -    -re -wrap "<16-byte float>" { >>> -       set 16llf_supported 1 >>> -       pass $gdb_test_name >>> -    } >>> -    -re -wrap "<\\d+-byte float>" { >>> -       pass $gdb_test_name >>> +    -re -wrap "<\(\\d+\)-byte float>" { >>> +       set long_double_bytes $expect_out(1,string) >>>       } >>>   } >>> >>> +set 16llf_supported [expr $long_double_bytes >= 16] >>> ... >>> we can formulate the precondition for any test in terms number of >>> long double bytes. >> >> I've sent a patch to make this test a bit more generic: >> https://sourceware.org/pipermail/gdb-patches/2022-April/188440.html >> >> Did you see it? >> > > I did not, I've just come back from vacation and am still working > through my inbox (and you didn't post the patch in reply to this thread, > or cc-ed me, or updated this thread with a reference-to-post, any of > which would mean I would have some pointer in my inbox) .  I'll take a > look. > No worries. I assumed so. It's just that I decided to go ahead and improve the test somewhat, and the improvement seemed beyond what this patch touched.