-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
flangFlang issues not falling into any other categoryFlang issues not falling into any other categoryquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
I notice that gfortran's have a intrinsic function "abort" that can abort and print a backtrace when called.
flang also has it, but it only aborts without printing a backtrace.
So, I modified it for flang, and my implemention is different from gfortran's. So I would like to get some suggestions...
the source is
! L2 Norm of a vector
function vector_norm(n,vec) result(norm)
implicit none
integer, intent(in) :: n
real, intent(in) :: vec(n)
real :: norm
norm = sqrt(sum(vec**2))
call backtrace
end function vector_norm
! Print matrix A to screen
subroutine print_matrix(n,m,A)
implicit none
integer, intent(in) :: n
integer, intent(in) :: m
integer, intent(in) :: A(n, m)
real :: v(9)
real :: vector_norm
integer :: i
v(:) = 9
do i = 1, n
print *, A(i, 1:m)
end do
print *, 'Vector norm = ', vector_norm(9,v)
end subroutine print_matrix
program test_backtrace
integer :: k(10, 10)
k = 9
call print_matrix(2, 3, k)
end program test_backtrace
And, gfortran's backtrace print like:
#0 0x650cc12924a1 in vector_norm_
at /home/hunter/plct/fortran/test.f90:10
#1 0x650cc12923ed in print_matrix_
at /home/hunter/plct/fortran/test.f90:32
#2 0x650cc1292527 in test_backtrace
at /home/hunter/plct/fortran/test.f90:40
#3 0x650cc1292577 in main
at /home/hunter/plct/fortran/test.f90:41And my implemention print like:
./test(_FortranABacktrace+0x32) [0x5b30328e1312]
./test(vector_norm_+0x129) [0x5b30328b38f9]
./test(print_matrix_+0x252) [0x5b30328b3b62]
./test(_QQmain+0x105) [0x5b30328b3c95]
./test(main+0x12) [0x5b30328b3cb2]
/usr/lib/libc.so.6(+0x25e08) [0x786915b75e08]
/usr/lib/libc.so.6(__libc_start_main+0x8c) [0x786915b75ecc]
./test(_start+0x25) [0x5b30328b36f5]
Metadata
Metadata
Assignees
Labels
flangFlang issues not falling into any other categoryFlang issues not falling into any other categoryquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!