Issue 81025
Summary [Flang] Incorrect use association for generic names.
Labels flang
Assignees
Reporter DanielCChen
    The following test cases crashes. The problem is when procedure pointer `PtrInt8` is declared, its `procInterface` `Int8` is not marked as generic nor specific function, so it is typeless.
 
The `-fdebug-dump-symbols` shows `int8 (Function): Use from int8 in m1`.
```
  Module scope: m size=0 alignment=1 sourceRange=156 bytes
    int, PUBLIC (Function): Subprogram result:INTEGER(4) int (INTEGER(4) arg)
    int8, PUBLIC (Function): Subprogram result:INTEGER(8) int8 (INTEGER(8) arg)
    Subprogram scope: int size=8 alignment=4 sourceRange=60 bytes
      arg size=4 offset=4: ObjectEntity dummy type: INTEGER(4)
      int size=4 offset=0: ObjectEntity funcResult type: INTEGER(4)
    Subprogram scope: int8 size=16 alignment=8 sourceRange=66 bytes
      arg size=8 offset=8: ObjectEntity dummy type: INTEGER(8)
      int8 size=8 offset=0: ObjectEntity funcResult type: INTEGER(8)
  Module scope: m1 size=0 alignment=1 sourceRange=98 bytes
    int, PUBLIC (Function): Use from int in m
    int8, PUBLIC (Function): Generic Name (specific) procs: int,int8
  MainProgram scope: ptrassigngen size=8 alignment=8 sourceRange=216 bytes
    int (Function): Generic Name (specific) procs: int,int8
    int8 (Function): Use from int8 in m1
    ptrint8, EXTERNAL, POINTER (Function) size=8 offset=0: ProcEntity int8
 ```
I would expect both `Int` and `Int8` are generic names that has specific `Int` and `Int8` from module `m`.

```
  MODULE M

 CONTAINS

    FUNCTION Int(Arg)
    INTEGER :: Int, Arg
      Int = Arg
    END FUNCTION

    FUNCTION Int8(Arg)
    INTEGER(8) :: Int8, Arg
      Int8 = 8_8
    END FUNCTION

  END MODULE

 MODULE M1
  USE M

    INTERFACE Int8
      MODULE PROCEDURE Int
      MODULE PROCEDURE  Int8
    END INTERFACE

  END MODULE

  PROGRAM PtrAssignGen
  USE M
  USE M1
  IMPLICIT NONE

  INTERFACE Int
    MODULE PROCEDURE  Int
    MODULE PROCEDURE  Int8
  END INTERFACE

  PROCEDURE(Int8),   POINTER :: PtrInt8

  PtrInt8 => Int8
  IF ( PtrInt8(100_8) .NE. 8_8 ) ERROR STOP 12

  END
  ```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to