From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uXP/H9SGVWoA6QYAWB0awg (envelope-from ) for ; Mon, 13 Jul 2026 20:46:12 -0400 Received: by simark.ca (Postfix, from userid 112) id 7B73B1E166; Mon, 13 Jul 2026 20:46:12 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id ACB3F1E09B for ; Mon, 13 Jul 2026 20:46:11 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AEEED4BA2E30 for ; Tue, 14 Jul 2026 00:46:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AEEED4BA2E30 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by sourceware.org (Postfix) with ESMTPS id 124FF4BA2E09 for ; Tue, 14 Jul 2026 00:45:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 124FF4BA2E09 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 124FF4BA2E09 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783989947; cv=none; b=lL3eq4XaaSb2LkidWO3A89LjAy39N5lzXOBj59lsD/5xHFEDvl3n7kLMqTfdv4BM3TIAmJAa0VxTud9Uz6XCBy3PRUnhomCobiZiVLbYbQYG2GLijCCON4RTBWZ3S1eSpm7G60BACEwxsK+opBXrNqXivV9wCO5UFmFe555WPuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783989947; c=relaxed/simple; bh=e42pdLRVn6+Zuy+5JP46vForg8kJNdzdxflIjegTpgA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=sqh+ODY8qjEaiD6fAe5h0qRkhMqh0QXmKNDqs7u+Qf+DGqKBJVeBVSbvI5KhQniQWCo8EPLeBE1niOZ0Tl76UIioVEXHbNDqlHaGw4KcDuda1sCPkV5KqN49iEbsk7Awq/nE9ay9LZ/C4uRqamMMlvCGDxOHIv3eZVmPaQhURlY= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 124FF4BA2E09 Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-493f60208a5so32103485e9.3 for ; Mon, 13 Jul 2026 17:45:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783989946; x=1784594746; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=H2HsG5HLXBmchY466bw9soLumF+4ljKUiWKZkBaddYM=; b=DzHlF9Hg5c8yzXcp4T7wq6txzTN4l1C//1cTyZShViETkB9/tmvGddgFplqU8rnZYR 9EPgvXmzorWxa4B54Sy2VFz9y2RU7qKjMUpvcvLR21QuNn6hu05i0cSEHuJaxQIpAYZy 8oDvO8XOU2zxu3418XcVULTAeqcgRUQsFvii87MlJ5MdnqQhD5lINVhVBP9+7GONfcjT HHh4J5a5Ou7aTq36HDeBF9/RCvd7yhhpSqTXmqz+sO5YUAKWHX/wEia1YUuKuGmhDu50 jiT+JBaqj1Sm9ZaesE+Ro1OfIBHTkRMCEf+qPPl6yZ7J24xSoqbM+IIezVIgGW7pHqrN 225A== X-Gm-Message-State: AOJu0YxIJmZUC4pNN6J9mgKmOfmEs3IaoCHDvCpPSmYE04DY4DtstI5z 1/1PTGAt1ojtfpxMfzDozjUwRxTbuIuqoch/ucyj2rrydQL8jTJjx1qaPp4uRpEzOW0= X-Gm-Gg: AfdE7ck4q+3Ut5m4e9fetcAt6e/D2uOm9kEu9Ms4fmYIm2rcVSI4xOv6MTNQ0aI4eYl vXahktndnnFvs3OGu4lPvT/afBepcIKa3f0WqsRPTQEP4f7XJZ+nzz3GaKK/CeAdHPUNU5hNU/Q ERTBdzucU/tEfuxRHqSZP6rCemrF/+DdXAEk5IK6TeKAzNP3z3Q5JYGSs9tDMS7+eG5cOHa+++0 q58Rw7nKgTsx/yr+XJvIJdNs45PFIdwlbB9WOOOn7yRKgAHfg2pio/dqj00pbF9RdkUuSN7yJ7l kpmqT5CCaivx0ifmG1RWmpmEcUpBT46aSfJV7YoIFBu782dGSeRUFZie4ybGEqyM7KJaoTG3CzM OeRzKZQ7EzLTkrEE4d8niEd+0qY+1alpA3bJIInM87fQ8bNs5eZMSoxPnpF35rp1q4iUuy4IYmt WH+aqqEDQdyDc= X-Received: by 2002:a05:600c:e549:10b0:493:a435:d870 with SMTP id 5b1f17b1804b1-493f8825899mr76535415e9.27.1783989945888; Mon, 13 Jul 2026 17:45:45 -0700 (PDT) Received: from localhost ([2001:8a0:fae3:3700:e20e:b691:1f0e:d301]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-49506a1fbcesm35913965e9.0.2026.07.13.17.45.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jul 2026 17:45:45 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 4/4] gdb: MSVC "long double" is a 64-bit double Date: Tue, 14 Jul 2026 01:45:07 +0100 Message-ID: <20260714004507.1323332-5-pedro@palves.net> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260714004507.1323332-1-pedro@palves.net> References: <20260714004507.1323332-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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~public-inbox=simark.ca@sourceware.org The GNU (MinGW) and MSVC ABIs disagree on "long double". - GCC the 80-bit x87 extended type on x86 (stored in 96 bits on i386 and 128 bits on amd64), and the 128-bit IEEE quad on AArch64. - MSVC makes "long double" just an alias for "double", an IEEE 64-bit double. GDB modeled only the GNU sizes, via the per-architecture defaults, so with an MSVC program it got "long double" wrong. E.g. on AMD64: (gdb) set osabi Windows-MSVC (gdb) print sizeof (long double) $1 = 16 when an MSVC "long double" should be 8 bytes. Now that we can distinguish the GNU and MSVC flavors, set the smaller size and IEEE-double format for the MSVC flavor. This is done in the shared windows_init_abi, so it covers i386, amd64 and AArch64 all at once. After: (gdb) set osabi Windows-MSVC (gdb) print sizeof (long double) $1 = 8 Change-Id: I0acb2e80027cb7b1fcfd1f39dd050a24438e1662 --- gdb/windows-tdep.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 78bf49b9c81..a1e44f8aa3f 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -17,6 +17,7 @@ #include "windows-tdep.h" #include "extract-store-integer.h" +#include "gdbtypes.h" #include "gdbsupport/gdb_obstack.h" #include "xml-support.h" #include "gdbarch.h" @@ -1031,6 +1032,14 @@ windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* On Windows, "long"s are only 32bit. */ set_gdbarch_long_bit (gdbarch, 32); + /* With the MSVC ABI, "long double" is just an IEEE 64-bit double, + the same as "double". */ + if (info.osabi == GDB_OSABI_WINDOWS_MSVC) + { + set_gdbarch_long_double_bit (gdbarch, 64); + set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); + } + /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, windows_tls_index_address); -- 2.54.0