[1.29.0] Cannot deref() a c_ptrTo(unmanaged class instance): comm-none: Assertion `node==0` failed

Currently in the GPU locale model we force "wide pointers" to be used for everything outside of a local block. You can think of wide pointers as being Chapel's representation of a pointer that might point to data on another locale (node). As an immediate workaround I'm able to get your program to compile and work by embedding everything inside of a local block (I'll paste the code below).

I'm not sure what the expected behavior of c_ptr is in regards to wide pointers is, certainly it shouldn't crash so there's definitely a bug on our end here. It's less clear to me if this is something strictly related to the GPU programming model or if it's something that could be reproduced outside of it so I'll have to do more digging there.

Anyway I'm not sure if this is an acceptable workaround for your use case but I was able to get this to work:

use CTypes;

class foo {
  var bar : int(64);
};

proc main() {
  local {
    var myFoo = new unmanaged foo();
    myFoo.bar = 8675309;
    writeln("myFoo: ", myFoo);
    var myPtr = c_ptrTo(myFoo);
    writeln("myPtr: ", myPtr);
    //Assertion fails on this deref:
    var myDeref = myPtr.deref();
    writeln("myDeref: ", myDeref);
    delete myFoo;
  }
}