From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
On 05/15/2017 02:04 AM, Philipp Stephani wrote:
> - Maybe add verify(INT_MAX >=3D TYPE_MAXIMUM(in_port_t)) and
> verify(TYPE_MINIMUM(in_port_t) =3D=3D 0) to make sure that we can use = int
> for the port?
The code has been changed so that the port number is no longer stored in
an int so this remark is obsolete now. However, if this issue crops up
later I don't think we need to worry about it for IPv4 and IPv6 ports,<= br> since they're always in the range 0..65535. Emacs already assumes that<= br> 'int' is at least 32 bits wide, as per POSIX.
> - Should there be a guard against the alias violation, e.g. by
> declaring sa and sa1 with __attribute__((may_alias))? Otherwise it'= ;s
> UB and the compiler might elide the switch entirely.
Yes, that is easy enough to do and would avoid some unlikely but
hard-to-catch bugs. I installed the attached. Most likely other parts of
Emacs should use may_alias too; do you happen to have any tool in your
toolbox that would find them systematically?