PR9972

Steven Bosscher steven@gcc.gnu.org
Sun Jan 11 21:42:00 GMT 2004


Hi,

This is really a bug in the Fortran front end that nobody seems to
understand.  I've looked at it for hours and decided I don't _want_
to understand.  What a mess.  What _seems_ to to happen, is that the
fortran equivalent of a static inline function is not being deferred,
but a symbol that is referenced by it is not written to the asm file.
So we get a link failure.

The orignally proposed fix for this bug was to kill flag_inline_trees
and flag_really_no_inline by introducing a langhook to tell if a lang
uses the RTL inliner or the tree inliner.  I have tried to get such
a patch to pass the test suite many times, but whatever I try, there
always is something that fails in some language which requires more
hacking than what I consider to be safe at this very late stage3 (not
to mention that this langhook wouldn't work for Java which uses both
inliners, *sigh*).  Besides, the RTL inliner is as good as dead on
the tree-ssa branch.

So for GCC 3.4, this seems like the least invasive/unreasonable fix.
I'm open for other suggestions, but a langhook is more invasive and
doesn't require much less runtime work.  Let's hope future GCC's will
not have the RTL inliner to worry about at all...

Bootstrapped and regtested on i686-pc-linux-gnu.  I now get zero
fortran fails:

Native configuration is i686-pc-linux-gnu

                === g77 tests ===


Running target unix

                === g77 Summary ===

# of expected passes            1800

OK for mainline?


Gr.
Steven

	PR fortran/9972
	* toplev.c (rest_of_handle_inlining): Also consider functions
	for deferral if the language is GNU F77.

testsuite:
	* 980520-1.x: Removed.

Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.862
diff -c -3 -p -r1.862 toplev.c
*** toplev.c	11 Jan 2004 10:22:29 -0000	1.862
--- toplev.c	11 Jan 2004 15:37:02 -0000
*************** rest_of_handle_inlining (tree decl)
*** 2678,2684 ****
  
    if (inlinable
        || (DECL_INLINE (decl)
! 	  && flag_inline_functions
  	  && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
  	       && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
  	       && ! flag_keep_inline_functions)
--- 2678,2690 ----
  
    if (inlinable
        || (DECL_INLINE (decl)
! 	  /* Egad.  This RTL deferral test conflicts with Fortran assumptions
! 	     for unreferenced symbols.  See g77.f-torture/execute/980520-1.f.
! 	     But removing this line from the check breaks all languages that
! 	     use the call graph to output symbols.  This hard-coded check is
! 	     the least invasive work-around.  */
! 	  && (flag_inline_functions
! 	      || strcmp (lang_hooks.name, "GNU F77") == 0)
  	  && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
  	       && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
  	       && ! flag_keep_inline_functions)



More information about the Gcc-patches mailing list