This test program demonstrates the combined result of two problems with Libgnat:
with Ada.Text_IO; use Ada.Text_IO; with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns; procedure Test_Spitbol_String_Slice is Str : String := "12"; P : Pattern := Str(2 .. 2) & Arb; begin Put_Line(Image(P)); if Image(P)(2) = '2' then Put_Line("PASSED"); else Put_Line("FAILED"); end if; end Test_Spitbol_String_Slice; $ gnatmake test_spitbol_string_slice && ./test_spitbol_string_slice gcc -c test_spitbol_string_slice.adb gnatbind -x test_spitbol_string_slice.ali gnatlink test_spitbol_string_slice.ali '1' & Arb FAILED The first problem is in g-spipat.adb line 3434: "Str (1)" should be "Str (Str'First)". The second problem is that no Constraint_Error is raised, because GNAT.Spitbol.Patterns has been compiled with all checks suppressed (-gnatp), which it apparently wasn't ready for. -- Summary: Libgnat: No Constraint_Error on out-of-bounds array access in GNAT.Spitbol.Patterns Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: listor3 dot rombobeorn at tdcpost dot se GCC build triplet: i386-redhat-linux GCC host triplet: i386-redhat-linux GCC target triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33110