Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#368 closed defect (fixed)

matreshka and gnat-gpl-2014

Reported by: Maxim Reznik Owned by:
Priority: major Milestone: 0.7.0
Component: Matreshka - League Version:
Keywords: gpl 2014 Cc:

Description

Some xml tests fails on gnat-gpl-2014.

Reproducer:

with League.Strings;

procedure Aaa is
   
   Lit  : constant Wide_Wide_String := "11" &
     Wide_Wide_Character'Val (16#8FFFF#) & "22";
     
   Text : League.Strings.Universal_String :=
     League.Strings.To_Universal_String (Lit);
begin
   Text.Replace (5, 5, "
");
   Text.Replace (4, 4, "
");
end Aaa;

It crash on linux x86_64:

gprbuild -j0 -O0 -P aaa.gpr
./aaa

*** Error in `./aaa': double free or corruption (fasttop): 0x0000000000607100 ***
...

raised PROGRAM_ERROR : aaa.adb:3 finalize/adjust raised exception

Valgrind error:

==24991== Invalid free() / delete / delete[] / realloc()
==24991==    at 0x4C2B37C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24991==    by 0x58BFB44: __gnat_free (in /home/max/local/gpl-2014/lib/gcc/x86_64-pc-linux-gnu/4.7.4/rts-native/adalib/libgnat-2014.so)
==24991==    by 0x51AD4CD: matreshka__internals__strings__dereference (matreshka-internals-strings.adb:211)
==24991==    by 0x513FEE4: league__strings__finalize__2 (league-strings.adb:837)
==24991==    by 0x404461: aaa___finalizer.2565 (in /tmp/aaa)
==24991==    by 0x404735: _ada_aaa (in /tmp/aaa)
==24991==    by 0x404EAA: main (in /tmp/aaa)
==24991==  Address 0x6686270 is 0 bytes inside a block of size 40 free'd
==24991==    at 0x4C2B37C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24991==    by 0x58BFB44: __gnat_free (in /home/max/local/gpl-2014/lib/gcc/x86_64-pc-linux-gnu/4.7.4/rts-native/adalib/libgnat-2014.so)
==24991==    by 0x511DA5B: matreshka__internals__strings__operations__replace (matreshka-internals-strings-operations.adb:338)
==24991==    by 0x5142E8E: league__strings__replace (league-strings.adb:1786)
==24991==    by 0x5142F43: league__strings__replace__2 (league-strings.adb:1799)
==24991==    by 0x404724: _ada_aaa (in /tmp/aaa)
==24991==    by 0x404EAA: main (in /tmp/aaa)

Change History (4)

comment:1 by Maxim Reznik, 6 years ago

Project file (aaa.gpr)

with "/home/max/cvs_root/matreshka/gnat/matreshka_league.gpr";
project Aaa is
   for Main use ("aaa");
end Aaa;

Program fails even when built with -O0

comment:2 by vadim.godunko, 6 years ago

In 4864:

Install workaround of bug in GNAT GPL 2014.

Refs #368.

comment:3 by vadim.godunko, 6 years ago

Component: MatreshkaMatreshka - League
Resolution: fixed
Status: newclosed

This is bug in GNAT GPL 2014 compiler, it deallocates object but doesn't reset member to null.

comment:4 by vadim.godunko, 6 years ago

In 4865:

Add automated test.

Refs #368.

Note: See TracTickets for help on using tickets.