Bug#441104: g77-3.4: Code linked to libg2c segfaults on f_open(), g_char()
Package: g77-3.4
Version: 3.4.6-5
Severity: important
The following setup:
test.f:
subroutine test()
open(unit=1,file="/home/andrej/test",status='UNKNOWN')
close(unit=1)
end
go.c:
int main ()
{
test_();
return 0;
}
is compiled with:
f2c test.f
gcc -g test.c go.c -o test -lg2c -lm
Upon start it segfaults; this is gdb trace:
#0 0x00002b2ed99f1304 in g_char () from /usr/lib/libg2c.so.0
#1 0x00002b2ed99edcaa in f_open () from /usr/lib/libg2c.so.0
#2 0x0000000000400621 in test_ () at test.c:33
#3 0x000000000040065a in main () at go.c:3
Trying to compile with g77, with the additional snippet:
go.f:
program go
call test()
end
g77 go.f test.f -o test2
../test2
runs fine.
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages g77-3.4 depends on:
ii gcc-3.4 3.4.6-5 The GNU C compiler
ii gcc-3.4-base 3.4.6-5 The GNU Compiler Collection (base
ii libc6 2.3.6.ds1-13etch2 GNU C Library: Shared libraries
ii libg2c0-dev 1:3.4.6-5 GNU Fortran 77 library development
g77-3.4 recommends no packages.
-- no debconf information
Reply to: