Ada: Fix assertion failure in entry barrier with object notation calls
Prevents an assertion failure when calling a subprogram using object notation within an Ada entry barrier.
This commit resolves an assertion failure that occurred when a subprogram was called using object notation within an Ada entry barrier. The issue arose because the Original_Record_Component field was accessed without verifying its existence, leading to the assertion failure. By adding a check to ensure the field is valid before accessing it, this commit prevents the failure and improves the stability of the compiler.
In Details
The Ada compiler performs various semantic checks to ensure code correctness. This commit addresses an issue in sem_util.adb within the Statically_Names_Object function. The code now checks whether the selector is a component or discriminant before accessing Original_Record_Component. This prevents an assertion failure when the selector is neither, specifically in the context of calls in object notation within an entry barrier.
For Context
Entry barriers in Ada control access to protected objects, ensuring that operations are performed safely and consistently. This commit fixes a bug in the Ada compiler that caused an assertion failure when calling a subprogram using a specific syntax (object notation) within an entry barrier. The fix involves adding a check to ensure the code correctly handles different types of selectors, preventing the assertion and improving the compiler's robustness.