Commit d0d92baf by Kaveh R. Ghazi Committed by Kaveh Ghazi

re PR other/40302 (GCC must hard-require MPC before release)

	PR other/40302
	* arith.c: Remove HAVE_mpc* checks throughout.
	* expr.c: Likewise.
	* gfortran.h: Likewise.
	* resolve.c: Likewise.
	* simplify.c: Likewise.
	* target-memory.c: Likewise.
	* target-memory.h: Likewise.

From-SVN: r155043
parent 2330bfb3
2009-12-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR other/40302
* arith.c: Remove HAVE_mpc* checks throughout.
* expr.c: Likewise.
* gfortran.h: Likewise.
* resolve.c: Likewise.
* simplify.c: Likewise.
* target-memory.c: Likewise.
* target-memory.h: Likewise.
2009-12-06 Daniel Franke <franke.daniel@gmail.com>
PR fortran/40904
......
......@@ -156,12 +156,7 @@ free_expr0 (gfc_expr *e)
break;
case BT_COMPLEX:
#ifdef HAVE_mpc
mpc_clear (e->value.complex);
#else
mpfr_clear (e->value.complex.r);
mpfr_clear (e->value.complex.i);
#endif
break;
default:
......@@ -473,15 +468,8 @@ gfc_copy_expr (gfc_expr *p)
case BT_COMPLEX:
gfc_set_model_kind (q->ts.kind);
#ifdef HAVE_mpc
mpc_init2 (q->value.complex, mpfr_get_default_prec());
mpc_set (q->value.complex, p->value.complex, GFC_MPC_RND_MODE);
#else
mpfr_init (q->value.complex.r);
mpfr_init (q->value.complex.i);
mpfr_set (q->value.complex.r, p->value.complex.r, GFC_RND_MODE);
mpfr_set (q->value.complex.i, p->value.complex.i, GFC_RND_MODE);
#endif
break;
case BT_CHARACTER:
......
......@@ -1624,19 +1624,7 @@ gfc_class_esym_list;
#include <gmp.h>
#include <mpfr.h>
#ifdef HAVE_mpc
#include <mpc.h>
# if MPC_VERSION >= MPC_VERSION_NUM(0,6,1)
# define HAVE_mpc_pow
# endif
# if MPC_VERSION >= MPC_VERSION_NUM(0,7,1)
# define HAVE_mpc_arc
# define HAVE_mpc_pow_z
# endif
#else
#define mpc_realref(X) ((X).r)
#define mpc_imagref(X) ((X).i)
#endif
#define GFC_RND_MODE GMP_RNDN
#define GFC_MPC_RND_MODE MPC_RNDNN
......@@ -1695,15 +1683,7 @@ typedef struct gfc_expr
mpfr_t real;
#ifdef HAVE_mpc
mpc_t
#else
struct
{
mpfr_t r, i;
}
#endif
complex;
mpc_t complex;
struct
{
......
......@@ -8649,12 +8649,7 @@ build_default_init_expr (gfc_symbol *sym)
break;
case BT_COMPLEX:
#ifdef HAVE_mpc
mpc_init2 (init_expr->value.complex, mpfr_get_default_prec());
#else
mpfr_init (init_expr->value.complex.r);
mpfr_init (init_expr->value.complex.i);
#endif
switch (gfc_option.flag_init_real)
{
case GFC_INIT_REAL_SNAN:
......@@ -8676,12 +8671,7 @@ build_default_init_expr (gfc_symbol *sym)
break;
case GFC_INIT_REAL_ZERO:
#ifdef HAVE_mpc
mpc_set_ui (init_expr->value.complex, 0, GFC_MPC_RND_MODE);
#else
mpfr_set_ui (init_expr->value.complex.r, 0.0, GFC_RND_MODE);
mpfr_set_ui (init_expr->value.complex.i, 0.0, GFC_RND_MODE);
#endif
break;
default:
......
......@@ -164,28 +164,12 @@ encode_float (int kind, mpfr_t real, unsigned char *buffer, size_t buffer_size)
static int
encode_complex (int kind,
#ifdef HAVE_mpc
mpc_t cmplx,
#else
mpfr_t real, mpfr_t imaginary,
#endif
encode_complex (int kind, mpc_t cmplx,
unsigned char *buffer, size_t buffer_size)
{
int size;
size = encode_float (kind,
#ifdef HAVE_mpc
mpc_realref (cmplx),
#else
real,
#endif
&buffer[0], buffer_size);
size += encode_float (kind,
#ifdef HAVE_mpc
mpc_imagref (cmplx),
#else
imaginary,
#endif
size = encode_float (kind, mpc_realref (cmplx), &buffer[0], buffer_size);
size += encode_float (kind, mpc_imagref (cmplx),
&buffer[size], buffer_size - size);
return size;
}
......@@ -283,13 +267,7 @@ gfc_target_encode_expr (gfc_expr *source, unsigned char *buffer,
return encode_float (source->ts.kind, source->value.real, buffer,
buffer_size);
case BT_COMPLEX:
return encode_complex (source->ts.kind,
#ifdef HAVE_mpc
source->value.complex,
#else
source->value.complex.r,
source->value.complex.i,
#endif
return encode_complex (source->ts.kind, source->value.complex,
buffer, buffer_size);
case BT_LOGICAL:
return encode_logical (source->ts.kind, source->value.logical, buffer,
......@@ -391,28 +369,13 @@ gfc_interpret_float (int kind, unsigned char *buffer, size_t buffer_size,
int
gfc_interpret_complex (int kind, unsigned char *buffer, size_t buffer_size,
#ifdef HAVE_mpc
mpc_t complex
#else
mpfr_t real, mpfr_t imaginary
#endif
)
mpc_t complex)
{
int size;
size = gfc_interpret_float (kind, &buffer[0], buffer_size,
#ifdef HAVE_mpc
mpc_realref (complex)
#else
real
#endif
);
mpc_realref (complex));
size += gfc_interpret_float (kind, &buffer[size], buffer_size - size,
#ifdef HAVE_mpc
mpc_imagref (complex)
#else
imaginary
#endif
);
mpc_imagref (complex));
return size;
}
......@@ -559,13 +522,7 @@ gfc_target_interpret_expr (unsigned char *buffer, size_t buffer_size,
case BT_COMPLEX:
result->representation.length =
gfc_interpret_complex (result->ts.kind, buffer, buffer_size,
#ifdef HAVE_mpc
result->value.complex
#else
result->value.complex.r,
result->value.complex.i
#endif
);
result->value.complex);
break;
case BT_LOGICAL:
......@@ -766,19 +723,9 @@ gfc_convert_boz (gfc_expr *expr, gfc_typespec *ts)
}
else
{
#ifdef HAVE_mpc
mpc_init2 (expr->value.complex, mpfr_get_default_prec());
#else
mpfr_init (expr->value.complex.r);
mpfr_init (expr->value.complex.i);
#endif
gfc_interpret_complex (ts->kind, buffer, buffer_size,
#ifdef HAVE_mpc
expr->value.complex
#else
expr->value.complex.r, expr->value.complex.i
#endif
);
expr->value.complex);
}
expr->is_boz = 0;
expr->ts.type = ts->type;
......
......@@ -39,11 +39,7 @@ int gfc_target_encode_expr (gfc_expr *, unsigned char *, size_t);
int gfc_interpret_integer (int, unsigned char *, size_t, mpz_t);
int gfc_interpret_float (int, unsigned char *, size_t, mpfr_t);
#ifdef HAVE_mpc
int gfc_interpret_complex (int, unsigned char *, size_t, mpc_t);
#else
int gfc_interpret_complex (int, unsigned char *, size_t, mpfr_t, mpfr_t);
#endif
int gfc_interpret_logical (int, unsigned char *, size_t, int *);
int gfc_interpret_character (unsigned char *, size_t, gfc_expr *);
int gfc_interpret_derived (unsigned char *, size_t, gfc_expr *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment