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

            Bug ID: 108963
           Summary: ASAN produces wrong line number in the report
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shaohua.li at inf dot ethz.ch
                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, marxin at 
gcc dot gnu.org
  Target Milestone: ---

For the following code, ASAN at -O1 and above always produces the wrong line
number. I've found quite some cases that have this issue.

Compiler explorer: https://godbolt.org/z/hscP9T78M

% cat a.c
union a {
  int b;
};
char c;
int d;
static long e(int *f) {
  for (; c <= 1;c++)
    *(f + 1) |= 2;
  return 0;
}
int main() {
  union a g = {};
  e(&d);
  &g;
}
%
% gcc-tk -O0 -fsanitize=address a.c && ./a.out
=================================================================
==1==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000404184
at pc 0x0000004011d6 bp 0x7ffea18cbe60 sp 0x7ffea18cbe58
READ of size 4 at 0x000000404184 thread T0
    #0 0x4011d5 in e /a.c:8
    #1 0x4012f1 in main /a.c:13
...
% 
% gcc-tk -O1 -fsanitize=address a.c && ./a.out
=================================================================
==1==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000404144
at pc 0x000000401289 bp 0x7ffff4114850 sp 0x7ffff4114848
READ of size 4 at 0x000000404144 thread T0
    #0 0x401288 in main /a.c:12
...
%

Maybe a fundunmentally similar to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108023
  • [Bug sanitizer/108963] New: ASA... shaohua.li at inf dot ethz.ch via Gcc-bugs

Reply via email to