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

Misaligned WORD when MaxTermSize is odd #255

Open tueda opened 6 years ago

tueda commented 6 years ago

Probably no one uses odd numbers for MaxTermSize in practice and it may be not fatal on x86, but for the following code:

#:maxtermsize 201
S x;
L F = x;
id x = 1;
.end

the sanitizer gives

$ ./vorm test.frm
FORM 4.2.0 (Dec 15 2017, v4.2.0-29-g26793e4) 64-bits  Run: Fri Dec 22 11:45:42 2017
    #:maxtermsize 201
    S x;
    L F = x;
    id x = 1;
    .end
pattern.c:680:12: runtime error: store to misaligned address 0x7f5a73f68cde for type 'WORD', which requires 4 byte alignment
0x7f5a73f68cde: note: pointer points here
 be be be be be be  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be
             ^
pattern.c:1142:3: runtime error: store to misaligned address 0x7f5a73f68cde for type 'WORD', which requires 4 byte alignment
0x7f5a73f68cde: note: pointer points here
 be be be be 01 00  00 00 be be be be be be  be be be be be be be be  be be be be be be be be  be be
             ^
pattern.c:1147:2: runtime error: store to misaligned address 0x7f5a73f68cf2 for type 'WORD', which requires 4 byte alignment
0x7f5a73f68cf2: note: pointer points here
 00 00  00 00 be be be be be be  be be be be be be be be  be be be be be be be be  be be be be be be
              ^
pattern.c:1153:2: runtime error: load of misaligned address 0x7f5a73f68cde for type 'WORD', which requires 4 byte alignment
0x7f5a73f68cde: note: pointer points here
 be be be be 06 00  00 00 05 00 00 00 02 00  00 00 01 00 00 00 00 00  00 00 01 00 00 00 01 00  00 00
             ^

Time =       0.03 sec    Generated terms =          1
               F         Terms in output =          1
                         Bytes used      =         20
  0.03 sec out of 0.03 sec