This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: FORTRAN PORTING: fd is corrupted
- From: vikram_sp <vikramforum at yahoo dot com>
- To: fortran at gcc dot gnu dot org
- Date: Mon, 6 Aug 2012 02:06:07 -0700 (PDT)
- Subject: Re: FORTRAN PORTING: fd is corrupted
- References: <33980421.post@talk.nabble.com> <CA+=Sn1m_8RewseHWCyg3JkukAHFtANOBe=qSM5_zMr_TBfLtOA@mail.gmail.com> <33985067.post@talk.nabble.com> <4FE46407.4070305@net-b.de>
Tobias Burnus wrote:
>
> On 06/09/2012 08:34 AM, vikram_sp wrote:
>> I digged down further and found that fd is calculated by call to
>> open64() which is corrupted. If i hard code the fd = 1, then program
>> works fine. It seams that start up code is not a problem. But i am
>> amazed that open64() is 64 bit version call while the machine is 32 bit.
>
> It uses open64 in order to support files larger than 2 GB, which is
> supported by many (32bit) operating systems. libgfortran presumably has
> a configure check to detect the availability of LFS.
>
> I have no idea what you are trying to achieve, but disabling the LFS
> might be one option. (Actually, in the current 4.8 version, I cannot
> find open64; I also do not see anything related to it in the ChangeLog.
> Basic LFS exists since 2004, which was before the 4.0 release.)
>
> As mentioned by Steve, you should consider to upgrade your 4.1. While
> later 4.1.x (x>=2) work somewhat well, a very large number of bugs has
> been fixed in the meanwhile. Officially supported are the releases of
> the last two years (4.5.x, 4.6.x and 4.7.x; 4.8 is the current
> development trunk). I think with 4.5, the I/O system saw some internal
> changes, though I do not know whether those would change the problems
> you are seeing.
>
>> Now i am using the normal procedure to create Fortran executable. I mean
>> i
>> am using glibc and normal statrup files.
>> Now i am getting sigfault at this point
>>
>> gcc-4.1.2/libgfortran/io/unix.c:1012
>> s->file_length = S_ISREG (statbuf.st_mode) ? statbuf.st_size : -1;
>
> Well, seemingly the line before fails:
> 1011 fstat (fd, &statbuf);
>
> Namely, fstat fails to obtain what it wants. I suspect that for some
> reasons the "fd" contains the wrong value.
>
>> can you tell, what exactly needs to be done in startup code?(like calling
>> initializers, etc).
>
> I don't know what exactly has to be done, but libgfortran uses
> __attribute__((constructor)) for some initialization
> (libgfortran/runtime/main.c). Thus, the init () function should be
> called otherwise there will be some problems. One part of init() is a
> call to init_units(). It might be that your own startup misses the call
> to init(). Using GCC's normal startup, the constructors/destructors are
> automatically called. If you don't do so, you will get in trouble with
> libgfortran (some variables aren't initialized) and also with may C++
> programs.
>
> Tobias
>
>
Thank Tobias.
I tried to disable LFS by commenting #define AC_SYS_LARGE in
gcc-4.1.2/libgfortran/configure.ac and recompiled. But i do not see any
difference. Call to open64 is still there.
Meantime I'm trying things suggested by you. It will be my pleasure to
listen more from you and all.
Vikram
-----
Vikram
--
View this message in context: http://old.nabble.com/FORTRAN-PORTING%3A-fd-is-corrupted-tp33980421p34260174.html
Sent from the gcc - fortran mailing list archive at Nabble.com.