View unanswered posts | View active topics It is currently Tue Sep 02, 2014 5:07 am






Reply to topic  [ 5 posts ] 
Goto?? 
Author Message
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Goto??
here is a doozy (example, obviously not real code)

Code:
task main()
{
   int x;
   if (9 == 8)
      goto x1;
   x = 9;
x1:
   x = 10;
}


crashes IDE on compile in 3.52_4

_________________
Mike aka Spiked3
http://www.spiked3.com


Mon Oct 15, 2012 2:36 am
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Goto??
:shock:

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Mon Oct 15, 2012 8:15 am
Profile WWW
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: Goto??
NeXT-Generation wrote:
:shock:


When some people are told they can not have function pointers, they look for ways to have function pointers :|
I got at least 3 ways up my sleeve to investigate to provide some flavors of OOP.

BTW, excellent discussion of it; http://stackoverflow.com/questions/3517 ... -code-in-c

Remember, what is trying to be accomplished may not be as elegant, or perform as nicely, but it is the end result that is important.

_________________
Mike aka Spiked3
http://www.spiked3.com


Mon Oct 15, 2012 10:52 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post Re: Goto??
Quote:
here is a doozy (example, obviously not real code)

This is fixed for next release.

The problem was that the compiler was smart enough to never generate an unconditional branch instructionfor the "goto" instruction because the "if" was always false.

It just wasn't smart enough in the following "fixup addresses" phase where it tried to adjust the location of the unconditional branch to the actual adrress of the label. The crash was because it referenced a NULL pointer in the fixup.


Mon Oct 15, 2012 3:40 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 602
Post Re: Goto??
Fixed in 3.54.

Thanks!

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Thu Nov 15, 2012 4:57 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.