gcc produces incorrect frames due to ABSL_ATTRIBUTE_NO_TAIL_CALL
- Langage dominant
- C++
- Étoiles
- 18.1k
- Forks
- 3.2k
- Merge moyen
- 20 h 36 min
- PR mergées (30 j)
- 1
Description
**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
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.