Weird warning

Marcel Keller M.Keller@bristol.ac.uk
Wed Nov 9 18:41:00 GMT 2016


I've been digging a bit deeper after making sense of the warning. It 
seems that GCC simply misaligns __m256i values. In the attached example, 
the unaligned load/store works fine but the last line fails. The address 
in the output clearly shows that the memory is not aligned (not 
divisible by 32):

0x7ffff7f83010

Program received signal SIGSEGV, Segmentation fault.
0x00000000004008d0 in main () at avx-bug.cpp:17
17	  v[0].a[0] = v[0].a[0];

Best regards,
Marcel


On 09/11/16 16:54, Marcel Keller wrote:
> Hi,
>
> Running avx-bug.cpp compiled with GCC 6.2 and -mavx results in a
> segfault here. The same happens with avx-bug2.cpp, but there I get the
> following warning when compiling:
>
> avx-bug2.cpp: In function ‘int main()’:
> avx-bug2.cpp:6:22: warning: ignoring attributes on template argument
> ‘__m256i {aka __vector(4) long long int}’ [-Wignored-attributes]
>    std::vector<__m256i> v(10000);
>                       ^
>
> I'm a bit confused what I should do about the warning and why it doesn't
> appear in the functionally equivalent code.
>
> Best regards,
> Marcel
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: avx-bug.cpp
Type: text/x-c++src
Size: 422 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20161109/8d23c644/attachment.bin>


More information about the Gcc-help mailing list