[ubsan] Move attribute specifier to fix build with gcc.