http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50055

             Bug #: 50055
           Summary: [PATCH] Location information for the throw()
                    specification in a function may be incorrect
    Classification: Unclassified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: siddhesh.poyare...@gmail.com


Created attachment 24990
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24990
Write EH_SPEC_BLOCK to the same line as its function

Problem Description:

The line number information for throw() exception specifier should be the same
as the function it is written against. For the following program:

struct mtcClass {
  mtcClass() throw(int)
  {
    throw(1);
  }
};

int main()
{
  try
  {
    mtcClass mtc;
  }
  catch(...)
  {
    return 42;
  }
}

gcov returns the following output after execution:

        -:    0:Source:mtc_bad.cpp
        -:    0:Graph:mtc_bad.gcno
        -:    0:Data:mtc_bad.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:struct mtcClass {
        1:    2:    mtcClass() throw(int) 
    #####:    3:    {
        1:    4:        throw(1);
        -:    5:    }
        -:    6:};
        -:    7:
        1:    8:int main()
        -:    9:{
        -:   10:    try {
        1:   11:        mtcClass mtc;
        -:   12:    }
        2:   13:    catch( ...) {
        1:   14:        return 42;
        -:   15:    }
    #####:   16:}


This happens during parsing where the EH_SPEC_BLOCK is written out with line
number as the one after the function decl. Attached patch modifies code to
write out the code for the throw() specification with the same line number as
the function.

Reply via email to