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]

[commit/Ada] Fix assert failure when doing fixed point addition/substraction


Hello,

This is a bug for which I will unfortunately not be able to provide
a testcase as the testcase is derived from some code sent to us by
one of our customers.

A quick description: when doing a substraction or the addition of
two floats, like so:

   (gdb) print D.First - 1.0

The debugger sometimes reports a failed assertion:

   ../../src-public/gdb/valops.c:284: internal-error: value_cast: Assertion `code1 != TYPE_CODE_REF' failed.
   A problem internal to GDB has been detected,
   further debugging may prove unreliable.
   Quit this debugging session? (y or n) [answered Y; input not from terminal]
   ../../src-public/gdb/valops.c:284: internal-error: value_cast: Assertion `code1 != TYPE_CODE_REF' failed.
   A problem internal to GDB has been detected,
   further debugging may prove unreliable.
   Create a core file of GDB? (y or n)

The problem was indeed that we were trying to cast a value to a type
whose code was TYPE_CODE_REF, which of course makes no sense. The fix
was simply to find the underlying type.

2008-01-01  Joel Brobecker  <brobecker@adacore.com>

        * ada-lang.c (ada_evaluate_subexp, case BINOP_SUB): Add handling
        of the case where the first argument is a reference.
        (ada_evaluate_subexp, case BINOP_ADD): Likewise.

Tested on x86-linux. Fixes the problem above.
Checked in.

-- 
Joel

Attachment: sub_float.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]