ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Finding errors where indexes goes beyond their boudaries
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Jens Bęk Nielsen



Joined: 07 Jul 2011
Posts: 206
Location: Denmark

PostPost subject: Re: Finding errors where indexes goes beyond their boudaries    Posted: Mon May 07, 2012 3:07 pm Reply to topic Reply with quote

Sven; I have not expressed myself clearly.
Of course the error should be detected at runtime.
The compiler should generate the code to do that with a switch, so it can be turned off in the final compile.
And from what you write it is possible with some compilers.

I do not know about assert(), but it seems to be a possibility?!
But I have +50 arrays in dabbaba to change...

I am only an amateur in C programming - dabbaba is the only program I have written in C.
And all the 12.000 lines of code is in one single file...
My proffession is being a mainframe-programmer, though (cobol, cics, db2, tso...).

Since 2008 I have used the Pelle compiler.
But I think it may produce wrong code, and I have never learnt how to debug with it.
I would also like to try performance profiling.
So I changed to DevCpp a week ago.
And it found the access violation I was not aware of - dabbaba seems to run ok with it...

Could an interpreter detect this?!

DevCpp found the "An access Violation (Segmentation Fault)" here:
void change_to_pili( char *pili, char *sqfr, char *sqto)
{ char *p, p=pili;
loop: if (*p!=*sqfr) {++p; goto loop;}
*p=*sqto; <--------------------------------------------------------------------
}

But the real error is, that pili does not contain the value *sqfr.
I assume it has been overwritten by an index going beyond its boundaries.

It may take some time for the interpreter.
The access violation happens after 500.000 nodes - 5 seconds.

Thanks for your helpful posts!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Subject Author Date/Time
Finding errors where indexes goes beyond their boudaries Jens Bęk Nielsen Sun May 06, 2012 6:34 pm
      Re: Finding errors where indexes goes beyond their boudaries Dan Honeycutt Sun May 06, 2012 6:45 pm
      Re: Finding errors where indexes goes beyond their boudaries Sven Schüle Sun May 06, 2012 9:46 pm
            Re: Finding errors where indexes goes beyond their boudaries Jim Ablett Sun May 06, 2012 11:14 pm
                  Re: Finding errors where indexes goes beyond their boudaries Julien MARCEL Sun May 06, 2012 11:26 pm
      Re: Finding errors where indexes goes beyond their boudaries Jim Bell Mon May 07, 2012 11:16 am
      Re: Finding errors where indexes goes beyond their boudaries Jens Bęk Nielsen Mon May 07, 2012 3:07 pm
            Re: Finding errors where indexes goes beyond their boudaries Sven Schüle Wed May 09, 2012 4:08 pm
                  Re: Finding errors where indexes goes beyond their boudaries Jens Bęk Nielsen Sun May 13, 2012 10:31 am
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
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
Enhanced with Moby Threads