Bug 128195 - Invalid results from function calls
Summary: Invalid results from function calls
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: 2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Alexandre Oliva
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-07-19 22:12 UTC by Mark H Johnson
Modified: 2007-11-30 22:10 UTC (History)
0 users

Clone Of:
Last Closed: 2006-10-28 19:02:27 UTC

Attachments (Terms of Use)

Description Mark H Johnson 2004-07-19 22:12:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040124

Description of problem:
Attempts to call math functions from gdb produce invalid results. For

(gdb) print exp(-1.23)
$2 = 1

I can reproduce the problem on older Red Hat systems as well (e.g., RH

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create a test program

(a.c follows)
#include <stdio.h>
#include <math.h>

int main() {
  double x;

  x = exp(-1.23);
  printf("exp(-1.23) is %f\n", x);

2. Compile / link

gcc -g -lm -o a a.c

3. Run test
gdb a
(gdb) tbreak a.c:8
Breakpoint 1 at 0x80483ff: file a.c, line 8.
(gdb) run
main () at a.c:8
(gdb) print x
$1 = 0.29229257768085942
(gdb) print exp(-1.23)
$2 = 1
(gdb) print/f exp(-1.23)
$3 = 1.40129846e-45
(gdb) print x
$4 = 0.29229257768085942
(gdb) set x=exp(-1.24)
(gdb) print x
$5 = 1
(gdb) set variable x = exp(-1.24)
(gdb) print x
$6 = 1
(gdb) p/f x
$7 = 1
(gdb) print x=exp(-1.23)
$8 = 1
(gdb) whatis x
type = double

Actual Results:  See above.

Expected Results:  Value from print and assignment should have been
similar to that printed for the value of "x".

Additional info:

Comment 1 Andrew Cagney 2004-08-27 20:55:17 UTC
Please re-try with RHEL 3 U3 GDB when it becomes available.  double
and long double return values did not work on i386.   The new test
call-sc.exp covers this case.

Comment 2 John Thacker 2006-10-28 19:02:27 UTC
Note that FC1 and FC2 are no longer supported even by Fedora Legacy.  Please
install a still supported version and retest.  If this still occurs on FC3 or
FC4 and is a security issue, please reopen and assign to that version and Fedora
Legacy.  If it still occurs on FC5 or FC6, please reopen and assign to the
correct version.

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