GBE: Fix a bug in encoding MATH instruction
authorRuiling Song <ruiling.song@intel.com>
Mon, 24 Jun 2013 02:53:57 +0000 (10:53 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Mon, 24 Jun 2013 07:08:05 +0000 (15:08 +0800)
commitaf9f4d9891c34c8250330b360d9bbbf309b39f07
tree0e1f985bedd0bbcd33d965ad0237ae945cb6864a
parent69e7aa7d200b7973275e42260ad5a60fdeca2898
GBE: Fix a bug in encoding MATH instruction

For std::vector, a push_back may cause memory relocation if no enough
memory in the vector pool. And iterator or pointer got previously will
become invalid after relocation.

Here in GenEncoder::next(), which will call push_back(), memory
relocation may occur. Then relocation will make 'insn' point to
invalid memory that does not belong to GenEncoder::store anymore.
Then, the setting of execution_width will fail.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/backend/gen_encoder.cpp