http://llvm.org/bugs/show_bug.cgi?id=15743
Bug ID: 15743
Summary: gep problem when optimizer changes struct padding
Product: libraries
Version: 3.2
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
I'm seeing a problem with the optimizer changing padding inside a
struct, but seemingly not propagating that change to a gep inside an
array.
Here's code to reproduce it. I'm using LLVM/clang 3.2.
----- r.ll
target triple = "x86_64-unknown-linux-gnu"
%A = type { i64, i32, i64 }
@B = constant i16 ptrtoint (i64* getelementptr (%A* null, i32 0, i32 2) to i16)
@C = constant [1 x { i16 }] [{ i16 } { i16 ptrtoint (i64* getelementptr (%A*
null, i32 0, i32 2) to i16) }]
----- r.c
#include <stdint.h>
#include <stdio.h>
extern const int16_t B;
extern const int16_t C[];
int main()
{
printf("%d\n", B);
printf("%d\n", C[0]);
}
-----
Without optimization, the offset of %A's 3rd element is 16:
# clang r.ll r.c -o a.out && ./a.out
16
16
With optimization enabled the offset changes to 12, however only B reflects
that:
# clang r.ll r.c -o a.out -O && ./a.out
12
16
Am I missing something, or is this bug?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs