[Bug fortran/61831] [4.9/ 5 Regression] runtime error: pointer being freed was not allocated

mikael at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 25 15:26:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831

--- Comment #36 from Mikael Morin <mikael at gcc dot gnu.org> ---
>    [...]
>     (*(struct string_t[1] * restrict) atmp.7.data)[0] = prt_in;

prt_in.chars.data is copied to atmp.7.data[0].

>    [...]
>    while (1)
>      {
>        [...]
>        D.3430 = (*(struct string_t[1] * restrict) atmp.7.data)[S.10];

atmp.7.data[0].chars.data is copied to D.3430

>        [...]
>        if (D.3430.chars.data != 0B)
>          {
>            __builtin_free ((void *) D.3430.chars.data);
>          }
>        D.3430.chars.data = 0B;

D.3430.chars.data is freed.


So every iteration of the do loop has the side-effect of freeing
prt_in.chars.data.



More information about the Gcc-bugs mailing list