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 long/float assignment to convenience variable


Hello,

One of our users just noticed the following regression:

    (gdb) print $xxx := 1
    $1 = void   <<<-----   Ooops!

The problem was that we were trying to force the right hand site
to have the same type as the left hand side, which in this case
didn't really have any...  The fix was to make sure that we don't
do that when the left hand side is a convenience variable.

The problem was introduced when I introduced the following code
to fix another problem:

      /* If evaluating an OP_DOUBLE and an EXPECT_TYPE was provided,
         then we need to perform the conversion manually, because
         evaluate_subexp_standard doesn't do it.  This conversion is
         necessary in Ada because the different kinds of float/fixed
         types in Ada have different representations.

         Similarly, we need to perform the conversion from OP_LONG
         ourselves.  */
      if ((op == OP_DOUBLE || op == OP_LONG) && expect_type != NULL)
        arg1 = ada_value_cast (expect_type, arg1, noside);

2008-05-09  Joel Brobecker  <brobecker@adacore.com>

        * ada-lang.c (ada_evaluate_subexp) [BINOP_ASSIGN]: Do not force
        the type of the right hand side of the assignment to the type
        of the left hand side if the left hand side is a convenience
        variable.

I've also added a new testcase:

2008-05-09  Joel Brobecker  <brobecker@adacore.com>

        * gdb.ada/assign_1.exp: New testcase.
    
Tested on x86-linux, no regression. Checked in.

-- 
Joel

Attachment: assign.diff
Description: Text document

Attachment: assign_1.exp
Description: Text document


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