gdb.cp/templates.exp failures

Bug #615996 reported by Ulrich Weigand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GDB
Fix Released
Low
Ulrich Weigand

Bug Description

FAIL: gdb.cp/templates.exp: ptype T5<int>
FAIL: gdb.cp/templates.exp: ptype t5i

Further analysis required.

Tags: testsuite

Related branches

Revision history for this message
Yao Qi (yao-codesourcery) wrote :

[CodeSourcery #1713]

Changed in gdb-linaro:
status: New → Confirmed
Revision history for this message
Ulrich Weigand (uweigand) wrote :

This looks like a GCC issue. GDB wrongly shows a return type on class constructors:
    T5<int> * T5(int);
    T5<int> * T5(const T5<int> &);
which actually comes straight from DWARF debug information:

 <2><266>: Abbrev Number: 20 (DW_TAG_subprogram)
    <267> DW_AT_external : 1
    <268> DW_AT_name : T5
    <26b> DW_AT_decl_file : 1
    <26c> DW_AT_decl_line : 469
    <26e> DW_AT_type : <0x30d>
    <272> DW_AT_declaration : 1
    <273> DW_AT_sibling : <0x283>
 <3><277>: Abbrev Number: 9 (DW_TAG_formal_parameter)
    <278> DW_AT_type : <0x30d>
    <27c> DW_AT_artificial : 1
 <3><27d>: Abbrev Number: 10 (DW_TAG_formal_parameter)
    <27e> DW_AT_type : <0x29>

Note where the return type (at <26e>) is equal to the type of the "this" parameter (at <278>).

I don't quite understand why the same compiler version on Intel doesn't appear to have this problem; I'd have expected debug info generation problems to be platform-independent. More analysis on the GCC side is required ...

Changed in gdb-linaro:
importance: Undecided → Low
Revision history for this message
Ulrich Weigand (uweigand) wrote :

Further investigation shows that this is deliberate, and complies with the AAPCS ABI. To quote the "C++ ABI for the ARM Architecture":

GC++ABI §3.1.5 Constructor return values
This ABI requires C1 and C2 constructors to return this (instead of being void functions) so that a C3 constructor can tail call the C1 constructor and the C1 constructor can tail call C2.

GDB has a bug here anyway as constructors really ought to be shown without any return type:
http://sourceware.org/bugzilla/show_bug.cgi?id=8216
but the test case currently accepts a return type of "void" as KFAIL.

I think we should add a second KFAIL case accepting a pointer to the class type as return type and/or fix the underlying GDB problem.

Michael Hope (michaelh1)
tags: added: testsuite
Changed in gdb-linaro:
assignee: nobody → Ulrich Weigand (uweigand)
Revision history for this message
Ulrich Weigand (uweigand) wrote :

>I think we should add a second KFAIL case accepting a pointer
>to the class type as return type and/or fix the underlying GDB
>problem.

I've implemented the first solution (updating the KFAIL detection) for now. This gets ARM to the same state as other platforms: the output is wrong, but detected as known failure by the testsuite.

Changed in gdb-linaro:
status: Confirmed → Fix Committed
milestone: none → 7.2-2011.05-0
Michael Hope (michaelh1)
Changed in gdb-linaro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.