[Bug c++/15369] "Wrong" line number for static constructor function

rth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Oct 15 07:39:00 GMT 2004


------- Additional Comments From rth at gcc dot gnu dot org  2004-10-15 07:39 -------
The bug here happens because once we start processing functions, input_location
changes effectively at random.  E.g. walk_tree sets input_location based on the
tree node that we're currently processing.  Which is, frankly, insane.

It also turns out to be remarkably difficult to get hold of the locus for the
end of file because c-lex and the c++ front end conspire to discard the locus
that the preprocessor helpfully collects for CPP_EOF.

I'll note that this has only "worked" by chance in previous versions and on 
mainline.  What line number we get for the static constructors depends on what
order we find ourselves processing the functions (inlined, not inlined, etc).
I.e. essentially random.  So it seems a streach to call this a 3.4 regression.

There appears to be no non-invasive solution for this for 3.4.  My personal
feeling is that some C++ lexer guy ought to fix this for mainline, and we 
should WONTFIX the problem for previous versions.  It's definitely non-critical
and there's a perfectly good workaround for users -- set breakpoints on
function names rather than line numbers.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
          Component|debug                       |c++
  GCC build triplet|i686-pc-linux               |
   GCC host triplet|i686-pc-linux               |
 GCC target triplet|i686-pc-linux               |
      Known to work|4.0 3.3.3                   |
   Last reconfirmed|2004-05-10 20:28:06         |2004-10-15 07:39:18
               date|                            |
            Summary|[3.4 Regression] Compiler   |"Wrong" line number for
                   |emits wrong linenumbers     |static constructor function
   Target Milestone|3.4.3                       |4.0.0


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



More information about the Gcc-bugs mailing list