============================
Chapel Implementation Status
============================

This file contains a list of unimplemented features and known bugs in
the Chapel implementation.  If you find additional bugs and
unimplemented features, or if you would like to request prioritization
of items in this file, please let us know at
chapel-bugs@lists.sourceforge.net or chapel_info@cray.com.  Please
feel encouraged to err on the side of mailing us with any issues you
run into.


General (see also portability section at the bottom of this file)
-----------------------------------------------------------------

- Some error messages are confusing or unhelpful.  If needed, please
  ask us for help with interpreting the message.
- Compiler and runtime and errors may report incorrect line numbers,
  may not be formatted correctly, or may be garbled.  If needed,
  please ask us for help finding the line in question.
- Names in a Chapel program can collide with names used internally.
- Names in a Chapel program can collide with name used by the back-end
  compiler and libraries.
- There are several internal memory leaks:
  - All strings are leaked
  - Privatized domains and arrays (i.e., those that use the standard
    distributions) are leaked
  - Non-default domain maps may be leaked
  - Data associated with iterators may be leaked
  - Data accessed in 'on' and/or 'begin' statements may be leaked
  - Sync and single variable record members may be leaked
- Separate compilation of Chapel files is not supported.
- Back-end compilers may emit warning messages.
- The --gdb flag is only supported for single-locale platforms that
  support gdb.  Please ask us for help if you want to debug a
  multilocale program.


Types, Params, Variables, and Consts
------------------------------------
- Enum types always represented using the smallest integer type
  available, even if the enum values require a larger integer.
- Invoking a method directly on an enum constant results in a compiler error
- Methods on atomic type ignore the memory_order argument.
- The default value for the locale type is incorrect.
- Types declared within a param conditional block may result in an
  internal compiler error.
- Type inferred for a variable initialized to 'nil' is not 'object'
- Multiple configuration parameters with different types declared in a
  single statement result in an internal error.
- When setting a config variable that shares an initializer on the
  command line, the new value is incorrectly propagated to the other
  variables.
- Variables that rely on each other for initialization
  and/or type inference may result in an internal compiler error.
- Constant checking is incomplete.


Conversions
-----------
- Implicit conversions of enums to uint not supported.
- Casts and relational operations involving enum constants may fail to
  compile or produce incorrect answers.
- Casts from uint param to strings treat the string as int.
- Casts to non-type variables do not result in an error at compile time.


Statements and Expressions
--------------------------
- Continue statements in forall and coforall statements not implemented.
- Unlabeled break and continue statements fail to compile in param for
  loops.
- On statement variable declarations are not yet supported.
  E.g., on Locales(1) var x: real;
- The local statement is not well supported.  For example, declaring
  domains (whether explicitly via a declaration or implicitly via
  slicing results in a runtime seg fault or non-local access error).
  Also, on statements in local blocks should be illegal, but result in
  local execution.
- Query expressions for primitive type bit-sizes results in an
  internal compiler error.


Modules
-------
- Modules that rely on each other for initialization and/or type
  inference may result in an internal compiler error.
- Constructor calls with the same name in different modules are not
  properly resolved.


Functions and Iterators
-----------------------
- Invalid where clauses may result in an internal compiler error.
- Querying the type of a function is not supported and currently
  returns an internal type.
- Default values for formal arguments do not accept conditional
  expressions.
- Specified argument types that are not types should return a Chapel
  compile time error, but instead they may result in an internal
  compiler error or compile and run.
- Array-of-array formal argument declarations do not work.
- Function argument with type tuple of generic class results in a
  compiler assertion.
- Sync and single vars incorrectly passed to generic ref intent arguments.
- Sync and single variables in records are not properly copied out
  when the record is passed as an out or inout argument.
- Generic formals whose actuals are of sync type are instantiated as
  the base type.
- Parentheses-less function without curly braces enclosing the body
  fail to parse correctly.
- Recursive functions that return arrays are not yet supported
- Recursive functions with default argument values may not work.
- Type and parameter functions are not checked for side effects.
- Param functions can return runtime variables.
- Param functions with explicit return types return the default value
  for the type.
- Var functions returning multiple class types should be illegal, but
  instead they are compiled and result in runtime error.
- Var functions that return local data may not result in an error.
- Type functions with unambiguous return paths may result in "illegal
  cast" errors.
- Support for closures and first-class functions is not complete.
- Recursive iterators may not work correctly.
- Iterators in records cannot change fields in that record.
- The implicit 'setter' argument does not work in var iterators.
- Iterators yielding locale types result in an internal error.
- A forall loop with an iteratable expression that does not provide
  leader/follower iterators cause an internal error.


Strings
-------
- Fixed length strings are not implemented.
- String assignment across locales is by reference rather than value.
- Extern functions that use strings may not function properly for
  multilocale execution.


Tuples
------
- Specifying the type of a tuple of domains or arrays results in a
  runtime error (nil dereference).  It may be possible to work around
  this by implicitly specifying the type by using an assignment at the
  declaration.
