Attribute Valid_Scalars applied to prefix with an unchecked union component causes a legitimate crash in the backend. It was already rejected in the frontend for prefixes of a public type; now it is rejected in the frontend regardless of the type privacy. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Analyze_Attribute [Valid_Scalars]): Move check for unchecked union before checks for private and public types.