https://llvm.org/bugs/show_bug.cgi?id=25931
Bug ID: 25931
Summary: WebAssembly miscompiles global structs with multiple
data members
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
(filing under lib/CodeGen, since we don't have a component for WebAssembly at
the moment)
The following GCC torture test:
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.c-torture/execute/20010924-1.c
Has the following code:
struct {
char a1c;
char *a1p;
} a1 = {
'4',
"62"
};
struct {
char a2c;
char a2p[2];
} a2 = {
'v',
"cq"
};
/* The tests. */
struct {
char a3c;
char a3p[];
} a3 = {
'o',
"wx"
};
struct {
char a4c;
char a4p[];
} a4 = {
'9',
{ 'e', 'b' }
};
Which WebAssembly's backend miscompiles as:
.str:
.asciz "62"
.size .str, 3
.type a1,@object # @a1
.globl a1
.align 2
a1:
.int8 52 # 0x34
.zero 3
.int32 .str
.size a1, 8
.type a2,@object # @a2
.globl a2
a2:
.int8 118 # 0x76
.ascii "cq"
.size a2, 3
.type a3,@object # @a3
.globl a3
a3:
.int8 111 # 0x6f
.asciz "wx"
.size a3, 4
.type a4,@object # @a4
.globl a4
a4:
.int8 57 # 0x39
.ascii "eb"
.size a4, 3
Note the missing initialization (but surprisingly, correct size!).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs