This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16572] New: Wrong filename/line number were reported by g++ in inlining's warning messages
- From: "wirawan0 at softhome dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2004 18:16:35 -0000
- Subject: [Bug c++/16572] New: Wrong filename/line number were reported by g++ in inlining's warning messages
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
g++ reports wrong line numbers and/or filename when printing out inlining error
messages.
I suspect that these happen only on large C++ files (i.e. it may have to
do with the complication there), so I included in the attachments some
"real" files to reproduce the error messages. I also gave you the error
messages as printed on the screen. I use script(1) program to capture the
output. I am not sure if these errors can be reproduced only with small
testcases. (?) Sorry if this is inconvenient. Please read through this
error report first, before going to the files. They are like forest.
(These attachments belong to other bug report, actually. My editing below.)
Consider file inline-errors.txt, line 9-11 (reformatted here for clarity):
./src/cp.inc/Matrix.cpp: In function
`_ForwardIterator std::__uninitialized_fill_n_aux(_ForwardIterator,
_Size, const _Tp&, __false_type)
[with _ForwardIterator = QMCResults::QMC_Obs_type*, _Size = unsigned int,
_Tp = QMCResults::QMC_Obs_type]':
./src/cp.inc/Matrix.cpp:401: warning: inlining failed in call to
'Matrix<_number>::Matrix(const Matrix<_number>&)
[with _number = QMBS_Observables_QMCStats::value_type]':
--param large-function-growth limit reached while inlining the caller
./src/tbhqmc-results.cpp:412: warning: called from here
Looking at the real source file, line 412 of tbhqmc-results.cpp reads:
411: typedef Float scalar_type;
412: // Here are the key quantity server inquiries:
413: inline Float value(const value_type &val) const
414: // This is the point of all the fancy object: we let the grand avg
415: // be THE value. The value_alt() below is the average of the "block"
416: // measurements.
417: {
418: return fgrand_weight_sum != 0
419: ? val.grand_sum() / fgrand_weight_sum
420: : 0;
421: }
It's a comment line! File Matrix.cpp line 401 is correct, though.
In brief, ALL the line numbers pertaining tbhqmc-results.cpp reported in
the error messages are wrong. To see this, try grepping
`tbhqmc-results.cpp:' in inline-errors.txt. The following line
numbers are wrong: 194, 281, 286, 299, 312, 315, 412. Only line 978 may be
correct.
JUST to make sure that it's not a preprocessor error:
* I've checked the preprocessor line-numbering in the preprocessed file:
they are valid.
* I stripped ALL the `# line-num file-name' lines from the preprocessed
file and re-compiled. All the error messages showed up again. But now
the error location makes much more sense. Line 412 above, for example,
turns out to be line 9036 of the _stripped_ file, which contains the
vector<> class declaration:
9035: void
9036: resize(size_type __new_size) { resize(__new_size, value_type()); }
FYI, line 9036 of the stripped file corresponds to line 9615 of
tbhqmc-results.ii that I supplied you. There, you see that it in
turns corresponds to line 412 of file
"/usr/local/gcc-3.4.1/include/c++/3.4.1/bits/stl_vector.h"
So, the filename got screwed up somewhere in the compilation process!
REPRODUCING THE ERROR
Use the stock g++ 3.4.1. The following is the command that should give the
same output as in inline-errors.txt (except for header and footer lines
from script(1)):
g++ -Wall -Winline -fno-exceptions -O3 -finline-limit=8000 -c tbhqmc-results.ii
MISCELLANEI
This error was probably also there in version 3.3 and below. I remember
seeing some bogus line numbers in 3.3. But I don't have time to test it
right now.
--
Summary: Wrong filename/line number were reported by g++ in
inlining's warning messages
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wirawan0 at softhome dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16572