gcc produces incorrect frames due to ABSL_ATTRIBUTE_NO_TAIL_CALL
- Ngôn ngữ chính
- C++
- Star
- 18.1k
- Fork
- 3.2k
- Merge trung bình
- 20 giờ 36 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
**Describe the bug**
debugging/stacktrace uses ABSL_ATTRIBUTE_NO_TAIL_CALL to disable stack optimization.
For gcc, the macro gets expanded to __attribute__((optimize("no-optimize-sibling-calls"))) which is known to be broken:
https://gcc.gnu.org/wiki/FAQ#A__attribute__.28.28__optimize__.28X.29.29.29_does_not_work_as_expected
**Steps to reproduce the bug**
```
ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL void Baz() {
void *stack[32];
int depth = absl::GetStackTrace(stack, 32, 0);
// Stack trace is missing Foo, Bar, & Baz in optimized build.
// Removing ABSL_ATTRIBUTE_NO_TAIL_CALL from Foo, Bar, Baz, and absl::GetStackTrace fixes the issue.
}
ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL void Bar() { Baz(); }
ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL void Foo { Bar(); }
```
**What version of Abseil are you using?**
d4607b3f05f3f22dda383efcb0aba7e7d9359823
**What operating system and version are you using**
Ubuntu 18.04
**What compiler and version are you using?**
gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1~18.04.1)
**What build system are you using?**
bazel 5.2.0
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.