Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashed driver while testing label and goto. #92

Open
knubo opened this issue Sep 15, 2024 · 3 comments
Open

Crashed driver while testing label and goto. #92

knubo opened this issue Sep 15, 2024 · 3 comments
Labels
cannot reproduce Issue cannot be confirmed yet.

Comments

@knubo
Copy link

knubo commented Sep 15, 2024

I wrote (more or less this) in a function:

void crash() {

oups:

/* Some code */

goto oups;
}

The driver crashed while trying to compile this. I was looking into do a break to label from a double nested for loop, but I could not forward reference my label so I just for compile time tested to put it before the goto statement.

This was on DGD 1.7.3

@dworkin
Copy link
Owner

dworkin commented Sep 15, 2024

I can't reproduce a crash with this code.

By the way, I don't consider goto to oficially be part of LPC -- I added it to as a kind of underground feature to simplify machine-producing LPC code. As such, it does have some similarly-undocumented limitations.

@knubo
Copy link
Author

knubo commented Sep 15, 2024

I think this is close to the code I tried to compile:

object query_tree_near(object player) {
  int *loc;
  object tree;
  int col,row;
  int x,y, found;
  
  loc = locations[player];

 jumphere:
  
  for(col=-1;col < 1 && !found; col++) {
    for(row=-1; row < 1 && !found; row++) {

      x = loc[0] + col;
      y = loc[1] + row;
      
      if(content[y*(content_size_x+1)+x] == '*') {
	found = 1;
	
	goto jumphere;
	break;
      }
    }
  }

 jumphere:
  if(!found) {
    return 0;
  }
  
  tree = clone_object("/d/Limitless/obj/tmp_tree");
  tree->set_chop_location(copy(locations[player]));
  
  
  return tree;
}

I probably tried to add and remove the labels and compile it a couple of times.

@dworkin
Copy link
Owner

dworkin commented Sep 15, 2024

Alas, that still doesn't crash.

@dworkin dworkin added the cannot reproduce Issue cannot be confirmed yet. label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot reproduce Issue cannot be confirmed yet.
Projects
None yet
Development

No branches or pull requests

2 participants