gcc segmentation fault

Hi I recently installed FreeBSD , when I compile with gcc my programs that used to work under Linux now not anymore it gives me segmentation fault tips ?
 
It would probably help if you showed some of the code and the information from the segfault.
 
It would probably help if you showed some of the code and the information from the segfault.
But if you compile with clang and ok , with gcc no it gives me segmentation fault
Every program I've written from Linux to FreeBSD does this
 
Show us an example please. We can't see what's on your screen and we cannot see what you're doing.
 
Do you have experience using a debugger (lldb or gdb)? The first thing that I would do is to make a debug build, check if you can still reproduce the problem then either examine a core file or run your app under lldb or gdb.

After that, try using either Valgrind or Address Sanitizer.
 
Underlying question: Why are you trying to use GCC? On FreeBSD, Clang and LLVM are the standard (default) compiler, and they work fine. Instead of trying to debug your GCC installation, it might be easier to just "when in Rome, do like the Romans".

If you have a strong reason to use GCC, it would be interesting to hear about it.
 
Seg faults are mostly caused by pointers that are −
  • Used to being properly initialized.
  • Used after the memory they point to has been reallocated or freed.
  • Used in an indexed array where the index is outside of the array bounds.
 
This Error in gdb
Code:
Program received signal SIGSEGV, Segmentation fault.

Invalid permissions for mapped object.

Oxooooo0080099fd48 in vtable for t.so.1

cxxabiv1: : si_class_type_info () from /lib/Libcoxr
 
Underlying question: Why are you trying to use GCC? On FreeBSD, Clang and LLVM are the standard (default) compiler, and they work fine. Instead of trying to debug your GCC installation, it might be easier to just "when in Rome, do like the Romans".

If you have a strong reason to use GCC, it would be interesting to hear about it.
Im live in rome
 
one known problem is if you have lc++ (clang) and lstdc++ (gcc) pulled in by main and/or other shared objects will bomb
 
"when in Rome, do like the Romans".

Im live in rome
X_X I don't know if this was intentional but I love this double pun here.

If you are not mixing code and or compilers the other reason could be that optimization could have revealed a bug in your code that is not triggered by the other compiler.
Btw. did you actually manually hide the faulty address by placing "o" chars in Oxooooo0080099fd48 ?

More information is needed to help you. The best way would be to show us either
a) how did you compile the code
b) are you able to narrow down the code to a shareable demo?
c) run it through debugger and show us more information about the crash
d) if you are not familiar with debugger at least run truss <your program> and show as the trace

It's hard to judge from very little you showed us. Error occured in vtable so object was attempting to call some method id t.so but that's not enough to say anything. Especially if you say that code works under gcc (and you are not hitting issue covacat mentioned)
 
Back
Top