public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main()
@ 2020-04-17 21:18 edgardragon444 at gmail dot com
2020-04-20 7:29 ` [Bug c/94641] " marxin at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: edgardragon444 at gmail dot com @ 2020-04-17 21:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
Bug ID: 94641
Summary: -Wpadded -fsanitize=undefined together cause warning
on main()
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: edgardragon444 at gmail dot com
Target Milestone: ---
Hi, as I'm fiddling with warning flags (yep, synthesizing -Weverything, what
could go wrong?)
The '-fsanitize=undefined' causes the '-Wpadded' to misbehave, telling me
'main()' struct size is being padded. Disabling UBsan silences the warning.
Happens when all three are true:
1. -fsanitize=undefined flag specified
2. -Wpadded flag specified
3. printf() used
Maybe dup of bug 68901, yet that's c++ with function nested within a struct.
I'm C, and only have printf().
Seen on 8.3.0, 9.2.0 and trunk (https://godbolt.org/z/jFSPf_).
> ed@Fold ~ $ (gcc -xc /dev/fd/9 -Wpadded -fsanitize=address -o /dev/null)9<<<$'#include <stdio.h>\nint main() {printf("Hi"); return 0;}'
> ed@Fold ~ $ (gcc -xc /dev/fd/9 -Wpadded -fsanitize=undefined -o /dev/null)9<<<$'#include <stdio.h>\nint main() {printf("Hi"); return 0;}'
> /dev/fd/9: In function ‘main’:
> /dev/fd/9:2:1: warning: padding struct size to alignment boundary [-Wpadded]
> 2 | int main() {printf("Hi"); return 0;}
> | ^~~
> ed@Fold ~ $ (gcc -xc /dev/fd/9 -Wpadded -fsanitize=undefined -o /dev/null)9<<<$'#include <stdio.h>\nint main() {return 0;}'
> ed@Fold ~ $ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: /tmp/portage/portage/sys-devel/gcc-9.2.0-r4/work/gcc-9.2.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/9.2.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 9.2.0-r4 p5' --disable-esp --enable-libstdcxx-time --with-build-config=bootstrap-lto --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-systemtap --enable-vtable-verify --enable-lto --with-isl --disable-isl-version-check --enable-default-pie --enable-default-ssp
> Thread model: posix
> gcc version 9.2.0 (Gentoo 9.2.0-r4 p5)
> ed@Fold ~ $
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/94641] -Wpadded -fsanitize=undefined together cause warning on main()
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
@ 2020-04-20 7:29 ` marxin at gcc dot gnu.org
2020-04-20 7:47 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-20 7:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2020-04-20
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with GCC 5.1.0.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/94641] -Wpadded -fsanitize=undefined together cause warning on main()
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
2020-04-20 7:29 ` [Bug c/94641] " marxin at gcc dot gnu.org
@ 2020-04-20 7:47 ` jakub at gcc dot gnu.org
2020-04-20 8:01 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-20 7:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jakub at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/94641] -Wpadded -fsanitize=undefined together cause warning on main()
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
2020-04-20 7:29 ` [Bug c/94641] " marxin at gcc dot gnu.org
2020-04-20 7:47 ` jakub at gcc dot gnu.org
@ 2020-04-20 8:01 ` jakub at gcc dot gnu.org
2020-04-21 15:07 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-20 8:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48310
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48310&action=edit
gcc10-pr94641.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/94641] -Wpadded -fsanitize=undefined together cause warning on main()
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
` (2 preceding siblings ...)
2020-04-20 8:01 ` jakub at gcc dot gnu.org
@ 2020-04-21 15:07 ` cvs-commit at gcc dot gnu.org
2020-04-21 15:11 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-21 15:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:73f8e9dca5ff891ed19001b213fd1f6ce31417e3
commit r10-7849-g73f8e9dca5ff891ed19001b213fd1f6ce31417e3
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 21 17:06:31 2020 +0200
ubsan: Avoid -Wpadded warnings [PR94641]
-Wpadded warnings aren't really useful for the artificial types that GCC
lays out for ubsan.
2020-04-21 Jakub Jelinek <jakub@redhat.com>
PR c/94641
* stor-layout.c (place_field, finalize_record_size): Don't emit
-Wpadded warning on TYPE_ARTIFICIAL rli->t.
* ubsan.c (ubsan_get_type_descriptor_type,
ubsan_get_source_location_type, ubsan_create_data): Set
TYPE_ARTIFICIAL.
* asan.c (asan_global_struct): Likewise.
* c-c++-common/ubsan/pr94641.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/94641] -Wpadded -fsanitize=undefined together cause warning on main()
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
` (3 preceding siblings ...)
2020-04-21 15:07 ` cvs-commit at gcc dot gnu.org
@ 2020-04-21 15:11 ` jakub at gcc dot gnu.org
2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:34 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-21 15:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/94641] -Wpadded -fsanitize=undefined together cause warning on main()
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
` (4 preceding siblings ...)
2020-04-21 15:11 ` jakub at gcc dot gnu.org
@ 2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:34 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-16 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:1e4a928134e8f17bbcae99f2bac2bbce73ef6f73
commit r9-8882-g1e4a928134e8f17bbcae99f2bac2bbce73ef6f73
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 21 17:06:31 2020 +0200
ubsan: Avoid -Wpadded warnings [PR94641]
-Wpadded warnings aren't really useful for the artificial types that GCC
lays out for ubsan.
2020-04-21 Jakub Jelinek <jakub@redhat.com>
PR c/94641
* stor-layout.c (place_field, finalize_record_size): Don't emit
-Wpadded warning on TYPE_ARTIFICIAL rli->t.
* ubsan.c (ubsan_get_type_descriptor_type,
ubsan_get_source_location_type, ubsan_create_data): Set
TYPE_ARTIFICIAL.
* asan.c (asan_global_struct): Likewise.
* c-c++-common/ubsan/pr94641.c: New test.
(cherry picked from commit 73f8e9dca5ff891ed19001b213fd1f6ce31417e3)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/94641] -Wpadded -fsanitize=undefined together cause warning on main()
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
` (5 preceding siblings ...)
2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 17:34 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-17 17:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94641
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 8.5 in r8-10489-g3e8a10bb21b4c830e1884ff43edd639eae5bf5ce and by the
above commit for 9.4+ too.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-17 17:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 21:18 [Bug c/94641] New: -Wpadded -fsanitize=undefined together cause warning on main() edgardragon444 at gmail dot com
2020-04-20 7:29 ` [Bug c/94641] " marxin at gcc dot gnu.org
2020-04-20 7:47 ` jakub at gcc dot gnu.org
2020-04-20 8:01 ` jakub at gcc dot gnu.org
2020-04-21 15:07 ` cvs-commit at gcc dot gnu.org
2020-04-21 15:11 ` jakub at gcc dot gnu.org
2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:34 ` jakub at gcc dot gnu.org
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).