https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92418
Bug ID: 92418
Summary: g++ does not produce the DW_AT_calling_convention
attribute for types
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: tankut.baris.aktemur at intel dot com
Target Milestone: ---
DWARF5 introduced the DW_AT_calling_convention attribute for *types*. Below is
the related section from the DWARF5 spec:
A structure type, union type or class type entry may have a
DW_AT_calling_convention attribute, whose value indicates whether a value
of the type is passed by reference or passed by value. The set of calling
convention codes for use with types is given in Table 5.5 following.
Table 5.5: Calling convention codes for types
DW_CC_normal
DW_CC_pass_by_value
DW_CC_pass_by_reference
GCC does not emit the DW_AT_calling_convention attribute for types. For
example, given the following C++ program, the DIE for the ByVal class could
include the 'DW_CC_pass_by_value' value in a DW_AT_calling_convention
attribute, whereas the type information for the ByRef class could include
'DW_CC_pass_by_reference'.
Tested with GCC 9.2.1.
~~~
class ByVal {
public:
ByVal () { x = 2; }
int x;
};
class ByRef {
public:
ByRef () { x = 2; }
ByRef (const ByRef &rhs) { x = 3; }
int x;
};
int
cbv1 (ByVal arg)
{
return arg.x;
}
int
cbv2 (ByRef arg)
{
return arg.x;
}
int
main ()
{
ByVal val;
ByRef ref;
return cbv1 (val) + cbv2 (ref);
}
~~~