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

            Bug ID: 63245
           Summary: renderMemorySnippet shouldn't show more bytes than the
                    underlying type
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

c-c++-common/ubsan/align-4.c fails at random for -m32 on Linux/x86:

/export/gnu/import/git/gcc/gcc/testsuite/c-c++-common/ubsan/align-2.c:37:11:
runtime error: load of misaligned address 0x08049ff1 for type 'long long int',
which requires 4 byte alignment
0x08049ff1: note: pointer points here
 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
Program received signal SIGSEGV, Segmentation fault.
0xf79f0e98 in renderMemorySnippet (Args=<optimized out>, 
    NumRanges=<optimized out>, Ranges=<optimized out>, Loc=<optimized out>, 
    Decor=...)
    at /export/gnu/import/git/gcc/libsanitizer/ubsan/ubsan_diag.cc:208
208        Printf("%s%02x", (P % 8 == 0) ? "  " : " ", C);
(gdb) 

The program has

08048000-08049000 r-xp 00000000 08:11 39853233                          
/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/testsuite/g++/align-4.exe
08049000-0804a000 rw-p 00000000 08:11 39853233                          
/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/testsuite/g++/align-4.exe

There is a long long int at 0x08049ff1.  But renderMemorySnippet tries
to show 32 bytes even though long long int only has 8 bytes.

Reply via email to