This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Anybody have any idea about why local_decls would go missing?


This is at LTO time and the function in question is this:

#include "stdlib.h"
typedef struct bogus type_ta;

struct bogus {
  int i;
  double x;
  int j;
};

void
helper( void *x)
{
  type_ta *y = (type_ta*)x;
  y->i =  rand();
}

and I'm checking the local_decls it like this:

  cgraph_node* node;
  FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node)
  {
    tree decl;
    unsigned i;

    node->get_untransformed_body ();

    struct function *fn = DECL_STRUCT_FUNCTION ( node->decl);
    DEBUG( "L# %d, fuction name = %s\n", __LINE__, lang_hooks.decl_printable_name ( node->decl, 2));
    if( fn == NULL )
    {
      DEBUG( "  EMPTY\n");
      continue;
    }

    FOR_EACH_LOCAL_DECL ( fn, i, decl)
    {
      tree base = base_type_of ( decl);
      DEBUG( "L# %d Consider local var decl\n", __LINE__);
      .
      .

Needless to sat I get the function name "helper" but no variables.
I suspected the LTO streaming process but that seems bullet proof
and if local_decls are there when streaming out it should be restored when
streaming in. I also suspected inlining but it still happened with
"-fno-inline" present.

If you'll note the get_untransformed_body call above (which David Malcolm
suggested to cure a NULL fn) I suspect I'm lacking some other call
which will make all things right.

Thanks,

Gary Oblock




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]