Skip to content

Commit

Permalink
fix issue open64-compiler#38 for if-convert
Browse files Browse the repository at this point in the history
1. the be will crash if compile the code like that:
```
int sre_random(void)
{
  long  rnd1;
  static long  tbl[64];
  int i;
  for (i = 0; i < 64; i++) {
        tbl[i] = rnd1;
        if (tbl[i] < 0)
                tbl[i] += 0;
  }
  return 0;
}
```

Signed-off-by: Zhijin Zeng <[email protected]>
  • Loading branch information
zengdage committed Jan 3, 2024
1 parent e79841b commit d676e84
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions osprey/be/opt/opt_cfg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,13 @@ CFG::if_convert(WN *wn)
WN_kid0(store) = sel;
WN_Set_Linenum(store, WN_Get_Linenum(wn));

if (empty_then ? then_wn : else_wn) {
if (WN * other_stmt = WN_first(empty_then ? then_wn : else_wn)) {
INT32 vertex = WN_get_dep_graph_vertex(other_stmt);
WN_detach_wn_from_dep_graph(vertex);
}
}

WN *block = WN_CreateBlock();
WN_INSERT_BlockFirst(block, store);
if (if_select_return) {
Expand Down

0 comments on commit d676e84

Please sign in to comment.