Checks for the first character in Switches being an '*'
did not include guards against an empty string in all locations.
gcc/ada/ChangeLog:
* libgnat/g-comlin.adb (Getopt): Check if Switches
are empty before looking at the first element.
-- isn't the parameter to a previous switch, since that has
-- already been handled.
- if Switches (Switches'First) = '*' then
+ if Switches /= "" and then Switches (Switches'First) = '*' then
Set_Parameter
(Parser.The_Switch,
Arg_Num => Parser.Current_Argument,
-- If Concatenate is False and the full argument is not
-- recognized as a switch, this is an invalid switch.
- if Switches (Switches'First) = '*' then
+ if Switches /= "" and then Switches (Switches'First) = '*'
+ then
Set_Parameter
(Parser.The_Switch,
Arg_Num => Parser.Current_Argument,