<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello all, I am currently implementing support for DWARFv5
DW_AT_alignment attribute
(<a class="moz-txt-link-freetext" href="http://www.dwarfstd.org/ShowIssue.php?issue=140528.1">http://www.dwarfstd.org/ShowIssue.php?issue=140528.1</a>). I am not
100% sure which entities we should mark with this attr.<br>
<br>
Consider the following C11 code (sample from
<a class="moz-txt-link-freetext" href="http://en.cppreference.com/w/c/language/_Alignas">http://en.cppreference.com/w/c/language/_Alignas</a>):<br>
<br>
// every object of type struct data will be aligned to 128-byte
boundary <br>
struct data { <br>
char x; <br>
_Alignas(128) char cacheline[128]; // over-aligned array of char, <br>
// not array of over-aligned chars <br>
}; <br>
<br>
int main(void) <br>
{ <br>
_Alignas(2048) struct data d; // this instance of data is aligned
even stricter<br>
return 0; <br>
} <br>
<br>
What should be marked as DW_AT_alignment? The link above says that
the attribute can be applied to: <br>
<pre><big>DW_TAG_array_type, DW_TAG_atomic_type, DW_TAG_base_type, DW_TAG_class_type,
DW_TAG_coarray_type, DW_TAG_const_type, DW_TAG_dynamic_type,
DW_TAG_enumeration_type, DW_TAG_file_type, DW_TAG_interface_type,
DW_TAG_packed_type, DW_TAG_pointer_type, DW_TAG_pointer_to_member_type,
DW_TAG_reference_type, DW_TAG_restrict_type, DW_TAG_rvalue_reference_type,
DW_TAG_set_type, DW_TAG_shared_type, DW_TAG_string_type, DW_TAG_structure_type,
DW_TAG_subprogram, DW_TAG_subrange_type, DW_TAG_subroutine_type,
DW_TAG_thrown_type, DW_TAG_typedef, DW_TAG_union_type, DW_TAG_variable</big></pre>
<br>
Here we have<br>
<br>
* DW_TAG_array_type<br>
* DW_TAG_subrange_type<br>
* DW_TAG_member <br>
* DW_TAG_structure_type<br>
* DW_TAG_basic_type<br>
* DW_TAG_variable<br>
<br>
Currently I mark only variable "d" as aligned, however I am not
sure, that this is correct? Which of the listed should contain this
attribute? What do you think?<br>
<br>
--<br>
Victor<br>
<br>
</body>
</html>