nir/large_constants: more careful data copying
authorSergii Romantsov <sergii.romantsov@globallogic.com>
Thu, 12 Sep 2019 12:28:45 +0000 (15:28 +0300)
committerConnor Abbott <cwabbott0@gmail.com>
Mon, 16 Sep 2019 07:58:49 +0000 (07:58 +0000)
commitc7b2a2fd363f57bb1ab4d7d6bad786af7e2924ef
tree54161e7c559450fc621f3fe794a4a218b8ed039b
parent237e6f4fed2b78be0fae7991abbd496307c35a36
nir/large_constants: more careful data copying

A filed of nir_variable.location may be equel to -1.
That may cause copying to invalid address of list-node,
making some internal fields corrupted.

Patch fixes segfault during freeing context due to
corrupted address of ralloc_header.destructor.

v2: copy data if var is constant (Connor Abbott)

CC: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fixes: b6d475356846 (nir/large_constants: De-duplicate constants)
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111676
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/compiler/nir/nir_opt_large_constants.c