http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59029
Bug ID: 59029 Summary: ICE with builtin function and -fsanitize=address Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org 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 The following code snippet compiled with "-fsanitize=address -O" triggers an ICE since GCC 4.8.0 (when the address-sanitizer was introduced): ======================================== inline int foo(int* p) { return __sync_fetch_and_add(p, 1); } void bar() { foo(0); } ======================================== bug.c: In function 'bar': bug.c:6:6: internal compiler error: in get_mem_refs_of_builtin_call, at asan.c:722 inline int foo(int* p) ^ 0x987d46 get_mem_refs_of_builtin_call ../../gcc/gcc/asan.c:722 0x98adb5 has_stmt_been_instrumented_p ../../gcc/gcc/asan.c:801 0x98adb5 transform_statements ../../gcc/gcc/asan.c:1919 0x98be62 asan_instrument ../../gcc/gcc/asan.c:2271 0x98be62 execute ../../gcc/gcc/asan.c:2311 Please submit a full bug report, [etc.] In addition, the error location of the ICE is broken: the caret points to the first line of the file whereas the reported line number is 6.