Skip to content

Conversation

llvm-beanz
Copy link
Collaborator

This adds language documenting that out of bounds accesses for arrays is undefined behavior, and that zero-sized arrays are disallowed.

This also restricts arrays of unknown size to strictly global resource declarations but allows omitting the array bound if it can be inferred from an initiailzer.

Resolves #141

This adds language documenting that out of bounds accesses for arrays is
undefined behavior, and that zero-sized arrays are disallowed.

This also restricts arrays of unknown size to strictly global resource
declarations but allows omitting the array bound if it can be inferred
from an initiailzer.

Resolves microsoft#141
@llvm-beanz llvm-beanz requested a review from hekota September 9, 2025 00:56
@github-actions github-actions bot added the language-spec Issue with completed spec label Sep 9, 2025
llvm-beanz added a commit to llvm-beanz/hlsl-specs that referenced this pull request Sep 16, 2025
After the meeting today we seem to have alignment here. I'm going to
mark this proposal as under review with PR microsoft#634 as the main review for
the spec contribution.
llvm-beanz added a commit that referenced this pull request Sep 17, 2025
After the meeting today we seem to have alignment here. I'm going to
mark this proposal as under review with PR #634 as the main review for
the spec contribution.
Copy link
Member

@hekota hekota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

\textit{D`} \terminal{[} \textit{N} \terminal{]} \opt{attribute-specifier-seq}\br
\end{grammar}

declares an array of \textit{N} \textit{T`}, where \textit{N} is the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the relationship between T and T'?

the contained type of an array be a complete type.
\end{note}

\p A declarator with an omitted array bound is valid if the when declaring an
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 'if the' before when? or remove 'the when' after if?


\p A declarator with an omitted array bound is valid if the when declaring an
object of array type which is not a non-static data member and is initialized
with an initializer that follows the declarator. In this case the array bound is
Copy link
Collaborator

@spall spall Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this only allowed for global declarations of resource objects? or for all array declarations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

language-spec Issue with completed spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unsized arrays

3 participants