Skip to content

Locations for accesses in guards cover entire statement #689

@vesalvojdani

Description

@vesalvojdani

When accesses occur in loop guards, the access location covers the entire body of the statement. It makes it very unreadable inside GobPie for real-world examples like this:

#include <pthread.h>
#include <stdio.h>

int myglobal;

void *t_fun(void *arg) {
  if (myglobal > 0) {
    printf("Stupid!");
    printf("Stupid!");
    printf("Stupid!");
    printf("Stupid!");
    printf("Stupid!");
    printf("Stupid!");
  }
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);
  myglobal=myglobal+1;
  pthread_join (id, NULL);
  return 0;
}

I tried a fix in 076660b, but it's not clear if that causes issues with our use of locations for other things. Are there cases when we'd want the location to cover the entire statement?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions