This occurs because protected subprograms are not translated directly into object code but first rewritten as a pair of subprograms by the front-end. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch9.adb (Build_Protected_Spec): Tidy up and propagate the Comes_From_Source flag onto the new formal parameters. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not check references for subprograms generated for protected subprograms.