Bug 128195 - Invalid results from function calls
Invalid results from function calls
Product: Fedora
Classification: Fedora
Component: gdb (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Alexandre Oliva
Depends On:
  Show dependency treegraph
Reported: 2004-07-19 18:12 EDT by Mark H Johnson
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-10-28 15:02:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mark H Johnson 2004-07-19 18:12:39 EDT
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 16:55:17 EDT
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 15:02:27 EDT
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.