FIAS . Impressum . Privacy

Segmentation fault when using Vc::Memory as a member of a heap-allocated object

Georgios Bitzes [please enable javascript to see the address]
Thu Feb 20 14:42:09 CET 2014


Hi everyone,

I would like to report an issue I came across while using Vc. Here is a
short example that reproduces it:

#include <Vc/Vc>

class A {
    private:
        Vc::Memory<Vc::double_v, 3> internal;
};

int main() {
    std::cout << "size: " << Vc::double_v::Size << std::endl;
    A *a = new A();
    return 0;
}


The example compiles but segfaults during the creation of object a.

$ ./a.out
size: 4
Segmentation fault


Backtrace:

$ gdb ./a.out
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/vcmemory/a.out...done.
(gdb) r
Starting program: /tmp/vcmemory/a.out
size: 4
Program received signal SIGSEGV, Segmentation fault.
0x000000000040142f in _mm256_store_pd (__A=..., __P=0x604010) at
/usr/lib/gcc/x86_64-linux-gnu/4.7/include/avxintrin.h:829
829  *(__m256d *)__P = __A;
(gdb) bt
#0  0x000000000040142f in _mm256_store_pd (__A=..., __P=0x604010) at
/usr/lib/gcc/x86_64-linux-gnu/4.7/include/avxintrin.h:829
#1  store<Vc::v0::Public::{anonymous}::LoadStoreFlags<> > (x=...,
mem=0x604010) at
/opt/Vc-a1d8b9fc31060d870386613cc72319546c850b87/include/Vc/avx/vectorhelper.h:106
#2  store<double, Vc::v0::Public::{anonymous}::LoadStoreFlags<> >
(flags=..., mem=0x604010, this=0x7fffffffe420) at
/opt/Vc-a1d8b9fc31060d870386613cc72319546c850b87/include/Vc/avx/vector.tcc:236
#3  store<Vc::v0::Public::{anonymous}::LoadStoreFlags<> > (flags=...,
mem=0x604010, this=<optimized out>) at
/opt/Vc-a1d8b9fc31060d870386613cc72319546c850b87/include/Vc/avx/vector.h:174
#4  operator=<Vc::v0::AVX::Vector<double> > (x=..., this=0x604010) at
/opt/Vc-a1d8b9fc31060d870386613cc72319546c850b87/include/Vc/common/memorybase.h:85
#5  Vc::v0::Common::Memory<Vc::v0::AVX::Vector<double>, 3ul, 0ul,
true>::Memory (this=0x604010) at
/opt/Vc-a1d8b9fc31060d870386613cc72319546c850b87/include/Vc/common/memory.h:293
#6  0x00000000004011aa in A::A (this=0x604010) at main.cpp:4
#7  0x00000000004010fa in main () at main.cpp:11


The above code was compiled with:

g++ -fabi-version=6 -m64 -std=c++11  -g -fpermissive -ffast-math
 -finline-limit=10000000 -mavx -ftree-vectorize main.cpp
-I/opt/Vc-a1d8b9fc31060d870386613cc72319546c850b87/include
-L/opt/Vc-a1d8b9fc31060d870386613cc72319546c850b87/lib/ -lVc -std=c++11


I took the latest commit of Vc (a1d8b9fc31060d870386613cc72319546c850b87),
compiled and run on a Xeon E3-1280 v3 (Haswell) @ 3.60 GHz by g++
version 4.7.3-2ubuntu4.

On the contrary, if I replace "A *a = new A()" with "A a()" it runs fine.
This appears to happen only when the object is allocated on the heap, not
on the stack.

Is this a bug on the part of Vc or am I doing something wrong?

Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://compeng.uni-frankfurt.de/pipermail/vc/attachments/20140220/7a6d7a40/attachment.html>


More information about the Vc mailing list
FIAS . Impressum . Privacy