public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50055] New: [PATCH] Location information for the throw() specification in a function may be incorrect
@ 2011-08-12 11:54 siddhesh.poyarekar at gmail dot com
  2011-08-12 12:36 ` [Bug c++/50055] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: siddhesh.poyarekar at gmail dot com @ 2011-08-12 11:54 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: siddhesh.poyarekar@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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/50055] [PATCH] Location information for the throw() specification in a function may be incorrect
  2011-08-12 11:54 [Bug c++/50055] New: [PATCH] Location information for the throw() specification in a function may be incorrect siddhesh.poyarekar at gmail dot com
@ 2011-08-12 12:36 ` paolo.carlini at oracle dot com
  2011-08-12 19:23 ` siddhesh.poyarekar at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-08-12 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-08-12 12:18:37 UTC ---
Patches go to the gcc-patches mailing list. Also, always clearly state how you
tested it, etc, according to the guidelines http://gcc.gnu.org/contribute.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/50055] [PATCH] Location information for the throw() specification in a function may be incorrect
  2011-08-12 11:54 [Bug c++/50055] New: [PATCH] Location information for the throw() specification in a function may be incorrect siddhesh.poyarekar at gmail dot com
  2011-08-12 12:36 ` [Bug c++/50055] " paolo.carlini at oracle dot com
@ 2011-08-12 19:23 ` siddhesh.poyarekar at gmail dot com
  2011-08-23 15:02 ` jason at gcc dot gnu.org
  2011-09-22 17:39 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: siddhesh.poyarekar at gmail dot com @ 2011-08-12 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Siddhesh Poyarekar <siddhesh.poyarekar at gmail dot com> 2011-08-12 19:21:15 UTC ---
Thanks, done, with a test case this time:

http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01158.html

As mentioned in the submission, I ran the existing c++ tests to make sure I did
not cause any regressions.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/50055] [PATCH] Location information for the throw() specification in a function may be incorrect
  2011-08-12 11:54 [Bug c++/50055] New: [PATCH] Location information for the throw() specification in a function may be incorrect siddhesh.poyarekar at gmail dot com
  2011-08-12 12:36 ` [Bug c++/50055] " paolo.carlini at oracle dot com
  2011-08-12 19:23 ` siddhesh.poyarekar at gmail dot com
@ 2011-08-23 15:02 ` jason at gcc dot gnu.org
  2011-09-22 17:39 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-23 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-23 14:56:55 UTC ---
Author: jason
Date: Tue Aug 23 14:56:48 2011
New Revision: 177990

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177990
Log:
    PR c++/50055
    * except.c (begin_eh_spec_block): Build EH_SPEC block on the
    same line as the function.

Added:
    trunk/gcc/testsuite/g++.dg/gcov/gcov-7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/except.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/50055] [PATCH] Location information for the throw() specification in a function may be incorrect
  2011-08-12 11:54 [Bug c++/50055] New: [PATCH] Location information for the throw() specification in a function may be incorrect siddhesh.poyarekar at gmail dot com
                   ` (2 preceding siblings ...)
  2011-08-23 15:02 ` jason at gcc dot gnu.org
@ 2011-09-22 17:39 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-22 17:39 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-22 17:27:58 UTC ---
Applied.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-22 17:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-12 11:54 [Bug c++/50055] New: [PATCH] Location information for the throw() specification in a function may be incorrect siddhesh.poyarekar at gmail dot com
2011-08-12 12:36 ` [Bug c++/50055] " paolo.carlini at oracle dot com
2011-08-12 19:23 ` siddhesh.poyarekar at gmail dot com
2011-08-23 15:02 ` jason at gcc dot gnu.org
2011-09-22 17:39 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).