小编rit*_*raj的帖子

AddressSanitizer:DEADLYSIGNAL 尝试使用堆栈运行代码以获取有效括号问题集时出现 DEADLYSIGNAL 错误

我在 leetcode.com 上尝试这个名为“有效括号”的问题时,弹出了一条错误消息:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==30==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000003783d6 bp 0x7ffe68231e10 sp 0x7ffe68231ca0 T0)
==30==The signal is caused by a READ memory access.
==30==Hint: this fault was caused by a dereference of a high value address (see register values below).  Dissassemble the provided pc to learn which register was used.
    #3 0x7f427121b0b2  (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
AddressSanitizer can not provide additional info.
==30==ABORTING
Run Code Online (Sandbox Code Playgroud)

这是生成错误的代码

#include <stack>

using namespace std;

class Solution {
public:
    bool isValid(string str) {
        stack<char> s; …
Run Code Online (Sandbox Code Playgroud)

c++ segmentation-fault address-sanitizer

1
推荐指数
1
解决办法
2万
查看次数