public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113633] New: FAIL: gcc.dg/bf-ms-attrib.c execution test, wrong size for ms_struct
@ 2024-01-28  6:38 nightstrike at gmail dot com
  2024-01-31  9:32 ` [Bug target/113633] " lh_mouse at 126 dot com
  2024-02-01  9:30 ` radek.barton at microsoft dot com
  0 siblings, 2 replies; 3+ messages in thread
From: nightstrike at gmail dot com @ 2024-01-28  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113633

            Bug ID: 113633
           Summary: FAIL: gcc.dg/bf-ms-attrib.c execution test, wrong size
                    for ms_struct
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ABI, testsuite-fail
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nightstrike at gmail dot com
                CC: ktietz at gcc dot gnu.org
  Target Milestone: ---
            Target: *-*-mingw* *-*-cygwin*

From gcc.dg/bf-ms-attrib.c:

struct one_ms {
  int d;
  unsigned char a;
  unsigned short b:7;
  char c;       
} __attribute__((__ms_struct__));

And later:

    if (sizeof(struct one_ms) != 8)
        abort();

Here, we abort, because the size is 12 using the MS ABI.

Curiously, the testcase as initially committed used 12, and it was changed to 8
in r0-115284-g4d33b77106cf7f with the description being:

gcc.dg/bf-ms-attrib.c: Adjust expected size for ms_struct layout.

However, MSVC (and gcc/cygwin FWIW) creates a 12-byte struct, so I am curious
which is correct.  Should that portion of that commit be reverted, or should
the struct be packed into 8 bytes?  If you happen to still be reading this,
Kai, would you mind weighing in?

Perhaps we were incorrectly making 8-byte structs, then changed the testcase to
match 8, and later fixed something to generate 12-byte structs?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/113633] FAIL: gcc.dg/bf-ms-attrib.c execution test, wrong size for ms_struct
  2024-01-28  6:38 [Bug target/113633] New: FAIL: gcc.dg/bf-ms-attrib.c execution test, wrong size for ms_struct nightstrike at gmail dot com
@ 2024-01-31  9:32 ` lh_mouse at 126 dot com
  2024-02-01  9:30 ` radek.barton at microsoft dot com
  1 sibling, 0 replies; 3+ messages in thread
From: lh_mouse at 126 dot com @ 2024-01-31  9:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113633

LIU Hao <lh_mouse at 126 dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lh_mouse at 126 dot com

--- Comment #1 from LIU Hao <lh_mouse at 126 dot com> ---
My suggestion is that following what MSVC produces is the only way to go.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/113633] FAIL: gcc.dg/bf-ms-attrib.c execution test, wrong size for ms_struct
  2024-01-28  6:38 [Bug target/113633] New: FAIL: gcc.dg/bf-ms-attrib.c execution test, wrong size for ms_struct nightstrike at gmail dot com
  2024-01-31  9:32 ` [Bug target/113633] " lh_mouse at 126 dot com
@ 2024-02-01  9:30 ` radek.barton at microsoft dot com
  1 sibling, 0 replies; 3+ messages in thread
From: radek.barton at microsoft dot com @ 2024-02-01  9:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113633

Radek Barton <radek.barton at microsoft dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |radek.barton at microsoft dot com

--- Comment #2 from Radek Barton <radek.barton at microsoft dot com> ---
When `__attribute__((__ms_struct__))` is present, the struct size should be
compatible with MS ABI (which is 12).

The relevant documentation for MS ABI is here
https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions?view=msvc-170


Hope this helps.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-01  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28  6:38 [Bug target/113633] New: FAIL: gcc.dg/bf-ms-attrib.c execution test, wrong size for ms_struct nightstrike at gmail dot com
2024-01-31  9:32 ` [Bug target/113633] " lh_mouse at 126 dot com
2024-02-01  9:30 ` radek.barton at microsoft dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).