Issue 140903.1: DW_AT_default_value without default value?

Author: Paul Robinson
Champion: Paul Robinson
Date submitted: 2014-09-03
Date revised:
Date closed:
Type: Error
Status: Rejected
DWARF Version: 5
Section 4.1, pg 70
In DWARF 4, section 4.1 item 9 describes DW_AT_default_value in an odd way.  The third
and fourth sentences, plus the following non-normative text, say:
  
  If the attribute form is of class reference, the default value of the parameter is
  the value of the referenced variable (which may be constant) or the value returned
  by the referenced subroutine; a reference value of 0 means that no default value
  has been specified.  If the value is of class constant, that constant is interpreted
  as a default value of the type of the formal parameter.

  *For a constant form there is no way to express the absence of a default value.*

Seems to me, we should express the absence of a default value by omitting the attribute,
and not with this nonsense about "a reference value of 0" or this cautionary note about
how a constant form cannot express the absence of a default value. Omitting the attribute
would be the absolutely normal way to express that something isn't there, so it isn't
worth any special mention.

I'm also not clear about "the value returned by the referenced subroutine" given that
DW_AT_default_value really can't provide enough context to allow calling an arbitrary
source-program subroutine. Perhaps this was intended to refer to a DWARF procedure?
The "subroutine" usage goes back to DWARF 2, so I don't have any idea about that.

Proposed replacement text, keeping the subroutine bit intact for now (and not modifying
the first two sentences of item 9):

  If the attribute form is of class reference, the default value of the parameter is
  the value of the referenced variable, or the value returned by the referenced 
  subroutine.  If the value is of class constant, that constant is interpreted
  as a default value of the type of the formal parameter.

--
10/21/2014 -- Rejected.  See replacement issue 140917.1.