HMC5883L compass on GY801 module keeps reading one value

For that to work, "buffer" has to be allocated space, somewhere in valid read/write memory. Obviously, that wasn't done.

The code you posted is not even similar to the bildr example.