- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello,
Following program crashes on Linux/x86_64/intel fortran (also gfortran & NAG fortran)
program chk_trim CHARACTER*(30) TAB TAB='RSRDATA_AAAAAA\0' call shady(tab) !! 1st call does not seg fault !! as TAB string is on the stack call shady('RSRDATA_BBBBBB\0') !! this seg faults !! since string passed in argument !! is in non-writable memory region write(*,*) 'tab=',tab end program SUBROUTINE SHADY(TAB) CHARACTER*(16) TAB TAB = TRIM(TAB) !! -- CRASHES HERE -- write(*,*) '--## TAB=', TAB RETURN END
But surprisingly it does not crash on AIX xlf95 (PowerPC). Nevertheless, it looks like invalid Fortran code - is this right?
BR, Jan.
링크가 복사됨
1 응답
