<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97091>97091</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
-Waddress-of-packed-member flags attribute(packed) but not pragma pack
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidben
</td>
</tr>
</table>
<pre>
In this example, there are two packed (and thus unaligned) structs, both of whom have an `int` field where taking the address is dangerous, as I understand it:
https://godbolt.org/z/PdqaMoeof
But for some reason, `-Waddress-of-packed-member` only flags the first one, and not the second. Is that intentional? I think they both run afoul of pointer alignment requirements. I noticed https://github.com/llvm/llvm-project/issues/23195 was filed back in 2016, but it was closed on grounds that Clang doesn't accept `#pragma pack`.
It seems Clang now does, but the warning was never updated?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyck03PqzYQhX-N2YwSGZPwsWBxP4SURaXuuh7wAG6MzbXHSd_--sokV31VqZu7SUAezpl5fAZjNIsj6sX1q7h-LzDx6kOv8WH0SK4Yvf7obw54NRHoL9x2S0J9A14pEGAg4KeHHac7aRCqRaeB1xQhObRZWQvVQeSQJo75w9HzCn6G5-o3WPFBgA5ELY1jUUuYDVkNz0Od8W7ckq0AtQ4UI5gIGt1CwadDDSPcIDlNIXK2NiyqL0J-F_LLyrzH_KYGoYbF69FbPvuwCDX8LdTwu_6Bv3ny86v89fs1Mcw-QPQbQSCM3mUbUcvTH-8eTn4-veY9bbSNFHLb3tkPmC0u8Wh3NiEyeHegyn05z8dBpMk7fYZbrkMG45gcG-_QimqAW-bs7rn040UqJAc4-2Qzs93n-gAH2Y0cQ6AfyQTKz_EMt-xjJtLwn-ENr2k8T34TarD28fPvtAf_J00s1GBiTBSFGlRVdld4YoTZWNIw4nQH40DJsj7uLzEYPgom6yNp8A6W4JPT75m-WXQLaE_RCdUw4DTRzpmhUNUecNnwCIyo5fkz-xtDJNriW8D55yHy0zTje2JwORLZ3dGDAqRdI5MW1VDovtJd1WFBfdmU3bVrZVUXaz-W86zV3DbXtkFqVD3OZSuxnUY5VrVsCtMrqS6yVm3Zyqa8nnV3masLySuOVdOoVlwkbWjsOUPLESoOXH3XyK4sLI5k47FASjl6wnEolMr7FPoD9JiWKC7SmsjxXxU2bKn__2S9E4XMwYyJSaj2dZ53KjPJsfpEtEjB9r9-9a9xHr36JwAA__8atFtK">