AdaCore / gprbuild

GPRbuild is an advanced build system designed to help automate the construction of multi-language systems.
Other
65 stars 21 forks source link

Missing return statement(s) in Set_Default_Target? #121

Open dvraaij opened 1 year ago

dvraaij commented 1 year ago

While debugging some other problem, I noticed that exceptions are being raised from within Set_Default_Target in libgpr. After reading the code, I was left wondering whether some return statements are missing near line 58 and line 64 in gpr-sdefault.adb.

Near line 64 in particular, without the return statement, the execution of the procedure continues when file default_target is found not to be a regular file (so likely to be non-existing, although there might still be a symbolic link, I guess).

In my case, the file does not exists. This leads to an exception being raised from Ada.Text_IO.Open near line 67, which subsequently crashes the overall program as the traceback generator (invoked as part of the exception information inquiry in the exception handler) raises another exception; the problem I was actually looking into but is outside the scope of this ticket.

Note that my interpretation of the code might be wrong here. I'm not intimately familiar with the intend of the code, but I thought the observation might be of interest.