{
gfc_expr *result;
+ if (op1->ts.type != BT_LOGICAL)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, op1->ts.kind, &op1->where);
result->value.logical = !op1->value.logical;
*resultp = result;
{
gfc_expr *result;
+ if (op1->ts.type != BT_LOGICAL || op2->ts.type != BT_LOGICAL)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_kind_max (op1, op2),
&op1->where);
result->value.logical = op1->value.logical && op2->value.logical;
{
gfc_expr *result;
+ if (op1->ts.type != BT_LOGICAL || op2->ts.type != BT_LOGICAL)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_kind_max (op1, op2),
&op1->where);
result->value.logical = op1->value.logical || op2->value.logical;
{
gfc_expr *result;
+ if (op1->ts.type != BT_LOGICAL || op2->ts.type != BT_LOGICAL)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_kind_max (op1, op2),
&op1->where);
result->value.logical = op1->value.logical == op2->value.logical;
{
gfc_expr *result;
+ if (op1->ts.type != BT_LOGICAL || op2->ts.type != BT_LOGICAL)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_kind_max (op1, op2),
&op1->where);
result->value.logical = op1->value.logical != op2->value.logical;
{
gfc_expr *result;
+ if (op1->ts.type != op2->ts.type)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (op1->ts.type == BT_COMPLEX)
{
gfc_expr *result;
+ if (op1->ts.type != op2->ts.type)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (op1->ts.type == BT_COMPLEX)
{
gfc_expr *result;
+ if (op1->ts.type != op2->ts.type)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2, INTRINSIC_GT) > 0);
{
gfc_expr *result;
+ if (op1->ts.type != op2->ts.type)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2, INTRINSIC_GE) >= 0);
{
gfc_expr *result;
+ if (op1->ts.type != op2->ts.type)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2, INTRINSIC_LT) < 0);
{
gfc_expr *result;
+ if (op1->ts.type != op2->ts.type)
+ return ARITH_INVALID_TYPE;
+
result = gfc_get_constant_expr (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2, INTRINSIC_LE) <= 0);
--- /dev/null
+! { dg-do compile }
+! PR fortran/107272 - followup of PR/107217 for non-numeric types
+
+program p
+ print *, 2 <= [real :: (['1'])] ! { dg-error "Cannot convert" }
+ print *, 2 < [real :: (['1'])] ! { dg-error "Cannot convert" }
+ print *, 2 == [real :: (['1'])] ! { dg-error "Cannot convert" }
+ print *, 2 /= [real :: (['1'])] ! { dg-error "Cannot convert" }
+ print *, 2 >= [real :: (['1'])] ! { dg-error "Cannot convert" }
+ print *, 2 > [real :: (['1'])] ! { dg-error "Cannot convert" }
+ print *, [real :: (['1'])] >= 2 ! { dg-error "Cannot convert" }
+ print *, [real :: (['1'])] > 2 ! { dg-error "Cannot convert" }
+ print *, [real :: (['1'])] == 2 ! { dg-error "Cannot convert" }
+ print *, [real :: (['1'])] /= 2 ! { dg-error "Cannot convert" }
+ print *, [real :: (['1'])] <= 2 ! { dg-error "Cannot convert" }
+ print *, [real :: (['1'])] < 2 ! { dg-error "Cannot convert" }
+ print *, [logical :: (['1'])] .and. .true. ! { dg-error "Cannot convert" }
+ print *, [logical :: (['1'])] .or. .true. ! { dg-error "Cannot convert" }
+ print *, [logical :: (['1'])] .eqv. .true. ! { dg-error "Cannot convert" }
+ print *, [logical :: (['1'])] .neqv. .true. ! { dg-error "Cannot convert" }
+end