[flang-commits] [flang] [flang] Tag warnings with LanguageFeature or UsageWarning (PR #110304)

KAWASHIMA Takahiro via flang-commits flang-commits at lists.llvm.org
Tue Oct 8 05:17:10 PDT 2024


kawashima-fj wrote:

@klausler This commit moves the following program to an error from a warning. Is it intentional?

```fortran
program main
  procedure(rfunc), pointer :: ptr
  ptr => null()
  if (associated(ptr, ifunc)) then
    print *, "bad"
  end if
  contains
  function ifunc(x)
    integer, intent(in) :: x
    integer :: ifunc
    ifunc = x
  end function
  function rfunc(x)
    real, intent(in) :: x
    real :: rfunc
    rfunc = x
  end function
end
```

Before this commit:

```
test.f90:4:7: warning: Function pointer 'ptr' associated with incompatible function designator 'ifunc': function results have distinct types: REAL(4) vs INTEGER(4)
    if (associated(ptr, ifunc)) then
        ^^^^^^^^^^^^^^^^^^^^^^
```

After this commit:

```
error: Semantic errors in test.f90
test.f90:4:7: error: Function pointer 'ptr' associated with incompatible function designator 'ifunc': function results have distinct types: REAL(4) vs INTEGER(4)
    if (associated(ptr, ifunc)) then
        ^^^^^^^^^^^^^^^^^^^^^^
```

(This is just a confirmation. No objection to making it an error.)

https://github.com/llvm/llvm-project/pull/110304


More information about the flang-commits mailing list