https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81087
Bug ID: 81087 Summary: ada: array index out of range in gnatlink, making test always false Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: nicolas.boulenguez at free dot fr Target Milestone: --- Created attachment 41549 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41549&action=edit introduce readable and fixed Starts_With boolean function. The procedure gnatlink assumes that the Linker_Options.Table contains access values to strings whose 'First index is always 1. This assumption is wrong for the string returned by function Base_Name. The wrong indices are not detected because gnatlink is compiled with -gnatp, but some test results are always wrong. For example, this program normally raises Constraint_Error, but prints "FALSE" if compiled with -gnatn. procedure A is G : constant String (3 .. 5) := "abc"; begin Ada.Text_IO.Put_Line (Boolean'Image (G (1 .. 2) = "ab")); end A; Please refer to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749574 for context.