leetcode 报错总结

Line 1034: Char 9: runtime error: reference binding to misaligned address 0xbebebebebebebebe for type ‘int’, which requires 4 byte alignment (stl_vector.h) 0xbebebebebebebebe: note: pointer points here SUMMARY: UndefinedBehavior

翻译:
第1034行:字符9:运行时错误:引用绑定到类型“int”的未对齐地址0xbebebebebebebebe,它需要4字节对齐(stl_vector.h)
0xbebebebebebebebe:注意:指针指向此处

错误原因:数组越界。比如当二维数组为空时,访问matrix[0].size()就会发生报错。

Line 23: Char 13: runtime error: index 50 out of bounds for type ‘std::string [10]’ (solution.cpp)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:32:13

错误原因:数组越界,‘2’对应的ASCII是20,在访问之前应该线转换成整型, -0

runtime error: addition of unsigned offset to 0x602000000130 overflowed to 0x60200000012c (stl_vector.h)

0x602000000130添加无符号偏移量溢出到0x60200000012c(stl_vector.h)意思是,vector下标出现了小于0的数字

AddressSanitizer:DEADLYSIGNAL

原因是进入了无限循环,比如在写并查集findfather的时候father[x] = findfather(father[x])  写成了father[x] = findfather(x) 

AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x603000000460

原因是申请和释放不匹配:把new free改成 new delete
  • 5
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值