Skip to content

Conversation

@mhasel
Copy link
Member

@mhasel mhasel commented Dec 5, 2025

Unsized variadic arguments of type STRING and ARRAY now decay to pointers of the underlying type as per the C specification.

Where previously we had to explicitly call REF or ADR, e.g.
printf('String: %s', REF(myString));
which would result in
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @utf08_literal_0, i32 0, i32 0), [81 x i8]* %myString)
we can now just pass the string directly:
printf('String: %s',myString);

%2 = bitcast [81 x i8]* %myString to i8*
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @utf08_literal_0, i32 0, i32 0), i8* %2)

Interestingly enough, since we previously passed a pointer to an array when calling REF, this is not a breaking change. Both approaches work, at least for printf.

@mhasel mhasel requested a review from volsa December 5, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants