Skip to content

Commit b689047

Browse files
committed
fused_group / group: rename CD_INSERT caller's 'val' to 'row_val'
The CD_INSERT macro at src/ops/group.c:1038 defines an internal 'int64_t val = (VAL_EXPR);' from its argument. The has-nulls fallback loop earlier in the same function declared its own 'int64_t val' in the outer scope and then called CD_INSERT(val). After macro expansion that became 'int64_t val = (val);' — clang on macOS flags it as -Werror,-Wuninitialized. gcc didn't notice. Renaming the outer variable to row_val avoids the shadowing. Only the fallback callsite needed the rename; the fast-path loops were already passing distinct expressions (d[r], v, etc.). Caught with a local CC=clang build matching CI's compiler. Last build error this commit fixes; clang release build is now clean and the test matrix is 2335 / 2336 passing, 0 failed.
1 parent 1655609 commit b689047

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/ops/group.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,16 +1111,19 @@ ray_t* ray_count_distinct_per_group(ray_t* src, const int64_t* row_gid,
11111111
int64_t gid = row_gid[r];
11121112
if (gid < 0 || gid >= n_groups) continue;
11131113
if (null_bm && ((null_bm[r/8] >> (r%8)) & 1)) continue;
1114-
int64_t val;
1114+
/* Use a different name from the macro's inner `val` so
1115+
* clang doesn't see an `int64_t val = (val);` self-init
1116+
* after macro expansion. */
1117+
int64_t row_val;
11151118
if (in_type == RAY_F64) {
11161119
double fv = ((double*)base)[r];
11171120
if (fv != fv) fv = (double)NAN;
11181121
else if (fv == 0.0) fv = 0.0;
1119-
memcpy(&val, &fv, sizeof(int64_t));
1122+
memcpy(&row_val, &fv, sizeof(int64_t));
11201123
} else {
1121-
val = read_col_i64(base, r, in_type, src->attrs);
1124+
row_val = read_col_i64(base, r, in_type, src->attrs);
11221125
}
1123-
CD_INSERT(val);
1126+
CD_INSERT(row_val);
11241127
}
11251128
}
11261129

0 commit comments

Comments
 (0)