abseil / abseil/abseil-cpp

gcc produces incorrect frames due to ABSL_ATTRIBUTE_NO_TAIL_CALL

Aberta
#1,278 0 comentários 0 reações 0 responsáveis Ver no GitHub
bug
Linguagem predominante
C++
Estrelas
18.1k
Forks
3.2k
Merge médio
20h 36min
PRs com merge (30d)
1

Descrição

**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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.