vermaseren / form

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

Calling "argtoextrasymbol" of a function containing "g5_" crashes #340

Closed mgerlach-phys closed 4 years ago

mgerlach-phys commented 4 years ago

The following code crashes on execution without further error message.

cf f, g;

l A = f( g(g5_(1)) );
l B = f( g5(1) );
l C = f( gi_(1) );

argtoextrasymbol f;

print +s; 
.end

In this example code only the case B crashes. i.e. no error occurs in A and C.

I already found a walkaround, though. Just replace g5_ by an other generic tensor.

ntensor g5;
index rho;

[...]

argument f;
    id g_(rho?,5_) = g5(rho);
endargument;

[...]
tueda commented 4 years ago

I confirmed that f(g5_(1)) leads to crashes. Here is a Valgrind dump:

Valgrind dump

``` ==119862== Memcheck, a memory error detector ==119862== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==119862== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info ==119862== Command: ./vorm test.frm ==119862== ==119862== Warning: set address range perms: large range [0xfc45040, 0x2d91b540) (undefined) ==119862== Warning: set address range perms: large range [0x2d91c040, 0x4b5f2540) (undefined) ==119862== Warning: set address range perms: large range [0x59eac040, 0x9e675bc0) (undefined) FORM 4.2.1 (Aug 28 2019, v4.2.1-5-g4057c65) 64-bits Run: Mon Dec 9 18:10:29 2019 CF f; L F = f(g5_(1)); argtoextrasymbol f; .end ==119862== Invalid read of size 4 ==119862== at 0x4DB990: DimensionSubterm (reshuf.c:942) ==119862== by 0x4DBA2E: DimensionTerm (reshuf.c:975) ==119862== by 0x4DBA85: DimensionExpression (reshuf.c:1006) ==119862== by 0x46764B: FindSubexpression (notation.c:1129) ==119862== by 0x409265: execarg (argument.c:612) ==119862== by 0x4C12FB: Generator (proces.c:3439) ==119862== by 0x4C1FFA: Generator (proces.c:3824) ==119862== by 0x4C2440: Generator (proces.c:3992) ==119862== by 0x4C39BF: Processor (proces.c:405) ==119862== by 0x43ACD9: DoExecute (execute.c:843) ==119862== by 0x4540B2: ExecModule (module.c:274) ==119862== by 0x4B9627: PreProcessor (pre.c:967) ==119862== Address 0x779570b64 is not stack'd, malloc'd or (recently) free'd ==119862== Program terminating at test.frm Line 3 --> ==119862== Invalid read of size 4 ==119862== at 0x50E22F: Crash (tools.c:3771) ==119862== by 0x4F3C3D: Terminate (startup.c:1721) ==119862== by 0x4F425F: onErrSig (startup.c:1489) ==119862== by 0x5C4230F: ??? (in /home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/lib/libc-2.23.so) ==119862== by 0x4DB98F: DimensionSubterm (reshuf.c:942) ==119862== by 0x4DBA2E: DimensionTerm (reshuf.c:975) ==119862== by 0x4DBA85: DimensionExpression (reshuf.c:1006) ==119862== by 0x46764B: FindSubexpression (notation.c:1129) ==119862== by 0x409265: execarg (argument.c:612) ==119862== by 0x4C12FB: Generator (proces.c:3439) ==119862== by 0x4C1FFA: Generator (proces.c:3824) ==119862== by 0x4C2440: Generator (proces.c:3992) ==119862== Address 0x0 is not stack'd, malloc'd or (recently) free'd ```