flattening: Fix intermediate result bug
flattening: Fix intermediate result bug

diku-dk/futhark,mrakgr/futhark,diku-dk/futhark,diku-dk/futhark,diku-dk/futhark,ihc/futhark,ihc/futhark,HIPERFIT/futhark,mrakgr/futhark,HIPERFIT/futhark,mrakgr/futhark,CulpaBS/wbBach,HIPERFIT/futhark,ihc/futhark,diku-dk/futhark