There are heuristics for suppressing warnings about unused objects in trivial cases. In particular, we try to suppress warnings here: function F (A : Integer) return Some_Type; X : Some_Type; begin raise Not_Yet_Implemented; return X; end F; But it doesn't work if Some_Type is controlled. This patch fixes that bug. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Use First_Real_Statement to deal with this case. Note that First_Real_Statement is likely to be removed as part of this ticket, so this is a temporary fix.