vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
1.14k stars 136 forks source link

Compiler crashes with Print #151

Closed tueda closed 7 years ago

tueda commented 7 years ago

The compiler can crash with a Print statement when the module is complicated and long. The following is a simple example giving Valgrind errors:

#do i=1,200
  P "123456789012345678901234567890";
  P "%t";
#enddo
.end
FORM 4.1 (Nov 24 2016, v4.1-20131025-270-g6fe5632) 64-bits  Run: Fri Nov 25 18:03:23 2016

==30484== Invalid write of size 4
==30484==    at 0x428D9E: DoPrint (compcomm.c:1031)
==30484==    by 0x4292DC: CoPrint (compcomm.c:1142)
==30484==    by 0x43C3C1: CompileStatement (compiler.c:634)
==30484==    by 0x51D8DF: PreProcessor (pre.c:981)
==30484==    by 0x5850A5: main (startup.c:1597)
==30484==  Address 0x50aba70 is 0 bytes after a block of size 8,000 alloc'd
==30484==    at 0x4A06A2E: malloc (vg_replace_malloc.c:270)
==30484==    by 0x5AD90B: Malloc1 (tools.c:2236)
==30484==    by 0x444D7B: inicbufs (comtool.c:57)
==30484==    by 0x5835CB: StartVariables (startup.c:976)
==30484==    by 0x584F8B: main (startup.c:1541)
==30484== 
==30484== Invalid read of size 4
==30484==    at 0x445304: DoubleCbuffer (comtool.c:157)
==30484==    by 0x429FE1: AddComString (compcomm.c:1554)
==30484==    by 0x428B17: DoPrint (compcomm.c:985)
==30484==    by 0x4292DC: CoPrint (compcomm.c:1142)
==30484==    by 0x43C3C1: CompileStatement (compiler.c:634)
==30484==    by 0x51D8DF: PreProcessor (pre.c:981)
==30484==    by 0x5850A5: main (startup.c:1597)
==30484==  Address 0x50aba70 is 0 bytes after a block of size 8,000 alloc'd
==30484==    at 0x4A06A2E: malloc (vg_replace_malloc.c:270)
==30484==    by 0x5AD90B: Malloc1 (tools.c:2236)
==30484==    by 0x444D7B: inicbufs (comtool.c:57)
==30484==    by 0x5835CB: StartVariables (startup.c:976)
==30484==    by 0x584F8B: main (startup.c:1541)