compiler-explorer / compiler-explorer/compiler-explorer

[BUG]: Branch target is filtered out

Open
#6,017 3 comments 0 reactions 0 assignees View on GitHub
bug wont-fix
Dominant language
TypeScript
Stars
19.1k
Forks
2.1k
Avg merge
3d 15h
Merged PRs (30d)
67

Description

### Describe the bug

In the program at https://gcc.godbolt.org/z/M1ET1cc6e , line 6 of the assembly output is `je .L8` but there is no line labeled `.L8` shown (it has apparently been filtered out by whatever heuristics the compiler explorer is using to show relevant code).

### Steps to reproduce

https://gcc.godbolt.org/z/M1ET1cc6e

~~~
#include

struct Foo {
Foo(const Foo &);
};

typedef std::variant v_t;

struct Visitor {
void operator()(const Foo &) const;
};

void func(const v_t &v) {
std::visit(Visitor(), v);
}
~~~

x86-64 gcc (trunk) with
-O3 -Wall -std=c++17

### Actual Behavior

~~~
.LC0:
.string "std::visit: variant is valueless"
func(std::variant const&):
sub rsp, 24
cmp BYTE PTR [rdi+1], -1
je .L8
mov rsi, rdi
lea rdi, [rsp+15]
call Visitor::operator()(Foo const&) const
add rsp, 24
ret
func(std::variant const&) [clone .cold]:
typeinfo name for std::bad_variant_access:
.string "St18bad_variant_access"
typeinfo for std::bad_variant_access:
.quad vtable for __cxxabiv1::__si_class_type_info+16
.quad typeinfo name for std::bad_variant_access
.quad typeinfo for std::exception
vtable for std::bad_variant_access:
.quad 0
.quad typeinfo for std::bad_variant_access
.quad std::bad_variant_access::~bad_variant_access() [complete object destructor]
.quad std::bad_variant_access::~bad_variant_access() [deleting destructor]
.quad std::bad_variant_access::what() const
.LC1:
.quad vtable for std::bad_variant_access+16
.LC2:
.quad .LC0
~~~

### Expected behavior

Obviously compiler explorer doesn't show all the assembly output, but if a label is a branch target, I would *assume* it would try to show the code at that label.

### Reproduction link

https://gcc.godbolt.org/z/M1ET1cc6e

### Screenshots

Not applicable

### Operating System

_No response_

### Browser version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.