public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/46972] New: __thread storage class variable gets optimized out on ARM
@ 2010-12-15 21:09 paulius.zaleckas at gmail dot com
2010-12-15 21:14 ` [Bug target/46972] " paulius.zaleckas at gmail dot com
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: paulius.zaleckas at gmail dot com @ 2010-12-15 21:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
Summary: __thread storage class variable gets optimized out on
ARM
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: paulius.zaleckas@gmail.com
Created attachment 22775
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22775
test case source code
My host system is x86_64 and I am cross compiling this file(attached) for ARM
with following command: arm-unknown-linux-uclibcgnueabi-gcc -pipe -O1 -Wall
thread_test.c -o thread_test
Executing ./thread_test on my ARM system results in segfault. If I comment out
test_set() function or remove __thread specifier or compile it without
optimizations (-O0) test passes.
I tried this test also on my host system (Fedora 14) and it does not fail
there.
My cross compiler is vanila GCC + patches from:
http://git.buildroot.net/buildroot/tree/toolchain/gcc/4.5.1
It took me about a week to realize what is going on and make this test case out
of not working cross compiled pulseaudio-0.9.22 server :)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
@ 2010-12-15 21:14 ` paulius.zaleckas at gmail dot com
2010-12-16 9:14 ` mikpe at it dot uu.se
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paulius.zaleckas at gmail dot com @ 2010-12-15 21:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
--- Comment #1 from Paulius Zaleckas <paulius.zaleckas at gmail dot com> 2010-12-15 21:14:16 UTC ---
Created attachment 22776
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22776
assembler
This is what I get with gcc's -S -fverbose-asm
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
2010-12-15 21:14 ` [Bug target/46972] " paulius.zaleckas at gmail dot com
@ 2010-12-16 9:14 ` mikpe at it dot uu.se
2010-12-16 20:12 ` paulius.zaleckas at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mikpe at it dot uu.se @ 2010-12-16 9:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2010-12-16 09:14:33 UTC ---
The test case works for me on armv5tel-linux-gnueabi with gcc 4.4, 4.5, and
4.6.
Comparing your assemby code with mine I see that your calls
__emutls_get_address while mine calls __aeabi_read_tp, and the section
allocation for .LANCHOR0 is different (your is in .bss, mine is in .section
.tdata,"awT",%progbits).
So I suspect the issue is dependent on emutls or uclibc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
2010-12-15 21:14 ` [Bug target/46972] " paulius.zaleckas at gmail dot com
2010-12-16 9:14 ` mikpe at it dot uu.se
@ 2010-12-16 20:12 ` paulius.zaleckas at gmail dot com
2010-12-19 16:07 ` paulius.zaleckas at gmail dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paulius.zaleckas at gmail dot com @ 2010-12-16 20:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
--- Comment #3 from Paulius Zaleckas <paulius.zaleckas at gmail dot com> 2010-12-16 20:11:54 UTC ---
(In reply to comment #2)
> So I suspect the issue is dependent on emutls or uclibc.
Yes, you are right. I have experimented today with few toolchains and build few
variants myself and I have discovered that gcc has to be built with
--disable-tls configure option to reproduce this bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
` (2 preceding siblings ...)
2010-12-16 20:12 ` paulius.zaleckas at gmail dot com
@ 2010-12-19 16:07 ` paulius.zaleckas at gmail dot com
2010-12-19 19:39 ` paulius.zaleckas at gmail dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paulius.zaleckas at gmail dot com @ 2010-12-19 16:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
--- Comment #4 from Paulius Zaleckas <paulius.zaleckas at gmail dot com> 2010-12-19 16:07:15 UTC ---
Created attachment 22823
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22823
diff with and without -fsection-anchors
I have found out that it is -fsection-anchors optimization causing this bug.
Attached -S assembler output diff with and without this option.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
` (3 preceding siblings ...)
2010-12-19 16:07 ` paulius.zaleckas at gmail dot com
@ 2010-12-19 19:39 ` paulius.zaleckas at gmail dot com
2010-12-19 21:53 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paulius.zaleckas at gmail dot com @ 2010-12-19 19:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
--- Comment #5 from Paulius Zaleckas <paulius.zaleckas at gmail dot com> 2010-12-19 19:39:07 UTC ---
Did some testing through various GCC versions:
4.5.2 - buggy
4.4.5 - buggy
4.3.5 - OK, but does not have -fsection-anchors optimization for ARM
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
` (4 preceding siblings ...)
2010-12-19 19:39 ` paulius.zaleckas at gmail dot com
@ 2010-12-19 21:53 ` pinskia at gcc dot gnu.org
2010-12-20 11:28 ` paulius.zaleckas at gmail dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-12-19 21:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-12-19 21:53:14 UTC ---
I think enumtls has been fixed on the trunk with respect of fsection-anchors.
Can you try the trunk?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
` (5 preceding siblings ...)
2010-12-19 21:53 ` pinskia at gcc dot gnu.org
@ 2010-12-20 11:28 ` paulius.zaleckas at gmail dot com
2010-12-20 16:51 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paulius.zaleckas at gmail dot com @ 2010-12-20 11:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
--- Comment #7 from Paulius Zaleckas <paulius.zaleckas at gmail dot com> 2010-12-20 11:28:14 UTC ---
(In reply to comment #6)
> I think enumtls has been fixed on the trunk with respect of fsection-anchors.
> Can you try the trunk?
Yes, looks like this bug is fixed in trunk. Assembly output looks sane. I will
see if it works on real hardware some time later today. Do you know svn
revision it got fixed?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
` (6 preceding siblings ...)
2010-12-20 11:28 ` paulius.zaleckas at gmail dot com
@ 2010-12-20 16:51 ` pinskia at gcc dot gnu.org
2010-12-21 13:13 ` iains at gcc dot gnu.org
2011-12-15 1:57 ` pinskia at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-12-20 16:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-12-20 16:51:29 UTC ---
(In reply to comment #7)
> (In reply to comment #6)
> > I think enumtls has been fixed on the trunk with respect of fsection-anchors.
> > Can you try the trunk?
>
> Yes, looks like this bug is fixed in trunk. Assembly output looks sane. I will
> see if it works on real hardware some time later today. Do you know svn
> revision it got fixed?
No but the change was done by Iain Sandoe to fix enum TLS with LTO on darwin.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
` (7 preceding siblings ...)
2010-12-20 16:51 ` pinskia at gcc dot gnu.org
@ 2010-12-21 13:13 ` iains at gcc dot gnu.org
2011-12-15 1:57 ` pinskia at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2010-12-21 13:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |iains at gcc dot gnu.org
--- Comment #9 from Iain Sandoe <iains at gcc dot gnu.org> 2010-12-21 13:12:53 UTC ---
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > I think enumtls has been fixed on the trunk with respect of fsection-anchors.
> > > Can you try the trunk?
> >
> > Yes, looks like this bug is fixed in trunk. Assembly output looks sane. I will
> > see if it works on real hardware some time later today. Do you know svn
> > revision it got fixed?
>
> No but the change was done by Iain Sandoe to fix enum TLS with LTO on darwin.
The fix to emuTLS on trunk is from Richard Henderson's new implementation.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162549
I made some fixes to LTO-compatibility and Section anchors, but they primarily
affect ObjC* and PPC-darwin, so likely not relevant to your case.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/46972] __thread storage class variable gets optimized out on ARM
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
` (8 preceding siblings ...)
2010-12-21 13:13 ` iains at gcc dot gnu.org
@ 2011-12-15 1:57 ` pinskia at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-15 1:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.0
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-15 01:53:39 UTC ---
Fixed in 4.6.0 from reading the comments.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-12-15 1:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-15 21:09 [Bug c/46972] New: __thread storage class variable gets optimized out on ARM paulius.zaleckas at gmail dot com
2010-12-15 21:14 ` [Bug target/46972] " paulius.zaleckas at gmail dot com
2010-12-16 9:14 ` mikpe at it dot uu.se
2010-12-16 20:12 ` paulius.zaleckas at gmail dot com
2010-12-19 16:07 ` paulius.zaleckas at gmail dot com
2010-12-19 19:39 ` paulius.zaleckas at gmail dot com
2010-12-19 21:53 ` pinskia at gcc dot gnu.org
2010-12-20 11:28 ` paulius.zaleckas at gmail dot com
2010-12-20 16:51 ` pinskia at gcc dot gnu.org
2010-12-21 13:13 ` iains at gcc dot gnu.org
2011-12-15 1:57 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).