https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123870
--- Comment #26 from Robin Dapp <rdapp at gcc dot gnu.org> --- (In reply to Ilya Kurdyukov from comment #15) > gcc-16 -O1 works, and the result is correct. So the problem is related to > some optimizations performed with -O2. > > $ bash run.sh -DRVV_PATH1=1 -DRVV_PATH2=1 -O1 > quantsmooth: 3.825ms > MD5(/dev/shm/output.jpg)= 3bd354cc91258b8c7f814cadf85437ef > -rw-rw-r-- 1 debian debian 4098 Jan 30 09:30 /dev/shm/output.jpg > quantsmooth: 3.855ms > MD5(/dev/shm/output.jpg)= 3bd354cc91258b8c7f814cadf85437ef > -rw-rw-r-- 1 debian debian 4098 Jan 30 09:30 /dev/shm/output.jpg > quantsmooth: 3.808ms > MD5(/dev/shm/output.jpg)= 3bd354cc91258b8c7f814cadf85437ef > -rw-rw-r-- 1 debian debian 4098 Jan 30 09:30 /dev/shm/output.jpg > > gcc-16 -O0 is also correct: > > $ bash run.sh -DRVV_PATH1=1 -DRVV_PATH2=1 -O0 > quantsmooth: 35.127ms > MD5(/dev/shm/output.jpg)= 3bd354cc91258b8c7f814cadf85437ef > -rw-rw-r-- 1 debian debian 4098 Jan 30 09:30 /dev/shm/output.jpg > quantsmooth: 35.086ms > MD5(/dev/shm/output.jpg)= 3bd354cc91258b8c7f814cadf85437ef > -rw-rw-r-- 1 debian debian 4098 Jan 30 09:30 /dev/shm/output.jpg > quantsmooth: 35.033ms > MD5(/dev/shm/output.jpg)= 3bd354cc91258b8c7f814cadf85437ef > -rw-rw-r-- 1 debian debian 4098 Jan 30 09:30 /dev/shm/output.jpg > > gcc-15 -O1 produces the binary that crashes when using -q6 (sed -i > 's/-q1/-q6/' run.sh). The binary produced with gcc-16 -O1 no longer crashes > when using -q6, gcc-16 has one less bug. Jeff kindly provided me Pioneer access and my results are different: rdapp@pioneer-1:~/work/pr123870$ ./run.sh -DRVV_PATH1=1 -DRVV_PATH2=1 -O1 quantsmooth: 1.119ms MD5(output.jpg)= 3bd354cc91258b8c7f814cadf85437ef -rw-rw-r-- 1 rdapp rdapp 4098 Feb 3 00:51 output.jpg quantsmooth: 1.119ms MD5(output.jpg)= 3bd354cc91258b8c7f814cadf85437ef -rw-rw-r-- 1 rdapp rdapp 4098 Feb 3 00:51 output.jpg quantsmooth: 1.210ms MD5(output.jpg)= 3bd354cc91258b8c7f814cadf85437ef -rw-rw-r-- 1 rdapp rdapp 4098 Feb 3 00:51 output.jpg rdapp@pioneer-1:~/work/pr123870$ ./run.sh -DRVV_PATH1=1 -DRVV_PATH2=1 -O2 quantsmooth: 0.940ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:52 output.jpg quantsmooth: 1.033ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:52 output.jpg quantsmooth: 0.939ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:52 output.jpg rdapp@pioneer-1:~/work/pr123870$ ./run.sh -DRVV_PATH1=1 -DRVV_PATH2=1 -O3 quantsmooth: 1.709ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:52 output.jpg quantsmooth: 1.726ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:52 output.jpg quantsmooth: 1.704ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:52 output.jpg rdapp@pioneer-1:~/work/pr123870$ ./run.sh -DRVV_PATH1=1 -DRVV_PATH2=1 -O1 -fschedule-insns quantsmooth: 0.935ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:53 output.jpg quantsmooth: 0.936ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:53 output.jpg quantsmooth: 1.015ms MD5(output.jpg)= faccc689fe1910dfd364f83dbf2649df -rw-rw-r-- 1 rdapp rdapp 4191 Feb 3 00:53 output.jpg I'm not seeing the wrong code or file hash but I'm also using a newer commit hash (6b2a3804758bb8e731ad18420cf79fd03cf280d9). Between your hash and mine there haven't been any vsetvl-related fixes. We have seen bugs like this go latent before. I'll re-test with your exact version.
