diff options
author | Gary Houston <ghouston@arglist.com> | 2002-09-24 22:21:01 +0000 |
---|---|---|
committer | Gary Houston <ghouston@arglist.com> | 2002-09-24 22:21:01 +0000 |
commit | 3553e1d1f037df79b10e5f8589884c02e57fe144 (patch) | |
tree | 827dc47b1b7937760b7a2cd2b682fab1553ad9d6 /libguile/inline.h | |
parent | c15030bebf555969379628ef154f7f26ce1c6cd1 (diff) | |
download | guile-3553e1d1f037df79b10e5f8589884c02e57fe144.tar.gz |
* inline.h (scm_double_cell): prevent reordering of statements
with any following code (for GCC 3 strict-aliasing).
* numbers.c (scm_make_real), num2float.i.c (FLOAT2NUM): removed
the earlier version of the reordering prevention.
Diffstat (limited to 'libguile/inline.h')
-rw-r--r-- | libguile/inline.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libguile/inline.h b/libguile/inline.h index d4cd67606..393182b6a 100644 --- a/libguile/inline.h +++ b/libguile/inline.h @@ -215,6 +215,26 @@ scm_double_cell (scm_t_bits car, scm_t_bits cbr, #endif + /* When this function is inlined, it's possible that the last + SCM_GC_SET_CELL_WORD above will be adjacent to a following + initialization of z. E.g., it occurred in scm_make_real. GCC + from around version 3 (e.g., certainly 3.2) began taking + advantage of strict C aliasing rules which say that it's OK to + interchange the initialization above and the one below when the + pointer types appear to differ sufficiently. We don't want that, + of course. GCC allows this behaviour to be disabled with the + -fno-strict-aliasing option, but would also need to be supplied + by Guile users. Instead, the following statements prevent the + reordering. + */ +#ifdef __GNUC__ + asm volatile ("" : : : "memory"); +#else + /* portable version, just in case any other compiler does the same + thing. */ + scm_remember_upto_here_1 (z); +#endif + return z; } |