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]

[RFA] Remove unexpected warning when printing empty array


This is to fix a small warning introduced after checking in this patch:

        http://sources.redhat.com/ml/gdb-patches/2005-10/msg00028.htm

This fixes two FAILs for a testcase I just submitted:

        http://sources.redhat.com/ml/gdb-patches/2005-10/msg00046.html

FAIL: gdb.ada/arrayidx.exp: print empty, indexes off
FAIL: gdb.ada/arrayidx.exp: print empty

The problem is that we were trying to get the lower bound of an
empty array. To do that, we called get_array_low_bound(), which
assumes that the array is not empty. So this routine determines
that there is something abnormal about the array, and returns
an error, causing us to then issue a warning to the user.

By shifting slightly the code a bit, we can avoid the warnings
in all situations.

2005-10-05  Joel Brobecker  <brobecker@adacore.com>

        * valprint.c (val_print_array_elements): Check array size before
        computing its low bound. If zero, then use a default bound of zero.

Tested on x86-linux, fixes the two FAILs above.
OK to apply?

Thanks,
-- 
Joel

Attachment: valprint.c.diff
Description: Text document


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