萌新刚学OI1ms,悬关求问为何RE

SP1805 HISTOGRA - Largest Rectangle in a Histogram

```cpp s.pop(); s.top().con+=num; ``` 有没有可能 `pop` 之后 `stack` 就空了。
by ShwStone @ 2023-08-13 09:27:01


附:`-fsanitize=address` 报错信息: ``` /usr/lib/gcc/x86_64-pc-linux-gnu/12.3.0/include/c++/bits/stl_deque.h:182:17: runtime error: reference binding to misaligned address 0xbebebebebebec0ae for type 'struct node', which requires 8 byte alignment 0xbebebebebebec0ae: note: pointer points here <memory cannot be printed> /usr/lib/gcc/x86_64-pc-linux-gnu/12.3.0/include/c++/bits/stl_deque.h:1473:10: runtime error: reference binding to misaligned address 0xbebebebebebec0ae for type 'struct value_type', which requires 8 byte alignment 0xbebebebebebec0ae: note: pointer points here <memory cannot be printed> /usr/lib/gcc/x86_64-pc-linux-gnu/12.3.0/include/c++/bits/stl_stack.h:235:16: runtime error: reference binding to misaligned address 0xbebebebebebec0ae for type 'struct value_type', which requires 8 byte alignment 0xbebebebebebec0ae: note: pointer points here <memory cannot be printed> a.cpp:26:25: runtime error: member access within misaligned address 0xbebebebebebec0ae for type 'struct value_type', which requires 8 byte alignment 0xbebebebebebec0ae: note: pointer points here <memory cannot be printed> AddressSanitizer:DEADLYSIGNAL ================================================================= ==2489==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x55df09049fbe bp 0xbebebebebebec0ae sp 0x7ffe21c78410 T0) ==2489==The signal is caused by a READ memory access. ==2489==Hint: this fault was caused by a dereference of a high value address (see register values below). Disassemble the provided pc to learn which register was used. #0 0x55df09049fbe in main (/home/shwstone/Dotfiles/.run_re/run+0xefbe) (BuildId: 4f61bcae2f0699e98af0d69f42e261ef06f72779) #1 0x7f65dbe27ccf (/usr/lib/libc.so.6+0x27ccf) (BuildId: 8f3291ff820508330af3a5ccb75de43d474ef19a) #2 0x7f65dbe27d89 in __libc_start_main (/usr/lib/libc.so.6+0x27d89) (BuildId: 8f3291ff820508330af3a5ccb75de43d474ef19a) #3 0x55df0904dba4 in _start (/home/shwstone/Dotfiles/.run_re/run+0x12ba4) (BuildId: 4f61bcae2f0699e98af0d69f42e261ef06f72779) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/home/shwstone/Dotfiles/.run_re/run+0xefbe) (BuildId: 4f61bcae2f0699e98af0d69f42e261ef06f72779) in main ==2489==ABORTING ``` 注意 **a.cpp:26:25: runtime error: member access within misaligned address 0xbebebebebebec0ae for type 'struct value_type', which requires 8 byte alignment**。
by ShwStone @ 2023-08-13 09:30:07


@[ShwStone](/user/491204) 哦感谢已关
by Wildchesse @ 2023-08-13 09:30:41


|