LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-26-2019, 07:23 AM   #16
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930

Quote:
Originally Posted by RohitB View Post
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 View Post
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.

Last edited by rtmistler; 02-26-2019 at 07:24 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation using variable inside variable unclesamcrazy Linux - Newbie 7 04-21-2015 09:24 AM
structure inside a structure in C batman4 Programming 3 09-13-2012 05:52 AM
[bash] re-evaluate variable inside variable muzzol Programming 9 12-01-2010 11:31 AM
can we use variable inside another variable amemyum Linux - Newbie 13 11-16-2009 03:44 PM
Retrieving from a variable whose name is inside a variable. thekillerbean Linux - General 4 02-09-2006 08:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration