Skip to content

Crash with asm volatile #1689

Closed
Closed
@Sahnvour

Description

@Sahnvour

I was toying with inline assembly syntax to try to reproduce the DoNotOptimize function from google/benchmark https://github.com/google/benchmark/blob/master/include/benchmark/benchmark.h#L309-L326.

I wrote this https://godbolt.org/z/eExl8y by trial and error since there's no inline asm documentation yet.
Ouput operands cannot be empty do I added a dummy variable to satisfy the language.

Now even insignificant modifications to this code can cause a compiler crash:

  • try adding a blank line before the asm volatile
  • try modifying the xxx identifier
  • try changing num to be a value instead of a pointer
  • try using a directly inside the asm instead of its address

These only happen in release modes.
I'm not sure what belongs to bugs and to invalid input, but I guess the compiler should at least not crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions