Steps to replicate: Step 1: Fill your whole inventory except for 5 slots. Step 2: Place a stack of iron blocks in the crafting table. (There will now be 6 slots empty in your inventory.) Step 3: Hold shift and click to craft all. You will now get 6 stacks of iron ingots, and 21 iron blocks will remain. Start With: 64 iron blocks = 576 iron ingots. End With: 21 iron blocks = 189 iron ingots, 6 x 64 iron ingots = 384 iron ingots. Total 573 iron ingots. Expected result would be 22 blocks should remain and the 6th stack of ingots will not be completely full. Instead, 3 iron ingots completely vanish. It's possible to lose more items (up to 8 iron ingots) based on the rounding.
You probably had 6 slots left instead of 5. (7 after you removed the iron blocks.) The results are different based on how many slots you have left.