HSAFoundation / gccbrig

HSAIL (BRIG) frontend for gcc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault in a test on gccbrig-gcc-master branch

marxin opened this issue · comments

Building http://pastebin.com/99Cb9C9H:
$ gcc -fopenmp switch-3.c -O2
$ ./a.out

produces following segfault (valgrind error):

==11791== For counts of detected and suppressed errors, rerun with: -v
==11791== ERROR SUMMARY: 9 errors from 9 contexts (suppressed: 0 from 0)
==11788== Thread 2:
==11788== Invalid read of size 1
==11788==    at 0x9C9CE64: _main__omp_fn_0 (in /tmp/phsa-finalizer-rV0Pks/8959f5e78937.so)
==11788==    by 0xD0BF953: phsa_execute_work_groups (workitems.c:486)
==11788==    by 0xD0BFA45: __phsa_launch_wg_function (workitems.c:565)
==11788==    by 0x9C9CF20: main__omp_fn_0 (in /tmp/phsa-finalizer-rV0Pks/8959f5e78937.so)
==11788==    by 0x4EF870C: CpuAgent::DoWork() (cpu_agent.cpp:155)
==11788==    by 0x4EF8241: CpuKernelExecutorThread(CpuAgent*) (cpu_agent.cpp:68)
==11788==    by 0x4F01A80: void boost::_bi::list1<boost::_bi::value<CpuAgent*> >::operator()<void (*)(CpuAgent*), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(CpuAgent*), boost::_bi::list0&, int) (bind.hpp:259)
==11788==    by 0x4F01716: boost::_bi::bind_t<void, void (*)(CpuAgent*), boost::_bi::list1<boost::_bi::value<CpuAgent*> > >::operator()() (bind.hpp:1222)
==11788==    by 0x4F0133F: boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(CpuAgent*), boost::_bi::list1<boost::_bi::value<CpuAgent*> > > >::run() (thread.hpp:116)
==11788==    by 0x6751724: ??? (in /usr/lib64/libboost_thread.so.1.60.0)
==11788==    by 0x55AE4A3: start_thread (in /lib64/libpthread-2.22.so)
==11788==    by 0x58ADDEC: clone (in /lib64/libc-2.22.so)
==11788==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==11788== 
==11788== 
==11788== Process terminating with default action of signal 11 (SIGSEGV)
==11788==  Access not within mapped region at address 0x0
==11788==    at 0x9C9CE64: _main__omp_fn_0 (in /tmp/phsa-finalizer-rV0Pks/8959f5e78937.so)
==11788==    by 0xD0BF953: phsa_execute_work_groups (workitems.c:486)
==11788==    by 0xD0BFA45: __phsa_launch_wg_function (workitems.c:565)
==11788==    by 0x9C9CF20: main__omp_fn_0 (in /tmp/phsa-finalizer-rV0Pks/8959f5e78937.so)
==11788==    by 0x4EF870C: CpuAgent::DoWork() (cpu_agent.cpp:155)
==11788==    by 0x4EF8241: CpuKernelExecutorThread(CpuAgent*) (cpu_agent.cpp:68)
==11788==    by 0x4F01A80: void boost::_bi::list1<boost::_bi::value<CpuAgent*> >::operator()<void (*)(CpuAgent*), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(CpuAgent*), boost::_bi::list0&, int) (bind.hpp:259)
==11788==    by 0x4F01716: boost::_bi::bind_t<void, void (*)(CpuAgent*), boost::_bi::list1<boost::_bi::value<CpuAgent*> > >::operator()() (bind.hpp:1222)
==11788==    by 0x4F0133F: boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(CpuAgent*), boost::_bi::list1<boost::_bi::value<CpuAgent*> > > >::run() (thread.hpp:116)
==11788==    by 0x6751724: ??? (in /usr/lib64/libboost_thread.so.1.60.0)
==11788==    by 0x55AE4A3: start_thread (in /lib64/libpthread-2.22.so)
==11788==    by 0x58ADDEC: clone (in /lib64/libc-2.22.so)
==11788==  If you believe this happened as a result of a stack
==11788==  overflow in your program's main thread (unlikely but
==11788==  possible), you can try to increase the size of the
==11788==  main thread stack using the --main-stacksize= flag.
==11788==  The main thread stack size used in this run was 8388608.

Fixed in phsa-runtime and phsa-finalizer.