diff --git a/mlir/test/CAPI/sparse_tensor.c b/mlir/test/CAPI/sparse_tensor.c --- a/mlir/test/CAPI/sparse_tensor.c +++ b/mlir/test/CAPI/sparse_tensor.c @@ -43,7 +43,7 @@ // CHECK: level_type: 2 int numLevelTypes = mlirSparseTensorEncodingGetNumDimLevelTypes(originalAttr); enum MlirSparseTensorDimLevelType *levelTypes = - alloca(sizeof(enum MlirSparseTensorDimLevelType) * numLevelTypes); + malloc(sizeof(enum MlirSparseTensorDimLevelType) * numLevelTypes); for (int i = 0; i < numLevelTypes; ++i) { levelTypes[i] = mlirSparseTensorEncodingAttrGetDimLevelType(originalAttr, i); @@ -64,6 +64,8 @@ mlirAttributeDump(newAttr); // For debugging filecheck output. // CHECK: equal: 1 fprintf(stderr, "equal: %d\n", mlirAttributeEqual(originalAttr, newAttr)); + + free(levelTypes); return 0; }