CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PCML crashes when stdlib.h is included

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ghamblin



Joined: 02 Aug 2015
Posts: 38
Location: Tucson

View user's profile Send private message

PCML crashes when stdlib.h is included
PostPosted: Sun Sep 20, 2015 5:20 pm     Reply with quote

Ok, I brought this up a while back when I was working on code for a customer of mine. I never did receive any reply from CCS support, and after exhausting every suggestion I received on the forum, I got nowhere. So I went to my customers location and used the older version of compiler that he had, and it compiled just fine.

Now I have run into the same issue with one of my own programs. Of course it compiled just fine in February 2014, and I went to make a very small change, I first just tried to compile it without making a change and it crashed. Same error as the previous program:

Runtime error 231 at 08058941
Segmentation fault (core dumped)

This time however, When I started commenting lines to try to locate the problem area, I started way up top, and isolated it at the "#include <stdlib.h> . If I comment out that line the compiler doesn't crash, but obviously there are errors because it can't resolve the functions that are in stdlib.h. But heck it's something. Maybe I should try to find another version of that include?

Any suggestions are welcome.
_________________
-Glenn
ghamblin



Joined: 02 Aug 2015
Posts: 38
Location: Tucson

View user's profile Send private message

PostPosted: Sun Sep 20, 2015 5:57 pm     Reply with quote

I forgot to add versions:

PCM 5.028
Ubuntu 12.04
_________________
-Glenn
ghamblin



Joined: 02 Aug 2015
Posts: 38
Location: Tucson

View user's profile Send private message

PostPosted: Sun Sep 20, 2015 6:13 pm     Reply with quote

Just FYI I removed all references to functions existing in stdlib.h and removed the include statement. Compiles just fine.
_________________
-Glenn
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 20, 2015 7:56 pm     Reply with quote

So, shouldn't you be able to track down the function in stdlib.h that is
causing the problem ?
ghamblin



Joined: 02 Aug 2015
Posts: 38
Location: Tucson

View user's profile Send private message

PostPosted: Sun Sep 20, 2015 8:40 pm     Reply with quote

Yes, I think it's itoa() . I haven't concluded that yet though. I replaced it with sprintf()s and it worked, so I made my changes and shipped it. I'm hoping CCS will have fixed whatever it is by the time they update the PCM for Linux.

I've been doing this long enough where I should know by now to keep older versions of the compiler. But, this is the fist issue I've had in a long time. I'm going to have to go back to my old ways and store a copy of the compiler with my product code. It's just a pain.

Thanks PCM Programmer.
_________________
-Glenn
Ttelmah



Joined: 11 Mar 2010
Posts: 19477

View user's profile Send private message

PostPosted: Mon Sep 21, 2015 8:14 am     Reply with quote

What size/type integer?.
The actual code listings are in each library, so the next move would be to narrow it down.
You were having an almost identical fault a few weeks ago if I remember correctly?.
I remember this coming up a while ago for another user, and it was a combination of compiler version and Linux version that actually caused it...
There was also another thread where using 'unsigned' caused a problem:

<http://www.ccsinfo.com/forum/viewtopic.php?t=34024&highlight=segmentation+fault>

which is interesting, since itoa, treats the signed source as unsigned internally, after removing the sign bit.
ghamblin



Joined: 02 Aug 2015
Posts: 38
Location: Tucson

View user's profile Send private message

PostPosted: Mon Sep 21, 2015 9:16 am     Reply with quote

Integer size is 16bit. I don't see an explicit 16 bit itoa() function. I see 32,48,and 64. The odd part to me is the fact that it throws a segmentation fault and just crashes.

Yes, it is a very similar issue that I was having. But I couldn't seem to narrow that code down. Also I didn't write it so it wasn't very easy to see what was going on. If I get time I may go back and see if i can make it work by making the same kind of changes. I did send the code and an explanation of the issue to support, but never heard anything.

I have so much going on right now, I don't really have time to track it down, but interestingly I have an almost identical version of the code that only moves a decimal place one place to the right, and it compiles with no issues. Even with the same itoa statements.

I may just need to go back to the last Version 4 compiler for now.
_________________
-Glenn
ghamblin



Joined: 02 Aug 2015
Posts: 38
Location: Tucson

View user's profile Send private message

Solved!
PostPosted: Sat Oct 31, 2015 7:33 pm     Reply with quote

Just to close out this discussion, the new version of PCM Linux resolves the issue in both of the projects I was having trouble with.

Thank all of you for your help! It is appreciated.

-Glenn
_________________
-Glenn
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group