------- Additional Comments From giovannibajo at libero dot it  2004-11-25 
00:20 -------
The problem appears to be the other way round. The C frontend mark the 
declaration as DECL_DECLARED_INLINE but not as DECL_INLINE because the body is 
not available. The relevant portion of code is this:


        else if (declspecs->inline_p)
          {
            /* Record that the function is declared `inline'.  */
            DECL_DECLARED_INLINE_P (decl) = 1;

            /* Do not mark bare declarations as DECL_INLINE.  Doing so
               in the presence of multiple declarations can result in
               the abstract origin pointing between the declarations,
               which will confuse dwarf2out.  */
            if (initialized)
              {
                DECL_INLINE (decl) = 1;
                if (storage_class == csc_extern)
                  current_extern_inline = 1;
              }


The C++ frontend instead does not have this issue: by default, all declarations 
marked by DECL_DECLARED_INLINE are also marked with DECL_INLINE. In fact, the 
testcase works even after my patch when compiled with cc1plus.

The code has been there since this patch: http://gcc.gnu.org/ml/gcc-cvs/2001-
12/msg00833.html. It fixed PR 5163. I tried removing the if(initialized) and 
always set DECL_INLINE even for functions with no bodies, and the testcase for 
the bug still succeeds. Maybe the weirdness in dwarf2out has been fixed since 
then.

RTH, do you think it makes sense to remove that check and set DECL_INLINE even 
for functions with no bodies in the C frontend? The C++ FE does that.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org,
                   |                            |stevenb at suse dot de


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

Reply via email to