- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm getting the following error using a 32-bit compiler suite on CentOS 5 (*AFTER* the code executes successfully):
forrtl: severe (174): SIGSEGV, segmentation fault occurred
The code in question is listed below:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PROGRAM test_code_1
IMPLICIT NONE
CHARACTER(LEN=117) :: cfgstrg
CHARACTER(LEN=150) :: argv0
call getarg(0,argv0)
call ccheck(argv0, 'test_code_1'//char(0), cfgstrg)
write(*,*) "TEST_CODE_1 CONTROL STRING:"
write(*,*) cfgstrg
end program
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Clearly, the culprit is this "ccheck" routine, which is about 300 lines of C code.
The weird thing, though, is this exact same code works fine on a 64-bit SUSE machine. I can also make the 32-bit code not segfault by including debugging symbols (-g) at compile time. What does this suggest for my 32-bit platform? An issue with libstdc++? Some other system-level library? Is there any way around this? I'd rather not compile this with debug flags.
Thanks,
Greg
I'm getting the following error using a 32-bit compiler suite on CentOS 5 (*AFTER* the code executes successfully):
forrtl: severe (174): SIGSEGV, segmentation fault occurred
The code in question is listed below:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PROGRAM test_code_1
IMPLICIT NONE
CHARACTER(LEN=117) :: cfgstrg
CHARACTER(LEN=150) :: argv0
call getarg(0,argv0)
call ccheck(argv0, 'test_code_1'//char(0), cfgstrg)
write(*,*) "TEST_CODE_1 CONTROL STRING:"
write(*,*) cfgstrg
end program
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Clearly, the culprit is this "ccheck" routine, which is about 300 lines of C code.
The weird thing, though, is this exact same code works fine on a 64-bit SUSE machine. I can also make the 32-bit code not segfault by including debugging symbols (-g) at compile time. What does this suggest for my 32-bit platform? An issue with libstdc++? Some other system-level library? Is there any way around this? I'd rather not compile this with debug flags.
Thanks,
Greg
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it's C code, libstdc++ shouldn't enter in. However, you may not have handled the 3 additional implicit string length arguments on the C side. As you have gone to the trouble of appending a null character to one of the strings, you might consider following through and using standard Fortran throughout (call get_command, iso_c_binding, interface block), so as to avoid non-portable legacy issues like the additional string length arguments.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page