New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volatile dropped #3

Open
spth opened this Issue Sep 21, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@spth

spth commented Sep 21, 2016

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

@spth

This comment has been minimized.

Show comment
Hide comment
@spth

spth Sep 21, 2016

The problem happens for reading from an address just as for writing to an address.

Philipp

spth commented Sep 21, 2016

The problem happens for reading from an address just as for writing to an address.

Philipp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment