From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,bbabe699fb9ce159 X-Google-Attributes: gid111c93,public From: "J. Josh Feng" Subject: Re: Floating Point Exception Date: 1999/09/08 Message-ID: <37D68D2A.4EE43A28@percy.engr.wisc.edu>#1/1 X-Deja-AN: 522577866 Content-Transfer-Encoding: 7bit References: <37D51712.B72E6CFA@ijs.si> <37D5DA1B.7259C242@percy.engr.wisc.edu> <37D6008A.464F60FF@ijs.si> X-Accept-Language: en Content-Type: text/plain; charset=big5 Organization: University of Wisconsin, Madison Mime-Version: 1.0 Newsgroups: comp.os.linux.alpha On Wed, Sep 08, 1999 at 06:22:03AM +0000, Tone Kokalj wrote: > J. Josh Feng wrote: > > > Tone Kokalj wrote: > > > > > > Hi All ! > > > > > > Please, can somebody help me. > > > > > > I have the following problem. I have access to two Linux/Alphas > > > PC21164-P7. But I am not able to do something really useful with > > > them, since I got "Floating Point Exceptions" and the console report > > > something like: > > > > > > arithmetic trap at 0000000120090248: 11 0000000800000000 > > > > > > It is not that the applications I am running are bad, since they are > > > well established and runs on other platforms quite well. > > > > > > > I had this quite often. I assume you use GCC (egcs more precisely). My > > guess is that some > > variable in your program is used before a value is assigned to it. For > > example: > > First, thanks for the answer. But it is really not linked with GCC. I could > compile theprogram with FORTRAN90 on DEC Alpha with static linking the > libraries, which will > run 100% OK on DEC, but will FPE fail on Linux/GNU Alpha. > I think g77 will translate the Fortran program to a C program first and then uses gcc. > This morning I did a little of debugging. I found out that the program > (written in FORTRAN77 and compiled with g77) crashed while executing > FORMAT sentence. More precisely it crashed in > ../../../../libf2c/libI77/wref.c:211. And that is terrifying - to crash in > FORMAT. > Try this little fortran program real x, y write(*,*) x, y end It will give FPE. Now modify it to real x, y x = 0; y = 0; write(*,*) x, y end Then it runs ok. It seems that the I/O routine (wref.c) can not handle 'undefined' values (there must be some bits set in undefined variables before you assign any values to them such that those bits will confuse I/O routine). > The only "specialized" program that runs succeessfully is my own (written in > C), > since I wrote small FPE signal handler. But I would really omit this > FPE signal > handler in numerical programs, since I don't know what would be its impact > (maybe all obtained values will be meaningless). > I have this kind of concern also. So I don't use any signal handler in my programs, and if they run ok, then I have to assume or believe that everything works the way it should. Frankly, I don't really know the tech reason for FPE. I have tried to hack GCC compiler on Alpha, but it is just beyond my comprehension. -- J. Joshua Feng (O)608/262-3640 Electrical & Computer Engr., Univ. of Wisconsin - Madison http://www.cae.wisc.edu/~fengj fengj@percy.engr.wisc.edu