fix ctypes test alignment assumptions (closes #20946)

Patch by Andreas Schwab.