Skip to content

Commit 7234c9c

Browse files
committed
fix issue open64-compiler#33 for WHIRL2llvm
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]>
1 parent 57c9915 commit 7234c9c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

osprey/ir_tools/whirl2llvm.cxx

+4
Original file line numberDiff line numberDiff line change
@@ -3588,7 +3588,9 @@ WHIRL2llvm::Handle_intrn_call(WN *wn) {
35883588
case INTRN_F8COS: func_name = "cos"; break;
35893589
case INTRN_STRLEN: func_name = "strlen"; break;
35903590
case INTRN_STRCPY: func_name = "strcpy"; break;
3591+
case INTRN_STRNCPY: func_name = "strncpy"; break;
35913592
case INTRN_STRCMP: func_name = "strcmp"; break;
3593+
case INTRN_STRNCMP: func_name = "strncmp"; break;
35923594
case INTRN_MEMCPY: func_name = "memcpy"; break;
35933595
case INTRN_MEMSET: func_name = "memset"; break;
35943596
case INTRN_MEMCMP: func_name = "memcmp"; break;
@@ -5798,7 +5800,9 @@ WHIRL2llvm::STMT2llvm(WN *wn, W2LBB *lvbb)
57985800
case INTRN_MEMCPY:
57995801
case INTRN_MEMSET:
58005802
case INTRN_STRCPY:
5803+
case INTRN_STRNCPY:
58015804
case INTRN_STRCMP:
5805+
case INTRN_STRNCMP:
58025806
case INTRN_STRLEN:
58035807
case INTRN_MEMCCPY:
58045808
case INTRN_MEMMOVE: {

0 commit comments

Comments
 (0)