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

Passing a class instance to an explicit-ref formal in an overridden method #6642

Closed
e-kayrakli opened this issue Jul 10, 2017 · 4 comments
Closed

Comments

@e-kayrakli
Copy link
Contributor

Summary of Problem

Passing a class instance to an explicit-ref formal in an overridden method causes a type mismatch in the back-end C compiler.

  • This behavior occurs when the argument is a local instance or a field.
  • Only occurs with CHPL_COMM!=none. In other words, with --local it compiles fine.

Steps to Reproduce

Source Code:

class SuperPrinter {
  //for faulty behavior this formal must have an explicit ref intent
  proc print(ref data) {
    writeln("SuperPrinter: ", data.x);
  }
}

class SubPrinter : SuperPrinter {
  proc print(ref data) {
    writeln("Subprinter: ", data.x);
  }
}

class Foo { var x = 10; }

proc main() {
  var printer: SuperPrinter;
  printer = new SubPrinter();

  var data = new Foo();
  printer.print(data);
}

Compile command:
chpl foo.chpl

Configuration Information

  • Output of chpl --version:
chpl Version 1.16.0 pre-release (64add955ac)
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: gnu
CHPL_TARGET_ARCH: unknown
CHPL_LOCALE_MODEL: flat
CHPL_COMM: gasnet *
  CHPL_COMM_SUBSTRATE: udp
  CHPL_GASNET_SEGMENT: everything
CHPL_TASKS: qthreads
CHPL_LAUNCHER: amudprun
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_MAKE: make
CHPL_ATOMICS: intrinsics
  CHPL_NETWORK_ATOMICS: none
CHPL_GMP: none
CHPL_HWLOC: hwloc
CHPL_REGEXP: re2
CHPL_WIDE_POINTERS: struct
CHPL_AUX_FILESYS: none
  • Back-end compiler and version, e.g. gcc --version or clang --version:
gcc (GCC) 7.1.1 20170621
@e-kayrakli
Copy link
Contributor Author

Something encountered by @LouisJenkinsCS in a much more complicated code. Hopefully, this captures the root cause in its entirety.

@benharsh
Copy link
Member

This is almost certainly a bug in the insertWideReferences pass. I will investigate.

@benharsh
Copy link
Member

Well, this was a silly bug. I have a fix ready in #6647 , which includes a new test to keep us honest going forward.

@e-kayrakli
Copy link
Contributor Author

Thanks @benharsh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants