Skip to content

Conversation

robertoraggi
Copy link
Owner

int ptr_1() {
  int i = 42;
  int *p = &i;
  return *p;
}

int ptr_2() {
  int i = 42;
  int *p = &i;
  i = 123;
  return *p;
}

int ptr_3() {
  int i = 123;
  return *&i;
}
$ x.c -emit-ir -toolchain macos |mlir-translate --mlir-to-llvmir |lli --entry-function=ptr_1; echo $?
42

$ x.c -emit-ir -toolchain macos |mlir-translate --mlir-to-llvmir |lli --entry-function=ptr_2; echo $?
123

$ x.c -emit-ir -toolchain macos |mlir-translate --mlir-to-llvmir |lli --entry-function=ptr_3; echo $?
123

@robertoraggi robertoraggi merged commit 3b00e56 into main Aug 4, 2025
9 checks passed
@robertoraggi robertoraggi deleted the open-mastodon branch August 4, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant