Skip to content

Commit dc082a6

Browse files
committed
Add extra init and default branch to bypass "maybe unitialized" error
1 parent c174729 commit dc082a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ggml/src/ggml-cpu/vec.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,12 +1427,13 @@ inline static void ggml_vec_sum_f32(const int n, float * s, const float * x) {
14271427
// type - type of triangular mask (lower, upper, etc.)
14281428
inline static void ggml_vec_tri_f32(const int n, const int r, float * dst, const float * src, bool keep_org_val, float c, enum ggml_tri_type type) {
14291429
for (int i = 0; i < n; ++i) {
1430-
bool cmp;
1430+
bool cmp = false;
14311431
switch (type) {
14321432
case GGML_TRI_TYPE_LOWER: cmp = i < r; break;
14331433
case GGML_TRI_TYPE_LOWER_DIAG: cmp = i <= r; break;
14341434
case GGML_TRI_TYPE_UPPER: cmp = i > r; break;
1435-
case GGML_TRI_TYPE_UPPER_DIAG: cmp = i >= r; break;
1435+
case GGML_TRI_TYPE_UPPER_DIAG:
1436+
default: cmp = i >= r; break;
14361437
}
14371438
dst[i] = cmp ? (keep_org_val ? src[i] : c) : 0.0f;
14381439
}

0 commit comments

Comments
 (0)