From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2912 invoked by alias); 15 Dec 2010 21:09:44 -0000 Received: (qmail 2784 invoked by uid 22791); 15 Dec 2010 21:09:43 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Dec 2010 21:09:39 +0000 From: "paulius.zaleckas at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/46972] New: __thread storage class variable gets optimized out on ARM X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: paulius.zaleckas at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 15 Dec 2010 21:09:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-12/txt/msg01816.txt.bz2 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 :)