Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory error for local $-variable in TFORM #253

Closed
tueda opened this issue Dec 13, 2017 · 3 comments
Closed

Memory error for local $-variable in TFORM #253

tueda opened this issue Dec 13, 2017 · 3 comments
Labels
bug Something isn't working

Comments

@tueda
Copy link
Collaborator

tueda commented Dec 13, 2017

The second bug of #250 can be reproduced by

#$x = 0;
ModuleOption local $x;
.end

Then valgrind tvorm -w2 test.frm gives

==25739== Memcheck, a memory error detector
==25739== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==25739== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==25739== Command: tvorm -w2 test.frm
==25739==
TFORM 4.2.0 (Dec 13 2017, v4.2.0-28-g4493f01) 64-bits 2 workers  Run: Wed Dec 13 18:29:05 2017
    #$x = 0;
    ModuleOption local $x;
==25739== Invalid read of size 4
==25739==    at 0x4533C0: DoModDollar (module.c:682)
==25739==    by 0x45373F: DoModLocal (module.c:605)
==25739==    by 0x4526E4: CoModuleOption (module.c:171)
==25739==    by 0x427C05: CompileStatement (compiler.c:634)
==25739==    by 0x4B887D: PreProcessor (pre.c:1045)
==25739==    by 0x4F52A6: main (startup.c:1607)
==25739==  Address 0x6536090 is 0 bytes after a block of size 96 alloc'd
==25739==    at 0x4C2AB96: malloc (vg_replace_malloc.c:299)
==25739==    by 0x50CBD6: Malloc1 (tools.c:2230)
==25739==    by 0x4EF922: EndSort (sort.c:741)
==25739==    by 0x4306FA: CatchDollar (dollar.c:117)
==25739==    by 0x4B88B5: PreProcessor (pre.c:1050)
==25739==    by 0x4F52A6: main (startup.c:1607)
==25739==
    .end
  0.04 sec + 0.00 sec: 0.05 sec out of 0.05 sec
==25739==
==25739== HEAP SUMMARY:
==25739==     in use at exit: 1,064,554,288 bytes in 217 blocks
==25739==   total heap usage: 750 allocs, 533 frees, 1,087,471,061 bytes allocated
==25739==
==25739== LEAK SUMMARY:
==25739==    definitely lost: 0 bytes in 0 blocks
==25739==    indirectly lost: 0 bytes in 0 blocks
==25739==      possibly lost: 0 bytes in 0 blocks
==25739==    still reachable: 1,064,554,288 bytes in 217 blocks
==25739==         suppressed: 0 bytes in 0 blocks
@tueda
Copy link
Collaborator Author

tueda commented Dec 13, 2017

git bisect claims a0b635c is the first bad commit.

@tueda
Copy link
Collaborator Author

tueda commented Dec 14, 2017

dollar->size was modified from 1 to 32

if ( newsize < 32 ) newsize = 32;

while the Valgrind message says that EndSort() allocated only 24 WORDs??

@tueda
Copy link
Collaborator Author

tueda commented Feb 5, 2019

Fixed by f1b83ae and 19a2da2 (introducing MINALLOC).

@tueda tueda closed this as completed Feb 5, 2019
@tueda tueda added the bug Something isn't working label Feb 5, 2019
tueda added a commit that referenced this issue Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant