public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement
@ 2020-11-11 20:46 hjl.tools at gmail dot com
2020-11-12 7:14 ` [Bug testsuite/97803] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-11-11 20:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
Bug ID: 97803
Summary: c-c++-common/asan/pointer-compare-1.c assumes variable
placement
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: testsuite
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
c-c++-common/asan/pointer-compare-1.c has
char global1[100] = {}, global2[100] = {};
char __attribute__((used)) smallest_global[5] = {};
char small_global[7] = {};
char __attribute__((used)) little_global[10] = {};
char __attribute__((used)) medium_global[4000] = {};
char large_global[5000] = {};
char __attribute__((used)) largest_global[6000] = {};
They are used to has layout:
0000000000404380 B largest_global
0000000000405b20 B large_global
0000000000406ee0 B medium_global
0000000000407ea0 B little_global
0000000000407ee0 B small_global
0000000000407f20 B smallest_global
0000000000407f60 B global2
0000000000408000 B global1
00000000004080e0 B __odr_asan.largest_global
00000000004080e1 B __odr_asan.large_global
00000000004080e2 B __odr_asan.medium_global
00000000004080e3 B __odr_asan.little_global
00000000004080e4 B __odr_asan.small_global
00000000004080e5 B __odr_asan.smallest_global
00000000004080e6 B __odr_asan.global2
00000000004080e7 B __odr_asan.global1
With SHF_GNU_RETAIN change:
https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/elf/shf_retain
the new layout become:
0000000000404380 B large_global
0000000000405740 B small_global
0000000000405780 B global2
0000000000405820 B global1
0000000000405900 B __odr_asan.largest_global
0000000000405901 B __odr_asan.large_global
0000000000405902 B __odr_asan.medium_global
0000000000405903 B __odr_asan.little_global
0000000000405904 B __odr_asan.small_global
0000000000405905 B __odr_asan.smallest_global
0000000000405906 B __odr_asan.global2
0000000000405907 B __odr_asan.global1
0000000000405920 B largest_global
00000000004070c0 B medium_global
0000000000408080 B little_global
00000000004080c0 B smallest_global
and test fails.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/97803] c-c++-common/asan/pointer-compare-1.c assumes variable placement
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
@ 2020-11-12 7:14 ` rguenth at gcc dot gnu.org
2020-11-12 8:31 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-12 7:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Does it work if you add -fno-toplevel-reorder? SHF_GNU_RETAIN should preserve
the order of vars even if 'used' then.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/97803] c-c++-common/asan/pointer-compare-1.c assumes variable placement
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
2020-11-12 7:14 ` [Bug testsuite/97803] " rguenth at gcc dot gnu.org
@ 2020-11-12 8:31 ` marxin at gcc dot gnu.org
2020-11-12 13:47 ` hjl.tools at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-12 8:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2020-11-12
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
I can take care of this.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/97803] c-c++-common/asan/pointer-compare-1.c assumes variable placement
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
2020-11-12 7:14 ` [Bug testsuite/97803] " rguenth at gcc dot gnu.org
2020-11-12 8:31 ` marxin at gcc dot gnu.org
@ 2020-11-12 13:47 ` hjl.tools at gmail dot com
2020-11-12 13:48 ` hjl.tools at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-11-12 13:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> Does it work if you add -fno-toplevel-reorder? SHF_GNU_RETAIN should
> preserve the order of vars even if 'used' then.
Linker will reorder section layout when SHF_GNU_RETAIN is used.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/97803] c-c++-common/asan/pointer-compare-1.c assumes variable placement
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
` (2 preceding siblings ...)
2020-11-12 13:47 ` hjl.tools at gmail dot com
@ 2020-11-12 13:48 ` hjl.tools at gmail dot com
2020-11-16 10:40 ` marxin at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-11-12 13:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 49552
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49552&action=edit
A patch
This works with SHF_GNU_RETAIN.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/97803] c-c++-common/asan/pointer-compare-1.c assumes variable placement
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
` (3 preceding siblings ...)
2020-11-12 13:48 ` hjl.tools at gmail dot com
@ 2020-11-16 10:40 ` marxin at gcc dot gnu.org
2020-11-16 12:11 ` cvs-commit at gcc dot gnu.org
2020-11-16 13:07 ` hjl.tools at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-16 10:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Assignee|marxin at gcc dot gnu.org |unassigned at gcc dot gnu.org
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #4)
> Created attachment 49552 [details]
> A patch
>
> This works with SHF_GNU_RETAIN.
Please install the patch H.J.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/97803] c-c++-common/asan/pointer-compare-1.c assumes variable placement
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
` (4 preceding siblings ...)
2020-11-16 10:40 ` marxin at gcc dot gnu.org
@ 2020-11-16 12:11 ` cvs-commit at gcc dot gnu.org
2020-11-16 13:07 ` hjl.tools at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-16 12:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:9dbf8dc7a96a8020e0ee05926ef7a3f976e9c318
commit r11-5054-g9dbf8dc7a96a8020e0ee05926ef7a3f976e9c318
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Nov 11 15:54:00 2020 -0800
pointer-compare-1.c: Add __attribute__((used))
c-c++-common/asan/pointer-compare-1.c assumes the certain order for
variable placement. Add __attribute__((used)) to avoid variable
placement changes due to SHF_GNU_RETAIN.
PR testsuite/97803
* c-c++-common/asan/pointer-compare-1.c (global1): Add
__attribute__((used))
(global2): Likewise.
(small_global): Likewise.
(large_global): Likewise.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/97803] c-c++-common/asan/pointer-compare-1.c assumes variable placement
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
` (5 preceding siblings ...)
2020-11-16 12:11 ` cvs-commit at gcc dot gnu.org
@ 2020-11-16 13:07 ` hjl.tools at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-11-16 13:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |11.0
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-11-16 13:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 20:46 [Bug testsuite/97803] New: c-c++-common/asan/pointer-compare-1.c assumes variable placement hjl.tools at gmail dot com
2020-11-12 7:14 ` [Bug testsuite/97803] " rguenth at gcc dot gnu.org
2020-11-12 8:31 ` marxin at gcc dot gnu.org
2020-11-12 13:47 ` hjl.tools at gmail dot com
2020-11-12 13:48 ` hjl.tools at gmail dot com
2020-11-16 10:40 ` marxin at gcc dot gnu.org
2020-11-16 12:11 ` cvs-commit at gcc dot gnu.org
2020-11-16 13:07 ` hjl.tools 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).