diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-09-29 09:47:08 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-09-29 09:47:08 +0000 |
commit | 791c55dbc551183d68dd17f739963a001cf086f5 (patch) | |
tree | 59cd5598d2971a3e28308d1530ce3ed200fe6382 /mpfr.h | |
parent | e1fce1128134c70c25fe8aa147ea1aa13325af7b (diff) | |
download | mpfr-791c55dbc551183d68dd17f739963a001cf086f5.tar.gz |
Fixed bug in mpfr_set_ui macro when parameters are expressions
with side effects.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3875 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr.h')
-rw-r--r-- | mpfr.h | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -631,12 +631,17 @@ __MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); (__builtin_constant_p (_s) && (_s) >= 0 ? \ mpfr_cmp_ui ((_f), (_s)) : \ mpfr_cmp_si_2exp ((_f), (_s), 0)) +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 #undef mpfr_set_ui #define mpfr_set_ui(_f,_u,_r) \ (__builtin_constant_p (_u) && (_u) == 0 ? \ - ((_f)->_mpfr_sign = 1, \ - (_f)->_mpfr_exp = __MPFR_EXP_ZERO, 0): \ - mpfr_set_ui (_f,_u,_r)) + __extension__ ({ \ + mpfr_ptr _p = (_f); \ + _p->_mpfr_sign = 1; \ + _p->_mpfr_exp = __MPFR_EXP_ZERO; \ + (void) (_r); 0; }) : \ + mpfr_set_ui (_f,_u,_r)) +#endif #undef mpfr_set_si #define mpfr_set_si(_f,_s,_r) \ (__builtin_constant_p (_s) && (_s) >= 0 ? \ |