Dimitry Andric added the comment:

There is a "#pragma clang optimize", but it only has the options "on" or "off", 
for specific source locations.  I guess that would defeat the purpose a little 
bit. :(

As an experiment, and to show what would be needed (at minimum), I have 
attempted to make Python/dtoa.c completely aliasing-safe here:

https://github.com/DimitryAndric/cpython/commit/29c3f6f5cd771fce5630f127b9e7054593e3160c

This allowed to remove the -fno-strict-aliasing flag again, and it succeeded 
all tests, even with clang 5.0.0.

It basically replaces the direct union member accesses with getters and 
setters, which do the right thing for clang.  Note that even though those 
getters and setters use memcpy(), this is actually completely optimized away in 
the resulting assembly.  (Old compilers might not fare that well, though.)

In any case, while these are mostly mechanical changes, it is still a lot of 
code churn, and it should really be reviewed by the original maintainer of 
dtoa, David M. Gay.  I have no idea whether he is still active, though...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30124>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to