daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 62 forks source link

Segmentation Fault when Assigning Mixed Data Types in If-Else-Construct #916

Open Garic152 opened 6 days ago

Garic152 commented 6 days ago

Description

When assigning different datatypes in the ifelse statement, we receive a segfault instead of attempting to promote one of the 2 types or throwing a compilation error.

Steps to Reproduce

Here is a minimal example to reproduce the issue:

a = 1 == 1 ? 1 : 0.0;
print(a);
philipportner commented 6 days ago

Hi @Garic152 , for me on the current HEAD, this doesn't segfault. Instead it throws an exception from here.

CanonicalizerPass (mlir::daphne::CondOp) failed with the following message [ the then/else-values of CondOp must have the same value type ]
    | Source file -> "/home/philipportner/daphne/tmp.daphne":1:4
    |
  1 | a = 1 == 1 ? 1 : 0.0;
    |     ^~~

Seems like currently matching types are a requirement for the CondOp, but different types could be something that we should support.