Skip to content

rustc miscompiles trivial Future combinator #111264

Closed
@jonas-schievink

Description

@jonas-schievink

In #111263, I added a Future::map combinator that always returns Poll::Pending. However, the corresponding test in coretests crashes with a segfault, instead of hanging indefinitely (the expected behavior for this incomplete implementation). According to GDB, the test function is miscompiled quite badly, and just unconditionally dereferences a NULL pointer when run:

Dump of assembler code for function _ZN9coretests6future8test_map17hc8a76af39ef20947E:
   0x0000555555735320 <+0>:     sub    $0x38,%rsp
   0x0000555555735324 <+4>:     movb   $0x0,(%rsp)
   0x0000555555735328 <+8>:     mov    (%rsp),%rax
=> 0x000055555573532c <+12>:    cmpb   $0x0,(%rax)

Metadata

Metadata

Labels

C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions