Skip to content

Commit

Permalink
rocr: set underlying type of hsa_region_info_t, hsa_amd_region_info_t
Browse files Browse the repository at this point in the history
When an enum's backing type is not set explicitly it is undefined
behavior to load a value that is not one of the specific values
it was defined with.

See https://eel.is/c++draft/expr.static.cast#9
  • Loading branch information
LunNova committed Jan 25, 2025
1 parent 0f507e7 commit 441137d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion runtime/hsa-runtime/inc/hsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -3269,7 +3269,7 @@ typedef enum {
/**
* @brief Attributes of a memory region.
*/
typedef enum {
typedef enum : int {
/**
* Segment where memory in the region can be used. The type of this
* attribute is ::hsa_region_segment_t.
Expand Down
2 changes: 1 addition & 1 deletion runtime/hsa-runtime/inc/hsa_ext_amd.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ typedef struct hsa_amd_hdp_flush_s {
/**
* @brief Region attributes.
*/
typedef enum hsa_amd_region_info_s {
typedef enum hsa_amd_region_info_s : int {
/**
* Determine if host can access the region. The type of this attribute
* is bool.
Expand Down

0 comments on commit 441137d

Please sign in to comment.