qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 0/5] migration pull


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL 0/5] migration pull
Date: Tue, 23 Feb 2016 10:43:14 +0000

On 23 February 2016 at 09:48, Paolo Bonzini <address@hidden> wrote:
> On 23/02/2016 10:09, Peter Maydell wrote:
>> Hi. I'm afraid this doesn't compile for x86-64 Linux:
>
> What compiler is this, and does the following compile with no particular
> extra options?
>
> #pragma GCC target("avx2")
> #include <immintrin.h>
> __m256i foo;

This is stock gcc from Ubuntu trusty:
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4

That code fragment you suggest compiles fine normally, but not if I
add -save-temps:

$ cat /tmp/zz9.c
#pragma GCC target("avx2")
#include <immintrin.h>
__m256i foo;
$ gcc -g -Wall -o /tmp/zz9.o -c /tmp/zz9.c
$ echo $?
0
$ gcc -g -Wall -o /tmp/zz9.o -c /tmp/zz9.c -save-temps
/tmp/zz9.c:4:1: error: unknown type name ‘__m256i’
 __m256i foo;
 ^
/tmp/zz9.c: In function ‘bar’:
/tmp/zz9.c:7:19: error: ‘__m256i’ undeclared (first use in this function)
     return sizeof(__m256i);
                   ^
/tmp/zz9.c:7:19: note: each undeclared identifier is reported only
once for each function it appears in
/tmp/zz9.c:8:1: warning: control reaches end of non-void function
[-Wreturn-type]
 }
 ^

This seems to be because -save-temps causes the #pragma not to
actually #define __AVX__.

This feels all pretty fragile to me and I think we should
probably avoid messing with the target pragma if we can.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]