Skip to content

Commit

Permalink
fix issue open64-compiler#33 for WHIRL2llvm
Browse files Browse the repository at this point in the history
1. The w2ll will crash if compile the code like that:
```
typedef struct msa_struct {
  char **aseq;
  int    alen;
  int    nseq;
} MSA;

void WriteA2M1(MSA *msa)
{
  int  pos;
  char buf[64];
  int  cpl = 60;

  buf[cpl] = '\0';
  for (pos = 0; pos < msa->alen; pos+=cpl)
  {
    strncpy(buf, &(msa->aseq[0][pos]), cpl);
  }
}

```

2. Error Log:
```
Assertion failure ../../../../osprey/ir_tools/whirl2llvm.cxx:5815:
WHIRL2llvm::STMT2llvm, intrinsic(521) not handled
```

Signed-off-by: Zhijin Zeng <[email protected]>
  • Loading branch information
zengdage committed Jan 3, 2024
1 parent 57c9915 commit 7234c9c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions osprey/ir_tools/whirl2llvm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3588,7 +3588,9 @@ WHIRL2llvm::Handle_intrn_call(WN *wn) {
case INTRN_F8COS: func_name = "cos"; break;
case INTRN_STRLEN: func_name = "strlen"; break;
case INTRN_STRCPY: func_name = "strcpy"; break;
case INTRN_STRNCPY: func_name = "strncpy"; break;
case INTRN_STRCMP: func_name = "strcmp"; break;
case INTRN_STRNCMP: func_name = "strncmp"; break;
case INTRN_MEMCPY: func_name = "memcpy"; break;
case INTRN_MEMSET: func_name = "memset"; break;
case INTRN_MEMCMP: func_name = "memcmp"; break;
Expand Down Expand Up @@ -5798,7 +5800,9 @@ WHIRL2llvm::STMT2llvm(WN *wn, W2LBB *lvbb)
case INTRN_MEMCPY:
case INTRN_MEMSET:
case INTRN_STRCPY:
case INTRN_STRNCPY:
case INTRN_STRCMP:
case INTRN_STRNCMP:
case INTRN_STRLEN:
case INTRN_MEMCCPY:
case INTRN_MEMMOVE: {
Expand Down

0 comments on commit 7234c9c

Please sign in to comment.