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]

TODO_rebuild_alias and -O0


Hello,

Consider the attached plug-in, which adds a new dummy pass after the
âssaâ pass, with âTODO_rebuild_aliasâ as its start flags:

#include <gcc-plugin.h>
#include <plugin-version.h>

#include <plugin.h>
#include <tree-pass.h>

int plugin_is_GPL_compatible;

static unsigned int
my_pass (void)
{
  return 0;
}

static struct opt_pass pass_dummy =
  {
    .type = GIMPLE_PASS,
    .name = "my_pass",
    .gate = NULL,
    .execute = my_pass,
    .todo_flags_start = TODO_rebuild_alias,
    .properties_required = PROP_ssa
    /* The rest is zeroed.  */
  };

int
plugin_init (struct plugin_name_args *plugin_info,
	     struct plugin_gcc_version *version)
{
  struct register_pass_info pass_info2 =
    {
      .pass = &pass_dummy,
      .reference_pass_name = "ssa",
      .ref_pass_instance_number = 1,
      .pos_op = PASS_POS_INSERT_AFTER
    };

  register_callback ("alias", PLUGIN_PASS_MANAGER_SETUP,
		     NULL, &pass_info2);

  return 0;
}

/*
   Local Variables:
   compile-command: "gcc -shared -fPIC -Wall -I`gcc -print-file-name=plugin`/include -o alias.so alias.c"
   End:
 */
When compiling with -O0 a non-trivial file with that plug-in, one ends
up with:

  numbers.c:8728:10: internal compiler error: in make_decl_rtl, at varasm.c:1163
  gcc: internal compiler error: Aborted (program cc1)

and a backtrace like this:

--8<---------------cut here---------------start------------->8---
#6  0x000000000056bfa4 in fancy_abort (file=<optimized out>, line=1163, 
    function=0xc2a3f5 "make_decl_rtl") at ../../gcc-4.6.2/gcc/diagnostic.c:893
#7  0x0000000000853bae in make_decl_rtl (decl=0x7f3cfd0458c0) at ../../gcc-4.6.2/gcc/varasm.c:1159
#8  0x00000000005bd485 in expand_expr_real_1 (exp=0x7f3cfd0458c0, target=<optimized out>, 
    tmode=VOIDmode, modifier=EXPAND_WRITE, alt_rtl=<optimized out>)
    at ../../gcc-4.6.2/gcc/expr.c:8462
#9  0x00000000005c83a8 in expand_expr (modifier=EXPAND_WRITE, mode=VOIDmode, target=0x0, 
    exp=0x7f3cfd0458c0) at ../../gcc-4.6.2/gcc/expr.h:422
#10 expand_assignment (nontemporal=0 '\000', from=0x7f3cfc967160, to=0x7f3cfd0458c0)
    at ../../gcc-4.6.2/gcc/expr.c:4422
#11 expand_assignment (to=0x7f3cfd0458c0, from=0x7f3cfc967160, nontemporal=0 '\000')
    at ../../gcc-4.6.2/gcc/expr.c:4119
#12 0x00000000005350c8 in expand_gimple_stmt_1 (stmt=0x7f3cfd046460)
    at ../../gcc-4.6.2/gcc/cfgexpand.c:1975
#13 expand_gimple_stmt (stmt=0x7f3cfd046460) at ../../gcc-4.6.2/gcc/cfgexpand.c:2084
#14 0x0000000000536218 in expand_gimple_basic_block (bb=0x7f3cfd047a90)
    at ../../gcc-4.6.2/gcc/cfgexpand.c:3626
#15 0x0000000000539bbe in gimple_expand_cfg () at ../../gcc-4.6.2/gcc/cfgexpand.c:4109
#16 0x000000000068b589 in execute_one_pass (pass=0x10a3dc0) at ../../gcc-4.6.2/gcc/passes.c:1556
#17 0x000000000068b835 in execute_pass_list (pass=0x10a3dc0) at ../../gcc-4.6.2/gcc/passes.c:1611
#18 0x0000000000757751 in tree_rest_of_compilation (fndecl=0x7f3cfdb03900)
    at ../../gcc-4.6.2/gcc/tree-optimize.c:422
#19 0x00000000008978cf in cgraph_expand_function (node=0x7f3cfd2c8420)
    at ../../gcc-4.6.2/gcc/cgraphunit.c:1576
#20 0x000000000089975e in cgraph_output_in_order () at ../../gcc-4.6.2/gcc/cgraphunit.c:1733
#21 cgraph_optimize () at ../../gcc-4.6.2/gcc/cgraphunit.c:1894
#22 0x000000000089992a in cgraph_finalize_compilation_unit ()
    at ../../gcc-4.6.2/gcc/cgraphunit.c:1096
#23 0x00000000004a3df5 in c_write_global_declarations () at ../../gcc-4.6.2/gcc/c-decl.c:9871
--8<---------------cut here---------------end--------------->8---

Thereâs no such problem when optimizations are turned on, though.

Does it mean that extra work is needed at -O0 before one can use alias info?

Thanks,
Ludoâ.

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