- Invalid use of tuple expansion as an expression results in the
  expression evaluating to the first element of the tuple.
- Tuple expanded list enclosed in parenthesis does not result in a
  tuple.
- Cannot iterate over heterogeneous tuples
- Cannot iterate over a tuple of iteratable expressions (e.g.,
  iterators).
- Param loops over a tuple of tuples results in an internal compiler error.


Ranges
------
- Range operations can result in overflow.
    e.g., (0:uint..5 by -1).length
- Ranges that span the entire representable range of the index type
  do not work.
- Ranges that are sliced with another range with a different index
  type do not work.
- Range alignment is not always displayed when printing a range using
  writeln().
- The indexOrder() method on ranges does not work if the unbounded on
  the 'low' end.
- Param ranges are not supported.
- Range internals (bounds, stride, and alignment) are not checked for
  overflow when being manipulated.


Classes, Records, and Unions
----------------------------
- Generic domain types in field declarations result in a compile time
  error.
- Record and class members that are defined to be array aliases fail
  to compile without an explicitly specified element type.
- Parentheses-less methods of classes/records may result in failed
  compilation if they are not declared within the class/record
  definition.
- Multiple inheritance as defined in the spec (single base class with
  fields) is not implemented.
- Declaring members and functions using inherited param or type
  variable may not work.
- Generic methods called with params actuals may result in "unresolved
  call" error at compile time or incorrect generated code.
- Function resolution may be overly conservative for methods of subclasses.
- User-defined constructors and destructors are not robust.
- User-defined constructors do not override the default constructor.
- User-defined copy constructors are not supported.
- Declaring class members using type aliases may result in unresolved
  type errors.
- Cannot call 'new' on type aliases for classes and records
- Iterator methods may not obey dynamic dispatch.
- Ambiguous definitions of class methods that are overridden in a
  subclass result in an internal compiler error.
- Classes nested in procedures may result in a compile time error.
- Non-sync arguments to default constructors that expect sync vars are
  not properly coerced to sync type.
- Subclassing uninstantiated generic classes should be prohibited but is not.
- Implicit casting of record parameters not implemented.
- Array alias arguments to constructors fail to compile.
- Atomics are not passed to constructors by ref by default
- Using a comparison operator with a record and 'nil' results in an
  internal compiler error.
- Records inheritance does not properly expose parent methods.
- Nested record inheritance results in a compilation error.
- A record declared in a class results in a failure to resolve the
  record's copy constructor.
- Unused records defined in procedures result in an internal compiler error.
- Recursive records result in function resolution error or internal
  compiler error.
- Records passed by ref intent to dynamically dispatched methods do
  not work.
- Printing of a string field in a record in a class does not work.
- Specifying the type when declaring a record variable with const
  fields results in a compile time errors regarding assigning to const
  fields.
- Default arrays of records with const fields result in compile time
  errors regarding assigning to const fields.
- Associative domains and arrays of records with const fields result
  in compile time errors regarding assigning to const fields.
- Comparison (== or !=) of records with array or domain fields result
  in a back-end C compiler error.
- Type select on unions is not implemented.


Domain Maps, Domains and Arrays
-------------------------------
- Reference counting (used for memory management of domain maps,
  domains, and arrays) may contain bugs.
- Distributed domain maps are currently only supported for dense,
  rectangular domains.
- PrivateDist must be used at the top-level scope.
- Subset checks on subdomains is not implemented.
- Bounds checks on index types is not implemented.
- Overloading operations such as multiplication for domain literals not
  supported.
- Query expressions on domains and subdomains not supported.
- Iterating over the inner array of arrays where the outer array is
  dmapped BlockDist, results in a remote data access error.
- Arrays of arrays where the inner arrays vary in size are not supported.
- Array values are permitted to be detupled in an iterator
- Arrays of subdomains may not work.
- Arrays declared over domains with negative strides may result in errors.
- Array and domain runtime type information is not preserved through
  generic instantiation.
- Modifications to Sparse domains are not thread-safe.
- Sparse domain/array slicing is not supported.
- Associative domain clear() does not reset values of arrays declared
  over the domain.
- Associative domains with array or domain index types do not work.
- Associative domain literal syntax with a single domain index in
  initializer drops the extra {} and becomes the same as the single
  domain.
- Associative arrays with associative array element types result in a
  runtime error.


Task Parallelism and Synchronization
------------------------------------
- Atomic statements are not implemented.
- Deadlock may occur due to an insufficient number of threads.
- Arrays may not be moved to the heap due to begin statements or
  other indirect array element accesses.
- Sync and single type qualifiers are not disallowed on types that are
  not supported.
- Sync variables actuals that used in begin statements may be
  prematurely freed.
- Sync variables cannot be used in conditional expressions


Data Parallelism
----------------
- Some data parallel statements that should be parallelized are
  serialized with a warning message "X has been serialized".  In some
  case, this can be fixed in the program.
  E.g., Change '+ reduce for i in 1..n do i**2' to
                 '+ reduce forall i in 1..n do i**2' to avoid a
  warning that the reduce has been serialized.  In other cases, this
  is a current limitation:
  1. Scans are always serialized.
  2. Assignments from ranges to multidimensional arrays are always serialized.
  3. Assignment, reductions, and parallel iteration over opaque domains and
     arrays are always serialized.
