public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100058] New: -Wpadded is inconsistent using -mms-bitfields
@ 2021-04-13 0:33 the4naves at gmail dot com
2024-01-23 22:48 ` [Bug target/100058] " nightstrike at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: the4naves at gmail dot com @ 2021-04-13 0:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100058
Bug ID: 100058
Summary: -Wpadded is inconsistent using -mms-bitfields
Product: gcc
Version: 10.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: the4naves at gmail dot com
Target Milestone: ---
// -----------
#include <stdint.h>
#include <stdio.h>
struct {
uint16_t a;
uint8_t b;
} test1;
struct {
uint8_t b;
uint16_t a;
} test2;
int main() {
printf("Size 1: %d\n", sizeof(test1));
printf("Size 2: %d", sizeof(test2));
return 0;
}
// -----------
Compiling this code using `gcc test.cpp -Wpadded -mms-bitfields` only gives a
padding warning for the test1 struct. The printed sizes are both 4. Replacing
`-mms-bitfields` with `-mno-ms-bitfields` gives the expected warnings for
(test1) and (test2.a). The marked gcc version is 10.3, but I was able to
replicate this in every version back to 4.4. 4.1 does seem to work correctly.
Exact version is 10.3.0 under x86_64-linux-gnu. Other than the padding warnings
(1 for ms-bitfields, 2 for no-ms-bitfields), no warnings are printed.
`gcc -v` gives:
Configured with: ../gcc-10.3.0/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu
--enable-languages=c,c++,fortran,ada,go,d --enable-ld=yes --enable-gold=yes
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id
--enable-lto --enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build
Someone else suggested that the line `!targetm.ms_bitfield_layout_p (rli->t)`
in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52238 could be the issue, which
to me seems likely from a brief look.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/100058] -Wpadded is inconsistent using -mms-bitfields
2021-04-13 0:33 [Bug c/100058] New: -Wpadded is inconsistent using -mms-bitfields the4naves at gmail dot com
@ 2024-01-23 22:48 ` nightstrike at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: nightstrike at gmail dot com @ 2024-01-23 22:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100058
nightstrike <nightstrike at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nightstrike at gmail dot com
--- Comment #1 from nightstrike <nightstrike at gmail dot com> ---
(In reply to Josh Nave from comment #0)
> Someone else suggested that the line `!targetm.ms_bitfield_layout_p
> (rli->t)` in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52238 could be the
> issue, which to me seems likely from a brief look.
I don't think it's as simple as just removing those conditions, as they're
trying to restrict warning for MS-specific cases. We need to understand under
which conditions it's expected to warn when -mms-bitfields is enabled.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-23 22:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 0:33 [Bug c/100058] New: -Wpadded is inconsistent using -mms-bitfields the4naves at gmail dot com
2024-01-23 22:48 ` [Bug target/100058] " nightstrike 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).