The is probably a compiler optimization issue. Sometimes StatusBlockWrapper.Tag will evalute to 0 eventhough it's been updated in the background. Surpisingly declaring StatusBlockWrapper as volatile doesn't resolve the issue. I used the following hack just before the reference line of code to force the program to reread the value of StatusBlockWrapper.Tag.
https://github.com/PaulStoffregen/USBHost_t36/blob/69b90727a5b028699b47910aa5cd6a0823de5f69/MassStorageDriver.cpp#L429
The is probably a compiler optimization issue. Sometimes StatusBlockWrapper.Tag will evalute to 0 eventhough it's been updated in the background. Surpisingly declaring StatusBlockWrapper as volatile doesn't resolve the issue. I used the following hack just before the reference line of code to force the program to reread the value of StatusBlockWrapper.Tag.
char str[50]; sprintf(str, "%d", (int)StatusBlockWrapper.Tag);