summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-03-26 00:17:17 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-03-26 00:17:17 +0000
commit2caa79803f1d5b1e29ef9712bf40c7c6f67a339c (patch)
treefa4957837694202ef0656fb610297feda9309aba /src
parent7572f822b6dda7fc5f93d7136b5d73f9808417df (diff)
downloadmpfr-2caa79803f1d5b1e29ef9712bf40c7c6f67a339c.tar.gz
[src/mpfr-impl.h] UBF: updated comment: this breaks aliasing rules, but
there isn't any other acceptable solution. Note: when trying to build MPFR without --enable-assert, with GCC and CFLAGS="-O2 -Werror=strict-aliasing", the compilation of tests/tsub.c currently fails because of that. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13816 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r--src/mpfr-impl.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h
index 4465b96eb..cb7c752a5 100644
--- a/src/mpfr-impl.h
+++ b/src/mpfr-impl.h
@@ -2526,9 +2526,11 @@ extern "C" {
which is assumed to be present (with a value in it) when the usual
exponent field has the value MPFR_EXP_UBF. The goal of this compatible
representation is to easily be able to support UBF in "normal" code
- and hopefully avoid aliasing issues at the same time. And code that
- accepts UBF in input should also accept mpfr_t as a consequence; this
- makes mpfr_t to UBF conversion unnecessary.
+ using the public API. This is some form of "subtyping".
+
+ Unfortunately this breaks aliasing rules, and C does not provide any way
+ to avoid that (except with additional syntax ugliness and API breakage):
+ https://news.ycombinator.com/item?id=11753236
The alignment requirement for __mpfr_ubf_struct (UBF) needs to be at least
as strong as the one for __mpfr_struct (MPFR number); this is not required