The code would correctly distinguish the entity from the selected
component case but not use the result of the analysis in the latter
case.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_attr.adb (Eval_Attribute): Fix oversight for Bit_Position.diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -7914,7 +7914,7 @@ package body Sem_Attr is
if Known_Static_Component_Bit_Offset (CE) then
Compile_Time_Known_Attribute
- (N, Component_Bit_Offset (Entity (P)));
+ (N, Component_Bit_Offset (CE));
else
Check_Expressions;
end if;