This is the mail archive of the gdb-prs@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]

exp/2407: Incomplete type evaluated incorrectly


>Number:         2407
>Category:       exp
>Synopsis:       Incomplete type evaluated incorrectly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 17 17:58:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     oder@eleks.lviv.ua
>Release:        x86-6.5
>Organization:
>Environment:
QNX 6.3.0 SP3
>Description:
See the following output:
============================
(gdb) up
#12 0x080d50a4 in CSpaceJoint::SpaceBackgroundJob_ProcessJob (this=0x85b3090, uJobKind=2, pvJobContext=0x85b3168) at SpaceJoint.cpp:2196
2196                            jsJobState = ProcessBackgroundJob_TensionDistributionCalculation(*prsRopeStates, *pclCalcList, *pstLocation);
(gdb) p *pstLocation
$53 = {m_afStorage = {0, 0, -nan(0xffa6400000000)}}
(gdb) p pstLocation
$54 = (const CSpaceTriplet *) 0x85b3180
(gdb) p pstLocation[0]
Cannot perform pointer math on incomplete type "CSpaceTriplet", try casting to a known type, or void *.
(gdb) p {struct CSpaceTriplet}pstLocation
$55 = {m_afStorage = {4.3983228782807231, -18.653017099985771, -0.78775521581748287}}
(gdb) down
#11 0x080d4baf in CSpaceJoint::ProcessBackgroundJob_TensionDistributionCalculation (this=0x85b3090, rsRopeStates=@0x85b3168,
    clCalcList=@0x85b3174, stLocation=@0x85b3180) at SpaceJoint.cpp:2009
2009            bool bTensionDistributionResult = CalculateRope3DTensions(rsRopeStates, clCalcList, stLocation, rtRopeTensions, paiAbortIndicator);
(gdb) p stLocation
$56 = (const CSpaceTriplet &) @0x85b3180: {m_afStorage = {0, 0, -nan(0xff59400000000)}}
(gdb)
============================
GDB reports CSpaceTriplet as incomplete type. However if pointer to it is dereferenced, the value displayed is invalid (see stack frame #12). Similarly, if reference to value is evaluated, the value displayed is invalid (stack frame #11). Only if pointer is explicitly cast to {struct CSpaceTriplet} the content is displayed correctly.
If GDB believes the structure is not incomplete, it should not allow evaluation of "CSpaceTriplet &" and "*(CSpaceTriplet *)" expressions, similarly as it does not allow evaluation of "(CSpaceTriplet *)[0]".
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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