Skip to content

volatile dropped #3

@spth

Description

@spth

A common idiom for memory-mapped I/O is this:

void f(void)
{
  (*(volatile uint8_t*)42) = 23;
}

clang-3.8 correctly compiles this into a volatile store in LLVM IR:

define void @f() #0 {
  store volatile i8 23, i8* inttoptr (i64 42 to i8*), align 1
  ret void
}

However, the cbe drops the volatile:

void f(void) {
  *((uint8_t*)(uintptr_t)UINT64_C(42)) = 23;
}

Philipp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions