Hi,
when I tried to compile the plugin (against the FSF 4.8 and 4.7
branches), I encountered the following error:
compiling: /home/mjambor/gcc/48/inst/bin/gcc -fPIC -shared -flto -flto-partition=none -fno-diagnostics-show-caret -ftrack-macro-expansion=0 -o tests/examples/lto/output.o -fplugin=/home/mjambor/gcc/plg/python/python.so -fplugin-arg-python-script=tests/examples/lto/script.py -fsigned-char tests/examples/lto/input-main.c tests/examples/lto/input-g.c tests/examples/lto/input-f.c
Stdout:
Stderr:
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event | Plugins
PLUGIN_FINISH | python
lto1: internal compiler error: gimple check: expected gimple_phi(error_mark), have gimple_cond(ne_expr) in gcc_private_make_gimple_phi, at gcc-gimple.c:51
0x6ac733 gimple_check_failed(gimple_statement_d const*, char const*, int, char const*, gimple_code, tree_code)
/home/mjambor/gcc/48/src/gcc/gimple.c:1160
0x7fba9ee53acb gcc_private_make_gimple_phi
/home/mjambor/gcc/plg/python/gcc-c-api/gcc-gimple.c:51
0x7fba9ee53440 gcc_cfg_block_for_each_gimple_phi
/home/mjambor/gcc/plg/python/gcc-c-api/gcc-cfg.c:194
0x7fba9f855996 PyGccBasicBlock_get_phi_nodes(PyGccBasicBlock*, void*)
/home/mjambor/gcc/plg/python/gcc-python-cfg.c:151
0x7fba9f857ea2 impl_execute
/home/mjambor/gcc/plg/python/gcc-python-pass.c:132
it seems that there is a cut'n'paste error in
gcc_cfg_block_for_each_gimple_phi which should start iterate over phis
and not seq, where the "ordinary" statements reside. In any event, I
can get rid of that error (and make the examples/show-ssa.py example
work) by the following patch. Unless I got something wrong, it would
be great if someone could commit it to the upstream repo.
Thanks,
Martin
---
gcc-c-api/gcc-cfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc-c-api/gcc-cfg.c b/gcc-c-api/gcc-cfg.c
index a5bec45..2378ca3 100644
--- a/gcc-c-api/gcc-cfg.c
+++ b/gcc-c-api/gcc-cfg.c
@@ -186,7 +186,7 @@ gcc_cfg_block_for_each_gimple_phi (gcc_cfg_block block,
return false;
}
- for (gsi = gsi_start (info->seq);
+ for (gsi = gsi_start (info->phi_nodes);
!gsi_end_p (gsi); gsi_next (&gsi))
{
--
1.8.1.4