[Bug c++/16572] [3.4 regression] Wrong filename/line number were reported by g++ in inlining's warning messages

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Oct 7 22:38:00 GMT 2004


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-10-07 22:38 -------
Confirmed. Here's a reduced testcase:

===========================================
inline void foo();

struct A
{
    static void bar() { foo(); }
};

void baz()
{
    A::bar();
}
===========================================

With 3.4.2 I get the following bogus error messgage:

  PR16572.cc: In function `void baz()':
  PR16572.cc:1: warning: inlining failed in call to 'void foo()': function body
not available
  PR16572.cc:5: warning: called from here
  In file included from PR16572.cc:10:
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  PR16572.cc:1: warning: inlining failed in call to 'void foo()': function body
not available
  PR16572.cc:5: warning: called from here
  PR16572.cc: At global scope:
  PR16572.cc:1: warning: inline function `void foo()' used but never defined

Hey, I didn't include anything! The bogus line numbers in the original
testcase just seem to be another symptom of the same problem. In addition
the warning is emitted twice.

The problem was fixed on mainline by Jan's patch
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00411.html
http://gcc.gnu.org/ml/gcc-cvs/2004-03/msg01308.html

Quote from the explanation of the patch:

! Inlining is currently performced twice - once in optimize_function in
! C++ frontend, later in cgraph_optimize_function in the backend.  This
! kills the first.  It is needed for my cgraph code changes where inlining
! must happent after original body has been saved.

I think this explains why we get the warning twice.

The problem is a regression from the 3.3 branch.

Jan, Mark, do you think this can be backported to the 3.4 branch?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot
                   |                            |com, hubicka at gcc dot gnu
                   |                            |dot org, reichelt at gcc dot
                   |                            |gnu dot org
           Severity|minor                       |normal
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
      Known to fail|                            |3.4.0 3.4.2
      Known to work|                            |3.3.5 4.0.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-07 22:38:36
               date|                            |
            Summary|Wrong filename/line number  |[3.4 regression] Wrong
                   |were reported by g++ in     |filename/line number were
                   |inlining's warning messages |reported by g++ in
                   |                            |inlining's warning messages
   Target Milestone|---                         |3.4.3


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



More information about the Gcc-bugs mailing list