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

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).