[Ada] Avoid building malformed component constraints

2022-01-06 Thread Pierre-Marie de Rodat via Gcc-patches
The previous fix introduced a not-yet-understood regression in compiling CodePeer. For now, we attempt a quick workaround for the problem. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Build_Discriminant_Reference): In the unexpected case where we pre

[Ada] Avoid building malformed component constraints

2022-01-06 Thread Pierre-Marie de Rodat via Gcc-patches
Given a discriminated type T1 with discriminant D1 having a component C1 of another discriminated type T2 with discriminant D2 and a propagated discriminant constraint (that is, "C1 : T2 (D2 => D1);" and, for example, a parameter of type T1, the compiler will sometimes build an anonymous subtype to