I didn't realize that we had a target with BITS_PER_UNIT == 8 && UNITS_PER_WORD == 1. I see that for the AVR POINTER_SIZE is 16, which suggests that this code should use POINTER_SIZE or GET_MODE_BITSIZE (Pmode) rather than BITS_PER_WORD. But restricting it to BITS_PER_WORD >= 32 should also be fine.
You may like to warn about "char a[40000];" in embedded code, so I like the GET_MODE_BITSIZE (Pmode) solution better. It's more self explanatory.
Paolo