exception - C++, Segfault when catching error as refernce -


when catch exception reference , try access e.what(), segfault. have idea, why happens?

#include <stdexcept> #include <iostream>  int main(){     try{         throw ::std::runtime_error("test");     }catch(::std::exception const &e){         ::std::cerr << e.what() << "\n";     } } 

i get:

 bash: line 1: 22110 segmentation fault      (core dumped) 'test' < /dev/null > 'test.stdout' 2> 'test.stderr' 

with asan get:

asan:sigsegv ================================================================= ==21318==error: addresssanitizer: segv on unknown address 0x000000000000 (pc 0x2af35c5534bf bp 0x7ffc1b30ee30 sp 0x7ffc1b30ee10 t0)     #0 0x2af35c5534be  (/media/psf/home/test+0xf54be)     #1 0x2af35ebf4ec4  (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)     #2 0x2af35c4a68a6  (/media/psf/home/test+0x488a6)  addresssanitizer can not provide additional info. ==21318==aborting 

i use: ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/release_360/final) (based on llvm 3.6.0)

on: ubuntu 14.04.3 lts,linux ubuntu 3.13.0-76-generic #120-ubuntu smp mon jan 18 15:59:10 utc 2016 x86_64 x86_64 x86_64 gnu/linux

solution: deleting -lc++abi solved problem me.

solution: deleting compiler flag -lc++abi solved problem me.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -