Add extra RTX code

Jens Vankeirsbilck
Fri Dec 11 15:29:00 GMT 2015

Hi all

I'm trying to create a gcc plugin to be run with the arm-none-eabi-gcc. Basically, the plugin has to add some extra code to each basic block in the CFG and this while the CFG is in RTL.
The problem is: when I run my plugin arm-none-eabi-g++ crashes on a SegmentationFault and I have no idea why.

The code that ads extra RTX code to the basic block:
	Rtx Class::Method(int id, rtx prev, rtx next, basic_block bb){
		Rtx regSig = gen_rtx_REG(SImode, regForSig);
		Rtx constInt = gen_rtx_CONST_INT(VOIDmode, 1);
		Rtx andOp = gen_rtx_AND(SImode, regSig, constIn);
		Rtx set = gen_rtx_SET(VOIDmode, regSig, andOp);
		Rtx insn = gen_rtx_INSN(VOIDmode, id, prev, next, bb, set, XINT(next,5), CODE_FOR_addsi3, NULL);
		Add_insn_after(insn, prev, bb);
		Return insn;

The code compiles fine, even the RTX looks fine when I print if with print_rtl_simple()
Yet, when I run the plugin with arm-none-eabi-g++, g++ crashes on a SegmentationFault...

When I run g++ with -wrapper gdb,--args, gdb returns something like
... caught SIGSEGV while in ?? ()

So gdb isn't any help either.

Hopefully you can help me.

Met vriendelijke groet,
Ing. Jens Vankeirsbilck

More information about the Gcc-help mailing list