This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
This patch fixes a problem when comparing a fixed-point variable
with a litteral value (either a float or an integer). For instance:
procedure Fixed is
type Fixed_Point_Type is delta 0.001 range 0.0 .. 1000.0;
My_Var : Fixed_Point_Type := 14.0;
begin
Do_Nothing (My_Var'Address); -- STOP
end Fixed;
The code above is part of the testcase that I am checking in
with this patch. Stop at "Do_Nothing", and do the following:
(gdb) p my_var
$1 = 14
(gdb) p my_var > 10
$2 = true
(gdb) p my_var > 20
!!! -> $3 = true
(gdb) p my_var > 20.0
!!! -> $4 = true
The expected output is:
(gdb) p my_var > 20
$3 = false
(gdb) p my_var > 20.0
$4 = false
The problem boils down to us comparing apples and oranges...
Fixed thusly:
2007-12-27 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_value_cast): New function, extracted out from
the code in ada_evaluate_subexp, case UNOP_CAST. The code handling
the obscure case has been removed as we think that it is actually
unnecessary.
(ada_evaluate_subexp): Add type case when evaluating an OP_DOUBLE
or an OP_LONG with a non-null expect_type. Replace extracted-out
code with call to new ada_value_cast function.
Tested on x86-linux. Checked in.
I also committed the following simple testcase for it:
2007-12-27 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/fixed_cmp/pck.ads, gdb.ada/fixed_cmp/pck.adb,
gdb.ada/fixed_cmp/fixed.adb: New files.
* gdb.ada/fixed_cmp.exp: New testcase.
Also tested on x86-linux.
--
Joel
Attachment:
fixed-cmp.diff
Description: Text document
Attachment:
pck.adb
Description: Text document
Attachment:
pck.ads
Description: Text document
Attachment:
fixed.adb
Description: Text document
Attachment:
fixed_cmp.exp
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |