From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,c64ec54f8fd278ce,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-05-05 12:22:22 PST Path: gmd.de!nntp.gmd.de!xlink.net!howland.reston.ans.net!pipex!lyra.csx.cam.ac.uk!mrc-lmb.cam.ac.uk!jkb From: jkb@mrc-lmb.cam.ac.uk (James Bonfield) Newsgroups: comp.unix.osf.osf1 Subject: DEC OSF/1 V2.0 - compiler bug? Date: 5 May 1994 16:56:59 GMT Organization: MRC Laboratory of Molecular Biology, Cambridge UK Distribution: world Message-ID: <2qb8gr$afh@lyra.csx.cam.ac.uk> NNTP-Posting-Host: al.mrc-lmb.cam.ac.uk Summary: casting float to int sometimes causes SIGFPE Keywords: DEC alpha OSF V2.0 compiler bug Hello, I've got the following snippet of code in one of my programs: { float www = 691.25; fputs("Before\n", stderr); fprintf(stderr, "%d\n", (int)www); fputs("After\n", stderr); } This produces the output: Before forrtl: error: floating underflow 691 After The error message is from Fortran trapping SIGFPE. The program contains Fortran code too and so links with the Fortran libraries. A standalone C program with the above code works fine. Also even the joing C-fortran program the signal isn't generated everywhere, just at this particular point in the code. I'm using cc; gcc doesn't have these problems. Now the question is, is there any conceivable memory corruption (ie a bug in our program) that could cause such an exception? It's most definitely the cast operator that seems to fail. Yet the correct answer is also produced even when generating a signal. Has anyone else observed this behaviour? Are the special flags I should compile and/or link with that may help resolve such behaviour? Cheers, James -- James Bonfield (jkb@mrc-lmb.cam.ac.uk) Tel: 0223 402499 Fax: 0223 412282 Medical Research Council - Laboratory of Molecular Biology, Hills Road, Cambridge, CB2 2QH, England.