* Re: What causes a Floating Poing Exception error?
2000-02-01 5:00 What causes a Floating Poing Exception error? Dr. Unk
@ 2000-02-01 5:00 ` Alex Rhomberg
2000-02-01 5:00 ` Tony Hammitt
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Alex Rhomberg @ 2000-02-01 5:00 UTC (permalink / raw)
[there does not seem to be a group comp.os.linux. development.system
also removed]
Dr. Unk wrote:
>
> I have a few questions that I need to know the answers too, or at least
> some insight. The questions are about Floating Point Exceptions
> errors. The reason that I ask these questions is that I compile the
> packages that I download, and if not all, most of them are coded,
> compiled and tested on PC's, not Alphas. Are FPE's the similar to
> Segmentation fault's?
They are similar in that they cause the program to dump core and abort
> 1. What causes FPE errors?
Using FP math that is not implemented on the Alpha. Like working with
denormalized numbers or Inf or NaNs.
> 2. What can be done to fix or prevent them, coding-wise?
Don't call that FP math. It should rarely be a problem to avoid them.
> 3. Same 2 questions but for Segmentation fault's.
Segfaults occur when you try to access some memory you're not allowed to
access. Often caused by a bad pointer, e.g. a null pointer. load the
core dump into the debugger and look at the pointer. It's often easy to
find the culprit.
> 4. Does it have anything to do with architecture dependent code or
> system libraries?
The segfaults can be caused by bad code that is architecture dependend
because it relies on pointers fitting into integers. This results in
compiler warnings and possible core dumps.
- Alex
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: What causes a Floating Poing Exception error?
2000-02-01 5:00 What causes a Floating Poing Exception error? Dr. Unk
2000-02-01 5:00 ` Alex Rhomberg
@ 2000-02-01 5:00 ` Tony Hammitt
2000-02-01 5:00 ` Robert Harley
2000-02-02 5:00 ` Brendan Murray
3 siblings, 0 replies; 6+ messages in thread
From: Tony Hammitt @ 2000-02-01 5:00 UTC (permalink / raw)
"Dr. Unk" wrote:
>
> I have a few questions that I need to know the answers too, or at least
> some insight. The questions are about Floating Point Exceptions
> errors. The reason that I ask these questions is that I compile the
> packages that I download, and if not all, most of them are coded,
> compiled and tested on PC's, not Alphas. Are FPE's the similar to
> Segmentation fault's?
>
> 1. What causes FPE errors?
> 2. What can be done to fix or prevent them, coding-wise?
> 3. Same 2 questions but for Segmentation fault's.
> 4. Does it have anything to do with architecture dependent code or
> system libraries?
>
> Thanks in advance.
>
> --
> Take two shots of vodka and call me in the morning.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
One of the most common causes of FPE errors is using uninitialized
memory within your program. Something like the following does not
initialize memory, so watch for these:
double *vector;
vector = (double *)malloc( 200 * sizeof( double ) );
Who know what was in the memory before the malloc used it?
FPE's can be architecture dependent, but it's rare since everyone
started using IEEE definitions for floating point types.
Just my $0.02, look at the other posts for further answers.
Regards,
Tony
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What causes a Floating Poing Exception error?
2000-02-01 5:00 What causes a Floating Poing Exception error? Dr. Unk
2000-02-01 5:00 ` Alex Rhomberg
2000-02-01 5:00 ` Tony Hammitt
@ 2000-02-01 5:00 ` Robert Harley
2000-02-02 5:00 ` Brendan Murray
3 siblings, 0 replies; 6+ messages in thread
From: Robert Harley @ 2000-02-01 5:00 UTC (permalink / raw)
Dr. Unk <dr_unk@hotmail.com> writes:
> 1. What causes FPE errors?
Operations such as division by 0.
> 2. What can be done to fix or prevent them, coding-wise?
Compile using the "-mieee" flag.
> 3. Same 2 questions but for Segmentation fault's.
Segfaults mean the program is broken. Report them to the author and
hope for the best.
> 4. Does it have anything to do with architecture dependent code or
> system libraries?
Pass.
Bye,
Rob.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What causes a Floating Poing Exception error?
2000-02-01 5:00 What causes a Floating Poing Exception error? Dr. Unk
` (2 preceding siblings ...)
2000-02-01 5:00 ` Robert Harley
@ 2000-02-02 5:00 ` Brendan Murray
2000-02-02 5:00 ` Brian V. Smith
3 siblings, 1 reply; 6+ messages in thread
From: Brendan Murray @ 2000-02-02 5:00 UTC (permalink / raw)
"Dr. Unk" <dr_unk@hotmail.com> wrote in message
news:876gcd$96v$1@nnrp1.deja.com...
> 4. Does it have anything to do with architecture dependent code or
> system libraries?
It can. If you're trying to access a 16-bit datum via a pointer that points
to an odd byte address on e.g. a SPARC, you'll get an alignment interrupt
which can, depending on the compiler switches, result in a segmentation
fault. Similarly, accessing a 32-bit entity on a non-four-bytye-aligned
address causes the same thing.
For 64-bit processors, this is much more likely. I notice you've posted this
to the alpha newsgroup, so this may be relevant. I've just finished porting
some code to Sparc Ultra and our code was sprinkled with just such
misaligned code, despite it being OK for 32-bit alignment. The problem is
that a long is now 64 bits, which screwed everything up.
On machines with Intel processors, this doesn't happen.
B=
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: What causes a Floating Poing Exception error?
2000-02-02 5:00 ` Brendan Murray
@ 2000-02-02 5:00 ` Brian V. Smith
0 siblings, 0 replies; 6+ messages in thread
From: Brian V. Smith @ 2000-02-02 5:00 UTC (permalink / raw)
In article <NxMl4.56597$zU5.767914@wbnws01.ne.mediaone.net>, "Brendan Murray" <bpmurray@nospam.mediaone.net> writes:
|>
|> "Dr. Unk" <dr_unk@hotmail.com> wrote in message
|> news:876gcd$96v$1@nnrp1.deja.com...
|> > 4. Does it have anything to do with architecture dependent code or
|> > system libraries?
|>
|> It can. If you're trying to access a 16-bit datum via a pointer that points
|> to an odd byte address on e.g. a SPARC, you'll get an alignment interrupt
|> which can, depending on the compiler switches, result in a segmentation
|> fault. Similarly, accessing a 32-bit entity on a non-four-bytye-aligned
|> address causes the same thing.
Unaligned accesses usually cause bus errors (SIGBUS), not segfaults.
--
--------------------------------------------------------
Brian V. Smith (bvsmith@lbl.gov) http://www-epb.lbl.gov/BVSmith
Lawrence Berkeley National Laboratory
I don't speak for LBL; they don't pay me enough for that.
Check out the xfig site at http://www-epb.lbl.gov/xfig
To the optimist, the glass is half full. To the pessimist, the
glass is half empty. To the engineer, the glass is twice as big
as it needs to be.
^ permalink raw reply [flat|nested] 6+ messages in thread