Bug 35080 - __thread generators a.out that creates segmentation fault
Summary: __thread generators a.out that creates segmentation fault
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.6
: P3 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-04 18:26 UTC by Xin Dong
Modified: 2012-01-19 05:51 UTC (History)
2 users (show)

See Also:
Host:
Target: x86-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xin Dong 2008-02-04 18:26:46 UTC
We were using g++ (GCC) 3.4.6 20060404 (Red Hat 3.4.6.9) on Linux 2.6.24.14 SMP X86_64 GNU/Linux 4-core Intel @2.66GHz.

We executed: g++ -O0 test.cc

             ./a.out

./a.out causes segmentation fault.

The file test.cc folows below:

__thread int testarray[2];

int main()
{
  int i = 2;
  testarray[i-1] = 1;
  int p;
  p = testarray[i-1];
  p = p + 1;
  printf("%d\n", p);
  return 0;
}
Comment 1 Vadim Zeitlin 2008-09-06 21:27:49 UTC
I found this bug while searching for __thread-related problems and FWIW I can't reproduce this on a very similar system with g++ 4.1.2 from Debian stable so maybe this can be closed as fixed.
Comment 2 Andrew Pinski 2012-01-19 05:51:53 UTC
Fixed.