On Thu, Jan 14, 2016 at 5:39 AM, Richard W.M. Jones <rjo...@redhat.com> wrote:
> On Wed, Jan 13, 2016 at 10:00:08PM -0700, Dave Johansen wrote: > > I was working on packaging rr [1] and one of the tests [2] fails to build > > when optimizations are turned on. I've reduced it to the following and > > still been able to reproduce the issue: > > > > static const float xmm0 = 10; > > > > int main() { > > __asm__ __volatile__( > > #if __i386__ > > "movss xmm0, %xmm0\n\t" > > #elif __x86_64__ > > "movss xmm0(%rip), %xmm0\n\t" > > #else > > #error unexpected architecture > > #endif > > ); > > > > return 0; > > } > > > > Here's the output on F23 x86_64: > > $ gcc fxregs.c -O0 > > $ gcc fxregs.c -O1 > > /tmp/cccdze3O.o: In function `main': > > fxregs.c:(.text+0x4): undefined reference to `xmm0' > > collect2: error: ld returned 1 exit status > > > > Is this a gcc bug or is there something that I need to do in the build to > > get the tests to build without error? > > I think it's a bug in your test. GCC is just optimizing away the xmm0 > variable because it cannot see "inside" the asm to know that it is > being used. > Yes, it appears that you're right. Removing the static fixes the compilation issue when optimizations are enabled. I'll submit a patch upstream. Thanks, Dave
-- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org