[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: [Bug c/103015] New: [i386][solaris] Segmentation fault loading pointer to TLS
From: ibuclaw at gdcproject dot org via Gcc-bugs <gcc-bugs () gcc ! gnu ! org>
Date: 2021-10-31 14:30:32
Message-ID: bug-103015-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103015
Bug ID: 103015
Summary: [i386][solaris] Segmentation fault loading pointer to
TLS
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
Translation of D test gdc.test/runnable/testv.d that segfaults when compiled
with -O2, and linking libraries in dynamically.
---
// Compiled with -m32 -O2
int printf(const char*, ...);
_Thread_local int a1[2] = {5,6};
_Thread_local int a2[3] = {5,6,7};
_Thread_local int a3[4] = {5,6,7,8};
int sum3(int* xx, int length)
{
int s = 0;
for (int i = 0; i < length; i++)
{
int x = xx[i];
s += x;
}
return s;
}
int main()
{
printf("%d\n", sum3(a3, sizeof(a3) / sizeof(a3[0])));
return 0;
}
---
---
Dump of assembler code for function main:
0x08050c60 <+0>: lea 0x4(%esp),%ecx
0x08050c64 <+4>: and $0xfffffff0,%esp
0x08050c67 <+7>: pushl -0x4(%ecx)
0x08050c6a <+10>: push %ebp
0x08050c6b <+11>: mov %esp,%ebp
0x08050c6d <+13>: push %ecx
0x08050c6e <+14>: sub $0xc,%esp
0x08050c71 <+17>: mov %gs:0x0,%eax
0x08050c77 <+23>: lea -0x4(%esp),%esp
=> 0x08050c7b <+27>: movdqa -0x28(%eax),%xmm0
0x08050c83 <+35>: movdqa %xmm0,%xmm1
0x08050c87 <+39>: psrldq $0x8,%xmm1
0x08050c8c <+44>: paddd %xmm1,%xmm0
0x08050c90 <+48>: movdqa %xmm0,%xmm1
0x08050c94 <+52>: psrldq $0x4,%xmm1
0x08050c99 <+57>: paddd %xmm1,%xmm0
0x08050c9d <+61>: movd %xmm0,(%esp)
0x08050ca2 <+66>: push $0x80509f8
0x08050ca7 <+71>: call 0x8050a4c <printf@plt>
0x08050cac <+76>: mov -0x4(%ebp),%ecx
0x08050caf <+79>: add $0x10,%esp
0x08050cb2 <+82>: xor %eax,%eax
0x08050cb4 <+84>: leave
0x08050cb5 <+85>: lea -0x4(%ecx),%esp
0x08050cb8 <+88>: ret
End of assembler dump.
---=
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic