summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.hp/gdb.defects/bs14602.exp
blob: 24b7537916a29ec8cd81a91d70b20102b196617c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# This file was written by Sue Kimura. (sue_kimura@hp.com)
#
# Test for CLLbs14602 -- problem with recognizing long double on 10.20.
#
# Source file: bs14602.c

if $tracelevel {
    strace $tracelevel
}

if { [skip_hp_tests] } { continue }

#
# test running programs
#
set prms_id 0
set bug_id 0


# set up appropriate compile option to recognize long double
set ansi_option ""
if [istarget "hppa*-*-*"] {
    set ansi_option "-Ae"
}

set testfile bs14602
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}

if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" executable "debug {additional_flags=${ansi_option}}"] != "" } {
    perror "Couldn't compile ${srcfile}"
    return -1
}


# Start with a fresh gdb.

gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile


# get to end of main so we can check out some stuff
if ![runto main] {
  perror "couldn't run to breakpoint main"
  continue
}

gdb_test "txbreak" \
    "Breakpoint $decimal at $hex: file .*bs14602.c, line 9." \
    "set breakpoint at end of main"

gdb_test "continue" \
    "Continuing.\r\n$hex in main* \\(\\) at .*bs14602.c:9\r\n.*" \
    "continue to end of main"

# test some simple things about long double
gdb_test "whatis v_long_double" \
    "type = long double" \
    "whatis v_long_double"

gdb_test "ptype v_long_double" \
    "type = long double" \
    "ptype v_long_double"

gdb_test "print sizeof \(long double\)" \
    " = 16" \
    "print sizeof long double"

gdb_test "print sizeof \(v_long_double\)" \
    " = 16" \
    "print sizeof v_long_double"

gdb_test "print v_long_double"  \
    " = 12345.67890000000079453457146883011" \
    "print v_long_double - 1" 

gdb_test "set variable v_long_double = 98765.43210" \
    "" \
    "set variable v_long_double to constant value"

gdb_test "print v_long_double" \
    " = 98765.43210000000544823706150054932" \
    "print v_long_double - 2" 

gdb_test "set variable v_double = v_long_double" \
    "" \
    " set variable v_double with v_long_double"

gdb_test "print v_double" \
    " = 98765.432100000005" \
    " print v_double"

#reset v_long_double
gdb_test "set variable v_long_double = 0" \
    "" \
    "reset v_long_double to 0"

gdb_test "print v_long_double" \
    " = 0" \
    "print v_long_double - 3"

gdb_test "set variable v_long_double = v_double" \
    "" \
    " set variable v_long_double with v_long_double"

gdb_test "print v_long_double" \
    " = 98765.43210000000544823706150054932" \
    "print v_long_double - 4 "