On 11/14/2014 09:11 PM, Gopalasubramanian, Ganesh wrote: > + const char * pftype[2][10] > + = { {"PLDL1STRM", "PLDL3KEEP", "PLDL2KEEP", "PLDL1KEEP"}, > + {"PSTL1STRM", "PSTL3KEEP", "PSTL2KEEP", "PSTL1KEEP"}, > + };
The array should be static const char * const pftype[2][4] I've no idea where you got that "10" from, espectially since... > + gcc_assert (IN_RANGE (locality, 0, 3)); ... you've constrained it right here. > + sprintf (pattern, "prfm\\t%s, %%a0", > + pftype[INTVAL(operands[1])][locality]); There's no point in the buffer or the sprintf. The text is short enough to repeat whole pattern in the array: static const char * const pftype[2][4] = { { "prfm\\tPLDL1STRM, %a0", ... }, { "prfm\\tPSTL1STRM, %a0", ... } }; ... return pftype[INTVAL(operands[1])][INTVAL(operands[2])]; r~