Opened 12 months ago

Last modified 12 months ago

#183 new defect

Polymorphic Variable Name Reuse Causes Crash

Reported by: ajbeach Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

It appears that polymorphic variables are being confused. The following code works however if you replace occurrences of the name "Tx" with "T" the compiler segfaults.

trait satifies(dtype Tx) {
  void assertion(Tx &);
};

forall(dtype T)
struct Wrapper {};

forall(dtype T | satifies(Wrapper(T)))
T & function(T & value) {
    return value;
}

It appears somehow T=Wrapper(T) is causing a problem. Even if that actual equation is not used, it might be the mangling from one is applied to the other or something else. It does appear to lead to a segmentation fault during validation due to stack overflow.

Change History (2)

comment:1 Changed 12 months ago by ajbeach

Priority: majorminor

Dropping it down to minor because if you use different variable names it should all be fine.

comment:2 Changed 12 months ago by ajbeach

I may have found an even simpler example, just replace Wrapper(T) with T *. Once again this is the working code, rename Tx to T to get the crash.

trait satisfies(dtype Tx) {
    void assertion(Tx);
};

forall(dtype T | satisfies(T *))
void something(T * value) {
    assertion(value);
}
Note: See TracTickets for help on using tickets.