https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103413

--- Comment #11 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #10)
> Well, a boz is typeless, so it cannot be compatible with any other type.
> So, I would assume, you could do 
> 
> if (ts1->type == BT_BOZ || ts2->type == BT_BOZ)
>    return false;

Yes, that's better.

> There is a caveat in that Fortran 2023 is going to allow
> things like
> 
>     real :: x = z'1234'
> 
> if gfc_type_compatible is used in simple assignments, gfortran will
> need to deal with that.

It is currently not used in those cases.

The following is already rejected:

program p
  real :: r
  data r / z'1234' /
  r = z'1234'
  print *, r
end

pr103413-boz.f90:3:18:

    3 |   data r / z'1234' /
      |                  1
Error: BOZ literal constant near (1) cannot be assigned to a REAL variable [see
'-fno-allow-invalid-boz']
pr103413-boz.f90:4:6:

    4 |   r = z'1234'
      |      1
Error: BOZ literal constant at (1) is neither a DATA statement value nor an
actual argument of INT/REAL/DBLE/CMPLX intrinsic subprogram [see
'-fno-allow-invalid-boz']

Interestingly, -fno-allow-invalid-boz is not an allowed option...
But even when using -fallow-invalid-boz, which degrades the above to a warning,
I never get to gfc_type_compatible.

Reply via email to