Skip to content

Enable support for data-dependent if-else #76

@agent-lee

Description

@agent-lee

Needed for catching corner cases regarding pathological values.

Repro specification:

  float acc = 0.0f;
  for (int i = 0; i < 4; i++) {
    acc += a_in[i] * a_in[i];
  }
  for (int i = 0; i < 4; i++) {
    if (acc == 0.0f) {
      b_out[i] = 0.0f;
    } else {
      b_out[i] = a_in[i] / acc;
    }
  }
}```

Compilation aborts with:

Writing intermediate files to: compile-out
==: this match expander must be used inside match
in: (== acc 0.0)
context...:
do-raise-syntax-error
apply-transformer-in-context
apply-transformer52
dispatch-transformer41
for-loop
[repeats 1 more time]
finish-bodys
for-loop
finish-bodys
for-loop
[repeats 1 more time]
finish-bodys
for-loop
[repeats 1 more time]
finish-bodys
for-loop
...
Error: Compilation aborted. cdios return error code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    high prioritymissingExpected feature missing (i.e., compiler support lacking)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions