Opened 4 years ago

Last modified 4 years ago

#183 new defect

Polymorphic Variable Name Reuse Causes Crash

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


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 4 years 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 4 years 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) {
Note: See TracTickets for help on using tickets.