pallas icon indicating copy to clipboard operation
pallas copied to clipboard

plank has a bunch of compilation errors?

Open jaredly opened this issue 1 year ago • 0 comments

Maybe my version of gcc is wrong, but here's what I get:

$ make
gcc plan.c -o plan
plan.c:128:1: warning: non-void function does not return a value [-Wreturn-type]
}
^
plan.c:195:3: error: expected expression
  char c = *str;
  ^
plan.c:196:8: error: use of undeclared identifier 'c'
  if (!c) return true;
       ^
plan.c:197:14: error: use of undeclared identifier 'c'
  if (!issym(c)) return false;
             ^
plan.c:205:7: error: expected expression
      char tmp[9] = {0};
      ^
plan.c:206:14: error: use of undeclared identifier 'tmp'
      ((u64*)tmp)[0] = n.direct;
             ^
plan.c:207:21: error: use of undeclared identifier 'tmp'
      if (is_symbol(tmp)) {
                    ^
plan.c:209:35: error: use of undeclared identifier 'tmp'
        strcpy(buf + strlen(buf), tmp);
                                  ^
plan.c:355:7: error: expected expression
      int i = 0;
      ^
plan.c:359:14: error: use of undeclared identifier 'i'
      while (i < n.size) {
             ^
plan.c:360:19: error: use of undeclared identifier 'i'
        if (n.buf[i] == UINT64_MAX) {
                  ^
plan.c:361:19: error: use of undeclared identifier 'i'
          new_buf[i] = 0;
                  ^
plan.c:362:11: error: use of undeclared identifier 'i'
          i++;
          ^
plan.c:365:19: error: use of undeclared identifier 'i'
          new_buf[i] = n.buf[i] + 1;
                  ^
plan.c:365:30: error: use of undeclared identifier 'i'
          new_buf[i] = n.buf[i] + 1;
                             ^
plan.c:366:11: error: use of undeclared identifier 'i'
          i++;
          ^
plan.c:370:11: error: use of undeclared identifier 'i'
      if (i == n.size) {
          ^
plan.c:373:17: error: use of undeclared identifier 'i'
        new_buf[i] = 1;
                ^
plan.c:387:7: error: expected expression
      int i = 0;
      ^
plan.c:391:14: error: use of undeclared identifier 'i'
      while (i < n.size) {
             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [plan] Error 1
$ gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

When I fix those errors (mostly adding {} around switch cases), it runs, but then fails with an Address boundary error if you try to do anything other than a plain nat.

jaredly avatar Oct 07 '24 18:10 jaredly