[Bug libfortran/22106] New: Dynamically linking a C program with libgfortran produces a strange error

svrci at tbi dot univie dot ac dot at gcc-bugzilla@gcc.gnu.org
Fri Jun 17 18:05:00 GMT 2005


Test case:
#include <stdio.h>
int main()
        {
         printf("BLAH\n");
         return 0;
}
compiling the above prog. with "gcc blah.c -o blah" creates a working executable.
When compiling it with "gcc blah.c -o blah -lgfortran" (which should not change
anything (?)) the output can no longer be re-directed via pipe or wedge.
stracing the libgfortran linked executable shows
write(1, "uuuu\n", 5uuuu
)                   = 5
close(2)                                = 0
close(1)                                = 0
close(0)                                = 0
munmap(0x2aaaaaaac000, 4096)            = 0
exit_group(0)                           = ?
Maybe the close()es are to blame, since the executable not linked against
libgfortran.so doesn't contain the close() statements. 
The behavior was observed with vanilla-gcc4.0.0 as well as with the version
shipping with fedora core 4, in 32 an 64 bit mode.
doing a "gcc blah.c ${wherever}/libgfortran.a -o blah" does work.
Strange...
best regards
Andreas

-- 
           Summary: Dynamically linking a C program with libgfortran
                    produces a strange error
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: svrci at tbi dot univie dot ac dot at
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu (?)
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22106



More information about the Gcc-bugs mailing list