Bug 128195

Summary: Invalid results from function calls
Product: [Fedora] Fedora Reporter: Mark H Johnson <mark_h_johnson>
Component: gdbAssignee: Alexandre Oliva <aoliva>
Status: CLOSED INSUFFICIENT_DATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-10-28 19:02:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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
example:

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

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


Version-Release number of selected component (if applicable):
gdb-6.0post-0.20040223.19

How reproducible:
Always

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
(gdb) 


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.