public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99049] New: _Alignof ignores requested alignment of bit-field types in ms_struct struct
@ 2021-02-10  1:16 ju.orth at gmail dot com
  2021-02-10  7:35 ` [Bug c/99049] " rguenth at gcc dot gnu.org
  2021-02-10 13:44 ` ju.orth at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: ju.orth at gmail dot com @ 2021-02-10  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99049
           Summary: _Alignof ignores requested alignment of bit-field
                    types in ms_struct struct
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ju.orth at gmail dot com
  Target Milestone: ---

Consider

typedef int Int __attribute__((aligned(128)));

struct __attribute__((ms_struct)) X {
        Int i:1;
};

struct Y {
        char c;
        struct X x;
};

int f(void) {
        return _Alignof(struct X);
}

int g(void) {
        return __builtin_offsetof(struct Y, x);
}

When compiling this on x86_64-unknown-linux-gnu, f returns 16 but g returns
128. I believe that _Alignof and __builtin_offsetof as above should always
return the same value.

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

* [Bug c/99049] _Alignof ignores requested alignment of bit-field types in ms_struct struct
  2021-02-10  1:16 [Bug c/99049] New: _Alignof ignores requested alignment of bit-field types in ms_struct struct ju.orth at gmail dot com
@ 2021-02-10  7:35 ` rguenth at gcc dot gnu.org
  2021-02-10 13:44 ` ju.orth at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-10  7:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org
           Keywords|                            |ABI, wrong-code

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I guess the expectation is reasonable but details on the handling of bitfield
types may escape me.

How does MSVC behave here?

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

* [Bug c/99049] _Alignof ignores requested alignment of bit-field types in ms_struct struct
  2021-02-10  1:16 [Bug c/99049] New: _Alignof ignores requested alignment of bit-field types in ms_struct struct ju.orth at gmail dot com
  2021-02-10  7:35 ` [Bug c/99049] " rguenth at gcc dot gnu.org
@ 2021-02-10 13:44 ` ju.orth at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ju.orth at gmail dot com @ 2021-02-10 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Julian Orth <ju.orth at gmail dot com> ---
MSVC returns 128 for both: https://godbolt.org/z/16Tzh7

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

end of thread, other threads:[~2021-02-10 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10  1:16 [Bug c/99049] New: _Alignof ignores requested alignment of bit-field types in ms_struct struct ju.orth at gmail dot com
2021-02-10  7:35 ` [Bug c/99049] " rguenth at gcc dot gnu.org
2021-02-10 13:44 ` ju.orth at gmail 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).