Quote:
Originally Posted by RohitB
Its not related to malloc or calloc.It seems compiler optmization creating problem when structure variable declartion were put in compoler flag
|
All compilers do have a switch to disable optimization.
For GCC it is -O0 (DASH, Capital letter Oh, followed by zero)
When you say:
Quote:
Originally Posted by RohitB
I remove all malloc calloc in that code even pointer also.But when i put compiler option it is rashing and in other case it is not.
Strucutre declariion is present in header file and that header file included in muliple source files.
Source files also have macro to use those strcutre variable.
|
This doesn't make full sense to me. Please post representative code as well as which compiler option you are referring too. We can't help you if you don't post any code and if you refer to a "compiler option" and then do not reveal what option you've used. Next you go on to mention a structure and a macro. We are all familiar with C coding and the uses of structures, macros, C compiler options, and many of these other topics. However none of what you've said here is anything specific enough to help you identify your coding problem.
If your program crashes, you can enable core file dumping, you can compile your program with the -ggdb flag, you can disable the optimizer, and you can then debug the core file using GDB.
What I'm seeing here are varying descriptions, but no real evidence of anything. Sorry but for myself, I cannot help you much further if you are unwilling to offer the requested feedback. Hope you are able to resolve your issue, but to be clear, for myself to help you further, I would suggest that you post your entire code in [code][/code] tags and indicate what compiler you are using as well as the compile line which you are using. Another option would be to not post your exact code, but instead representative code which exhibits the same problem. A final option would be for you to trim back your code to remove all the items which are non-necessary, or all items which clearly work and look at this fundamental problem where you are seeing this crash. Once again, best of luck, but looking forward to some more beneficial feedback where we can be able to help you better.