public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24539]  New: inconsistent handling of null-valued language hooks in GCC
@ 2005-10-26 14:28 gary at intrepid dot com
  2005-10-26 14:39 ` [Bug c/24539] " gary at intrepid dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: gary at intrepid dot com @ 2005-10-26 14:28 UTC (permalink / raw)
  To: gcc-bugs

Also posted to the GCC mailing list:
http://gcc.gnu.org/ml/gcc/2005-10/msg00932.html
http://gcc.gnu.org/ml/gcc/2005-10/msg00938.html

While working with GCC's language hooks, we found that
certain places in GCC test for a null value of
lang_hooks.callgraph.expand_function, but
cgraph_expand_function() calls the hook directly:


In cgraphunit.c:

/* Expand function specified by NODE.  */

static void
cgraph_expand_function (struct cgraph_node *node)
{
  tree decl = node->decl;

  /* We ought to not compile any inline clones.  */
  gcc_assert (!node->global.inlined_to);

  if (flag_unit_at_a_time)
    announce_function (decl);

  cgraph_lower_function (node);

  /* Generate RTL for the body of DECL.  */
  lang_hooks.callgraph.expand_function (decl);
------------

In toplev.c:


  /* Disable unit-at-a-time mode for frontends not supporting callgraph
     interface.  */
  if (flag_unit_at_a_time && ! lang_hooks.callgraph.expand_function)
    flag_unit_at_a_time = 0;
------------

In function.c:


  /* Possibly warn about unused parameters.
     When frontend does unit-at-a-time, the warning is already
     issued at finalization time.  */
  if (warn_unused_parameter
      && !lang_hooks.callgraph.expand_function)
    do_warn_unused_parameter (current_function_decl);
------------

We tried setting lang_hooks.callgraph.expand_function to NULL:

/* For now, disable unit-at-a-time by setting expand_function to NULL */
#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION NULL

which has the desired effect of disabling unit-at-a-time, but
runs aground in cgraph_expand_function() with a segfault,
when it attempts to call lang_hooks.callgraph.expand_function().

It seems that GCC is handling lang_hooks.callgraph.expand_function
in an inconsistent fashion.  Is a null value for expand_function
meaningful?  If it is, then what is the fix for cgraph_expand_function()?

----

In a follow-up note on the GCC list, Dueway Qi notes:

I have found another similar case.
lang_hooks.callgraph.analyze_expr  in  gcc/gcc/cgraphunit.c
    490           if (lang_hooks.callgraph.analyze_expr)
    491             return lang_hooks.callgraph.analyze_expr (tp,
walk_subtrees,
    492                                                       data);
but in another part of this file
    517       if ((unsigned int) TREE_CODE (t) >= LAST_AND_UNUSED_TREE_CODE)
    518         return lang_hooks.callgraph.analyze_expr (tp,
walk_subtrees, data);


-- 
           Summary: inconsistent handling of null-valued language hooks in
                    GCC
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gary at intrepid dot com


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/24539] inconsistent handling of null-valued language hooks in GCC
  2005-10-26 14:28 [Bug c/24539] New: inconsistent handling of null-valued language hooks in GCC gary at intrepid dot com
@ 2005-10-26 14:39 ` gary at intrepid dot com
  2005-10-26 15:54 ` [Bug middle-end/24539] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: gary at intrepid dot com @ 2005-10-26 14:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from gary at intrepid dot com  2005-10-26 14:39 -------
*** Bug 24540 has been marked as a duplicate of this bug. ***


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/24539] inconsistent handling of null-valued language hooks in GCC
  2005-10-26 14:28 [Bug c/24539] New: inconsistent handling of null-valued language hooks in GCC gary at intrepid dot com
  2005-10-26 14:39 ` [Bug c/24539] " gary at intrepid dot com
@ 2005-10-26 15:54 ` pinskia at gcc dot gnu dot org
  2005-10-26 16:07 ` gary at intrepid dot com
  2005-10-26 16:09 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-26 15:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-10-26 15:54 -------
I think analyze_expr should be removed as by the time we get there, we are
always in gimple.

As for expand_function, we really should have a default one now as almost no
language does not support unit at a time.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/24539] inconsistent handling of null-valued language hooks in GCC
  2005-10-26 14:28 [Bug c/24539] New: inconsistent handling of null-valued language hooks in GCC gary at intrepid dot com
  2005-10-26 14:39 ` [Bug c/24539] " gary at intrepid dot com
  2005-10-26 15:54 ` [Bug middle-end/24539] " pinskia at gcc dot gnu dot org
@ 2005-10-26 16:07 ` gary at intrepid dot com
  2005-10-26 16:09 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: gary at intrepid dot com @ 2005-10-26 16:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gary at intrepid dot com  2005-10-26 16:07 -------
All/most GCC-supplied dialects may support unit-at-a-time, however,
the dialect we're working on (UPC) does not at present support
unit-at-a-time.

For now, we're de-asserting flag_unit_at_a_time in the language
specific post_options routine.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/24539] inconsistent handling of null-valued language hooks in GCC
  2005-10-26 14:28 [Bug c/24539] New: inconsistent handling of null-valued language hooks in GCC gary at intrepid dot com
                   ` (2 preceding siblings ...)
  2005-10-26 16:07 ` gary at intrepid dot com
@ 2005-10-26 16:09 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-26 16:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-10-26 16:09 -------
(In reply to comment #3)
> For now, we're de-asserting flag_unit_at_a_time in the language
> specific post_options routine.

You should note that non unit-at-a-time will be removed in the future so you
may as well just do unit at a time to start with.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/24539] inconsistent handling of null-valued language hooks in GCC
       [not found] <bug-24539-4@http.gcc.gnu.org/bugzilla/>
@ 2011-12-22  1:16 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-22  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX
   Target Milestone|---                         |4.5.0

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-22 01:13:10 UTC ---
2007-09-12  Jan Hubicka  <jh@suse.cz>

        * c-objc-common.h (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
2007-09-11  Jan Hubicka <jh@suse.cz>

        * toplev.c (process_options): all frontends now do unit-at-a-time.
        * cgraphunit.c: update comments.
        (cgraph_expand_function): call passmanager dirrectly; emit thunks.
        * c-decl.c (finish_function): use cgraph_add_new_function.
        * function.c (expand_function_end): We are always unit-at-a-time.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-12-22  1:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-26 14:28 [Bug c/24539] New: inconsistent handling of null-valued language hooks in GCC gary at intrepid dot com
2005-10-26 14:39 ` [Bug c/24539] " gary at intrepid dot com
2005-10-26 15:54 ` [Bug middle-end/24539] " pinskia at gcc dot gnu dot org
2005-10-26 16:07 ` gary at intrepid dot com
2005-10-26 16:09 ` pinskia at gcc dot gnu dot org
     [not found] <bug-24539-4@http.gcc.gnu.org/bugzilla/>
2011-12-22  1:16 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).