gfc_expr *result;
arith rc;
+ if (src->ts.type != BT_INTEGER)
+ return NULL;
+
result = gfc_get_constant_expr (BT_INTEGER, kind, &src->where);
mpz_set (result->value.integer, src->value.integer);
gfc_expr *result;
arith rc;
+ if (src->ts.type != BT_INTEGER)
+ return NULL;
+
result = gfc_get_constant_expr (BT_REAL, kind, &src->where);
mpfr_set_z (result->value.real, src->value.integer, GFC_RND_MODE);
gfc_expr *result;
arith rc;
+ if (src->ts.type != BT_INTEGER)
+ return NULL;
+
result = gfc_get_constant_expr (BT_COMPLEX, kind, &src->where);
mpc_set_z (result->value.complex, src->value.integer, GFC_MPC_RND_MODE);
arith rc;
bool did_warn = false;
+ if (src->ts.type != BT_REAL)
+ return NULL;
+
result = gfc_get_constant_expr (BT_INTEGER, kind, &src->where);
gfc_mpfr_to_mpz (result->value.integer, src->value.real, &src->where);
arith rc;
bool did_warn = false;
+ if (src->ts.type != BT_REAL)
+ return NULL;
+
result = gfc_get_constant_expr (BT_REAL, kind, &src->where);
mpfr_set (result->value.real, src->value.real, GFC_RND_MODE);
arith rc;
bool did_warn = false;
+ if (src->ts.type != BT_COMPLEX)
+ return NULL;
+
result = gfc_get_constant_expr (BT_INTEGER, kind, &src->where);
gfc_mpfr_to_mpz (result->value.integer, mpc_realref (src->value.complex),
arith rc;
bool did_warn = false;
+ if (src->ts.type != BT_COMPLEX)
+ return NULL;
+
result = gfc_get_constant_expr (BT_REAL, kind, &src->where);
mpc_real (result->value.real, src->value.complex, GFC_RND_MODE);
arith rc;
bool did_warn = false;
+ if (src->ts.type != BT_COMPLEX)
+ return NULL;
+
result = gfc_get_constant_expr (BT_COMPLEX, kind, &src->where);
mpc_set (result->value.complex, src->value.complex, GFC_MPC_RND_MODE);
{
gfc_expr *result;
+ if (src->ts.type != BT_LOGICAL)
+ return NULL;
+
result = gfc_get_constant_expr (BT_LOGICAL, kind, &src->where);
result->value.logical = src->value.logical;
{
gfc_expr *result;
+ if (src->ts.type != BT_LOGICAL)
+ return NULL;
+
result = gfc_get_constant_expr (BT_INTEGER, kind, &src->where);
mpz_set_si (result->value.integer, src->value.logical);
{
gfc_expr *result;
+ if (src->ts.type != BT_INTEGER)
+ return NULL;
+
result = gfc_get_constant_expr (BT_LOGICAL, kind, &src->where);
result->value.logical = (mpz_cmp_si (src->value.integer, 0) != 0);
--- /dev/null
+! { dg-do compile }
+! PR fortran/107215 - ICE in gfc_real2real and gfc_complex2complex
+! Contributed by G.Steinmetz
+
+program p
+ double precision, parameter :: z = 1.0d0
+ complex :: x(1)
+ real :: y(1)
+ x = [real :: -'1'] * z ! { dg-error "Operand of unary numeric operator" }
+ y = z * [real :: -'1'] ! { dg-error "Operand of unary numeric operator" }
+ x = [real :: -(.true.)] * z ! { dg-error "Operand of unary numeric operator" }
+ y = z * [real :: -(.true.)] ! { dg-error "Operand of unary numeric operator" }
+ x = [complex :: -'1'] * z ! { dg-error "Operand of unary numeric operator" }
+ y = z * [complex :: -'1'] ! { dg-error "Operand of unary numeric operator" }
+ x = [complex :: -(.true.)] * z ! { dg-error "Operand of unary numeric operator" }
+ y = z * [complex :: -(.true.)] ! { dg-error "Operand of unary numeric operator" }
+end