Segmentation fault at a perfect running code
-
I have completed a very important project. I did in VC++ and uploaded to Linux server. After then, I have re-compiled my work (without errors) and run it. It wrotes Segmentation fault, but when i checked output file it is actually the one that i have intended to have. Code uses dynamic memory allocation, file read and write, and 9 nestled for loops. Moreover I have uploaded two more projects and they were working without giving the segmentation fault. Another interesting subject about the code is that it writes values to the file at the end. If you have experienced something like this please send your comments. Deadline for the project is by tommorrow night (15th April). However comments after that time will still be useful. May the bug killer be with you... Cem Kalyoncu
-
I have completed a very important project. I did in VC++ and uploaded to Linux server. After then, I have re-compiled my work (without errors) and run it. It wrotes Segmentation fault, but when i checked output file it is actually the one that i have intended to have. Code uses dynamic memory allocation, file read and write, and 9 nestled for loops. Moreover I have uploaded two more projects and they were working without giving the segmentation fault. Another interesting subject about the code is that it writes values to the file at the end. If you have experienced something like this please send your comments. Deadline for the project is by tommorrow night (15th April). However comments after that time will still be useful. May the bug killer be with you... Cem Kalyoncu
Sorry, but 99.999999% of the time, the problem is with your code, not with the compiler. And without seeing the code, we can't have a clue about why it's failing... I see dumb people
-
I have completed a very important project. I did in VC++ and uploaded to Linux server. After then, I have re-compiled my work (without errors) and run it. It wrotes Segmentation fault, but when i checked output file it is actually the one that i have intended to have. Code uses dynamic memory allocation, file read and write, and 9 nestled for loops. Moreover I have uploaded two more projects and they were working without giving the segmentation fault. Another interesting subject about the code is that it writes values to the file at the end. If you have experienced something like this please send your comments. Deadline for the project is by tommorrow night (15th April). However comments after that time will still be useful. May the bug killer be with you... Cem Kalyoncu
... are you trying to run a Win32 executable on a linux OS ? ...
Maximilien Lincourt Your Head A Splode - Strong Bad
-
... are you trying to run a Win32 executable on a linux OS ? ...
Maximilien Lincourt Your Head A Splode - Strong Bad
no.. I have recompiled it using g++. May the bug killer be with you... Cem Kalyoncu
-
no.. I have recompiled it using g++. May the bug killer be with you... Cem Kalyoncu
ok ... so ... probable errors, bad initializations of variable, bad allocation, bad error checking ... be sure to initialize everything, check all pointers, ... and build in debug and trace on linux ...
Maximilien Lincourt Your Head A Splode - Strong Bad
-
I have completed a very important project. I did in VC++ and uploaded to Linux server. After then, I have re-compiled my work (without errors) and run it. It wrotes Segmentation fault, but when i checked output file it is actually the one that i have intended to have. Code uses dynamic memory allocation, file read and write, and 9 nestled for loops. Moreover I have uploaded two more projects and they were working without giving the segmentation fault. Another interesting subject about the code is that it writes values to the file at the end. If you have experienced something like this please send your comments. Deadline for the project is by tommorrow night (15th April). However comments after that time will still be useful. May the bug killer be with you... Cem Kalyoncu
Unix 'segmentation fault' is much the same as Windows' 'access violation'. It's caused by trying to read or write through a bad pointer, or by trying to jump to a bad location. Usually this means that you're trying to read or write off the end of a buffer, or you're not checking the return value of one or more functions for errors before using that value (where the function returns a pointer, e.g.
fopen
). It can also be an uninitialised pointer. Jumping to a bad location is much harder and usually requires an uninitialised function pointer. Stability. What an interesting concept. -- Chris Maunder -
Unix 'segmentation fault' is much the same as Windows' 'access violation'. It's caused by trying to read or write through a bad pointer, or by trying to jump to a bad location. Usually this means that you're trying to read or write off the end of a buffer, or you're not checking the return value of one or more functions for errors before using that value (where the function returns a pointer, e.g.
fopen
). It can also be an uninitialised pointer. Jumping to a bad location is much harder and usually requires an uninitialised function pointer. Stability. What an interesting concept. -- Chris MaunderThanks for all, The answer is actually trying to access out of bounds of a variable - it should give access violation but in Windows it allocates a litle more space then you have requested (duplicates of four i guess). the proplem is with the read routine that seems nearly perfect, I found the error when I tried to free the variable. It actually gave me error at that time (before I forgot to free them:) ). It is very interesting not to get an error on Windows. As Mike said it is actually Access Violation. Thanks for all May the bug killer be with you... Cem Kalyoncu