On 7 Mar 2017, at 16:20, Simon Wright wrote: > > On 19 Dec 2015, at 22:05, Simon Wright wrote: >> >> On 12 Nov 2015, at 10:02, Arnaud Charlet wrote: >>> >>>>> This situation arises, for example, with an embedded RTS that >>>>> incorporates the >>>>> Ada 2012 generalized container iterators. >>>> >>>> I should add, this PR is the ???other half??? of PR ada/66242, which is fixed >>>> in GCC 6; so please can it be reviewed? >>> >>> The proper patch for PR ada/66242 hasn't been committed yet (it's pending), >>> so I'd rather review the situation once PR ada/66242 is dealt with. >>> >>> I'm not convinced at all that your patch is the way to go, so I'd rather >>> consider it only after PR ada/66242 is solved properly. >> >> Looks as though PR ada/66242 has been sorted out. >> >> Since we can now *compile* code that is built with finalization enabled in a restricted runtime, but we can't *bind* it, could we take another look at this? the patch I provided in this thread still applies at snapshot 20151213 with minor offsets (8). > > Same problem exists in gcc version 7.0.1 20170302 (experimental) (GCC). and with gcc 8.0.0 20171102 (experimental) (r254339); and there's been no change to the affected file (bindgen.adb) since then. I've come up with a considerably simpler patch, which merely causes the procedure adafinal to be generated with a null body if the restriction No_Task_Termination is set (note, this restriction is part of the Ravenscar profile; if tasks can't terminate, program level finalization can't happen [ARM 10.2(25), "When the environment task completes (normally or abnormally), it waits for the termination of all such tasks, and then finalizes any remaining objects of the partition."] I've bootstrapped the compiler (x86_64-apple-darwin15), and "make check-ada" produces the same results with and without the patch (the same 3 FAILs occur in both, in gnat.sum). For the arm-eabi compiler, I successfully make and run builds for an STM32F4 target without exception propagation but with and without finalization. gcc/ada/Changelog: 2017-12-05 Simon Wright PR ada/66205 * bindgen.adb (Gen_AdaFinal): If the restriction No_Task_Termination is present, generate a null body.