From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 2219B3858D33 for ; Mon, 2 May 2022 07:10:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2219B3858D33 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 3B7681F897; Mon, 2 May 2022 07:10:37 +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 1F9C513491; Mon, 2 May 2022 07:10:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XwkdBu2Db2JJbgAAMHmgww (envelope-from ); Mon, 02 May 2022 07:10:37 +0000 Message-ID: <98208d6d-817d-b3a8-aebf-d56ac33ff40e@suse.de> Date: Mon, 2 May 2022 09:10:36 +0200 MIME-Version: 1.0 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: Luis Machado , gdb-patches@sourceware.org Cc: Tom Tromey References: <20220414131412.GA9234@delia> <2ce6644a-6480-8a78-b53c-c2321956f3d8@arm.com> From: Tom de Vries In-Reply-To: <2ce6644a-6480-8a78-b53c-c2321956f3d8@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, 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: Mon, 02 May 2022 07:10:39 -0000 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. > 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 ). > 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. Thanks, - Tom > I'm guessing some 16ll tests still work for 12-byte floats, right? > > What do you think?