Linker issue with -g option

Hi,

The following code behaves differently at link time when the -g option is set :

[CNC link]$ cat a.F90
MODULE A

IMPLICIT NONE

REAL(KIND=8), TARGET :: X (1) 

CONTAINS

SUBROUTINE S

CALL E

END SUBROUTINE S

END 

[CNC link]$ cat main.F90
PROGRAM MAIN

USE A, ONLY : S

END 

[CNC link]$ pgf90 -g -c a.F90 
[CNC link]$ pgf90 main.F90
[CNC link]$ pgf90 -g main.F90
/scratch/utmp/marguina/nvfortranmjXrK1FTxe5J.o:(.debug_info+0x40): undefined reference to `_a_2_'

My compiler/OS version :


[CNC link]$ pgf90 --version 

pgf90 (aka nvfortran) 21.7-0 64-bit target on x86-64 Linux -tp zen 
PGI Compilers and Tools
Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.
[CNC link]$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.8 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.8"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.8 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.8:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.8
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.8"

Regards,

Philippe

With -g, we have always required the .o file from every module. We assume you want to debug, and you need the object for the module to debug in the executable.

Thank you for your answer. I note that this is different from other compilers, like gfortran or ifort.

Philippe