Porting GCC to new target, branch implementation

Jim Wilson wilson@specifixinc.com
Tue Dec 16 01:59:00 GMT 2003


Savithri Venkatachalapathy wrote:
> L2: operands[0] = branch_op[0];
>     strcat(buffer,\" %0\");
> L3: operands[0] = xoperands[0];
>     strcat(buffer,\" %0\");
>     output_asm_insn (buffer, operands);

There is an obvious programming error here.  You are storing two 
different values into operands[0], so output_asm_insn can only see one 
of them them.  You need to use a different operand number for every 
different operand.  It is Ok for the output template to use more 
operands than there are in the pattern, as long as you don't use more 
than the maximum array size, but that is pretty unlikely.

Also, building strings in a fixed size buffer is a bad idea in general. 
  You should try to avoid doing this.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list