Skip to content

Simple X32 miscompilation #55061

Closed
Closed
@henke96

Description

@henke96

test.c:

void test(void) {
    *(int *)0x80000000 = 0x123;
}

Compile with: clang -target x86_64-unknown-linux-gnux32 -O1 -c test.c

objdump test.o --disassemble=test shows:

00000000 <test>:
   0:   c7 04 25 00 00 00 80    movl   $0x123,0xffffffff80000000
   7:   23 01 00 00 
   b:   c3                      retq 

It stores the value to address 0xffffffff80000000 instead of the expected 0x80000000.

Seems to only happen with optimizations enabled, and only if bit 32 is set in the address.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions