Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 252 - Run time error
Summary: Run time error
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: libc
Version: 5.1
Hardware: i386
OS: Linux
high
medium
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1998-12-01 21:29 UTC by xshen
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1998-12-03 17:03:13 UTC


Attachments (Terms of Use)

Description xshen 1998-12-01 21:29:06 UTC
I use gcc and g++ to compile the following small code

#include <math.h>
main()
{
	double a[2];
	pow(2.0,3.0);
}

If I use -O2 option, and when I run the program
I get "segmentation fault(core dumped)". If I do
not use "-O2" option, I won't get any error. I also
upgrade gcc-2.7.2.3 to gcc-2.8.1 and I still get
same type error, but only when I change "double a[2]" into
"int a[2]".

Why does this happen?

BTW, I upgraded the libc and glib package ftped from
your web site.

Comment 1 xshen 1998-12-01 22:08:59 UTC
I tested this in a Pc with redhat 5.0, and no error.

Comment 2 xshen 1998-12-02 00:53:59 UTC
In /usr/include/__math.h:552, if I change this line into
long long int __p = (long int) __y,

then I won't get error. Is this the problem?

The original line is

long long int __p = (long long int) __y

Comment 3 David Lawrence 1998-12-03 17:03:59 UTC
Could not replicate this problem on a test machine.
Used gcc-2.7.2.3-14 rpm.

Comment 4 xshen 1998-12-03 17:34:59 UTC
Did you try to change "double a[2];" to "int a[2];"? Only one
of them will generate error by using gcc-2.7.2.3 with "-O2" option.

Thanks!


Note You need to log in before you can comment on or make changes to this bug.