牙山不报告泄漏信息

时间:2019-11-28 07:47:14

标签: centos g++ address-sanitizer

我编写了一个简单的c ++程序,该程序使用新功能并且不使用delete函数,然后使用asan,但没有报告。

#include <iostream>
#include <stdint.h>

using namespace std;

int main()
{
    int *p = new int[50];
    for (uint32_t i = 0; i < 50; ++i)
    {
        *(p + i ) = i;
    }
    cout << *p << endl;
    return 0;
}

然后./g++ main.cpp -lasan -L/root/local/lib64/ -fsanitize=address -fno-omit-frame-pointer -g

并打印0,但不报告delete泄漏。为什么?

如果我使用export LD_PRELOAD=/usr/local/lib64/libasan.so.0.0.0,则./g++ main.cpp 报告

g++: internal compiler error: Segmentation fault (program collect2)
0x40c400 execute
    ../../gcc/gcc.c:2823
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

它看起来像collect2核心转储,所以我运行cd libexec/gcc/x86_64-unknown-linux-gnu/4.8.5/ && ./colloct2,报告Segmentation fault (core dumped)

我使用源代码安装gcc-4.8.5,centos 6。

1 个答案:

答案 0 :(得分:1)

gcc-4_8-branch甚至不包含libsanitizer / lsan /目录。请尝试使用最新的GCC版本。由https://github.com/google/sanitizers/issues/699

相关问题