- Array promotion/forall/for/scan expressions always evaluate to 1D arrays.
  E.g., f(A) where A promotes f() should result in an array of type:
    [A.domain] f(A(i)).type but instead results in a 1D array
  E.g., [i in D] f(i) should result in an array of type: [D] f(i).type
    but instead results in a 1D array
- Parallel zippered iteration does not perform runtime size/shape checks
- Domain promotion results in a race condition.
- Parallel (forall) domain iteration ignores alignment of the ranges
  used to declare the domain.
- Arrays and domains of different ranks can be zippered serially.
- Promoting a function over an array returned by a var function fails
  to compile.
- Reductions and scans of arrays of arrays may result in errors.
- Reductions zippered arrays of mismatched rank result in a compile time error.
- Records in reduction classes may results in out-of-bound indexing
  problems.
- Cannot not use an instance of a reduction class for a reduction.
- Whole-domain assignment operations on sparse domains are not all
  serialized as they should be.
- Task intents to not work for coforalls and cobegins used in iterators.
- Iterating over a range where bound+stride overflows the index type
  overflows can result in incorrect execution.
- Overloaded xor used in a reduction may result in an internal
  compiler error.


Standard Modules, Standard Distributions, and Standard Layouts
--------------------------------------------------------------
- On some platforms, the Math module is limited by the back-end C compiler.
- Extended precision math functions are not supported.
- The BlockCyclic distribution is incomplete.
- Reindexing stridable Cyclic is not fully supported.
- Block and Cyclic domains containing indices near the minimum or
  maximum integral type may overflow.
- Array assignment fails for Block distributions with bounding boxes
  that do not overlap with the bounds of the domain.
- Distribution equality is not implemented properly.
- Records with domain map fields do not work.


Input and Output
----------------
- Input of whole arrays is not implemented.
  Workaround: use a loop, e.g., for e in A do read(e);
- Reading of tuple types not supported.
- Printing of multi-dimensional arrays with negative strides may
  result in omitted line break.
- Printing of replicated arrays may not work properly.
- Using 'on' in a writeThis() method can lead to a deadlock.
- Calling writeln() of function names should be illegal, but currently
  results in unexpected output, obscure error messages, or compiler
  internal errors.


Optimizations
-------------
- Compiling with --baseline (or disabling specific optimizations) may
  result in incorrect code
- Disabling inlining may cause incorrect code to be generated.
- Disabling inlining with -t results in a compiler seg fault.


Miscellaneous
-------------
- Extern functions declared in a class result in an internal error
  (should be an error message).
- Nil extern class references not properly handled.
- Boolean literals do not preserve their sizes.
- Functions from extern includes that have naming conflicts with
  internal functions result in a back-end C compiler error.
- An exported function that returns a record results in two versions
  in the generated code.
- An array variable and function that share the same name at the same
  scope result in one of the two being arbitrarily chosen.
- Leaving off () when calling exit results in an internal error.
- Compiler warning mechanism not always type-checked correctly.
- Compiler warning mechanism can result it lost warning if there are
  multiple warnings.
- If the -o argument matches an existing directory name <dir>, the
  resulting binary is placed in <dir>/<dir>.tmp.
- Programs requiring non-linear resolution may fail to compile.
  E.g., mutual module uses that access variables across both modules
- Creating many domain types or arrays or tuples types causes the
  compilation time to become unreasonable.
- Types composed of runtime types are not runtime types.


Performance
-----------
- The body of forall loops over domains with non-default distribution
  are unnecessarily cloned.
- Many provably local variables are unnecessarily widen for
  multilocale execution
- Reference counting of arrays, domains, and distributions is overly
  conservative.
- Task creation for coforall/cobegin statements can be better optimized.
- Mechanisms for program tear-down can be better optimized.


Developer
---------
- chpl__autoCopy() and chpl__initCopy() functions and callees cannot
  contain begin statements.
- User defined chpl__initCopy() function are ignored in the
  removeUnnecessaryAutoCopyCalls pass.
- The "no auto destroy" pragma is not properly propagated to
  temporaries.
- The "no copy" and "no auto destroy" pragmas used with variable
  declarations with specified types result in an internal error.


Multi-locale/GASNet executions
------------------------------
- stdin does not work for multi-locale/GASNet executions


Portability
-----------

OS/X:
- Static linking not supported.

PGI compilers:
- Floating point literals of -0.0 may not work as intended.

Intel compilers:
- Floating point literals of -0.0 may not work as intended.

IEEE floating-point standard conformance:
  The --ieee-float flag is implemented by passing appropriate flags to
  the back-end compiler.  For some compilers, 100% IEEE floating-point
  conformance is not implemented.  In such cases, the --ieee-float
  flag will request the most standard conformant floating-point
  behavior (if such behavior can be identified).

