Opened 4 years ago

Closed 4 years ago

#9 closed defect (fixed)

Unconstrained dtype return values are closed in unification

Reported by: Rob Schluntz Owned by: Rob Schluntz
Priority: major Component: cfa-cc
Version: 1.0 Keywords: dtype unify unification malloc return

Description (last modified by Rob Schluntz)

#include <stdlib>
int main() {
    int * i;
    i = malloc();

cfa test.c
CFA Version 1.0.0 (debug)
test.c:2 error: Types:
  _2_DT -> instance of type _71_T (not function type) 
  _36_DT -> signed int

unbound type variable: _71_T in application Application of
  Variable Expression: malloc: forall
        T: sized incomplete type
        _retval_malloc: pointer to instance of type T (not function type) 

The dtype T is only used as the return value of malloc, i.e., T does not occur in the parameter list or any type assertion (other than the pseudo-assertion "sized"), so by the time it is seen in the assignment call ?=?(&i, malloc()) T is a closed type variable and the unification of T and int* fails.

Change History (2)

comment:1 Changed 4 years ago by Rob Schluntz

Description: modified (diff)

comment:2 Changed 4 years ago by Rob Schluntz

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.