Can someone take a quick look at this?

What am I not seeing?

Any idea why @initModule is returning a random value as if from uninitialized memory?

; ModuleID = ‘test_4’

source_filename = “test_4”

target datalayout = “e-m:e-i64:64-f80:128-n8:16:32:64-S128”

@foo = global i32 0, align 4

@bar = external global float, align 4

define i32 @initModule() {


store i32 123, i32* @foo, align 4

%0 = load i32, i32* @foo, align 4

ret i32 %0


If the answer is not obvious I’ll work on creating a minimal reproduction case… I was just hoping that someone else could see something obvious that I’m missing.


I can't see anything wrong with this fragment. I'd be looking hard at
the caller (a JIT, perhaps?) and where it expects the value to be
returned because there aren't many other ways to get a simple module
like that wrong without crashing.