[pcre-dev] JIT segfaults on 32-bit Linux with Intel compiler

Top Page
Delete this message
Author: Daniel Richard G
Date:  
To: pcre-dev
Subject: [pcre-dev] JIT segfaults on 32-bit Linux with Intel compiler
I tested this using a clean checkout of r1221, to avoid confusion.

First, I had to define SLJIT_CALL to empty, or else I got (using "icc
-no-gcc", as mentioned previously)

--------8<--------
../sljit/sljitLir.h(911): error: incomplete type is not allowed
   SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void);
                                 ^
../sljit/sljitLir.h(911): error: expected a ";"
   SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void);
                                            ^
../sljit/sljitLir.h(912): error: expected a ";"
   SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void);
                                            ^
(more errors follow)
-------->8--------



Then, I had to enable the preprocessor conditional at
sljitNativeX86_common.c:280, to avoid a "SLJIT_DETECT_SSE2 is not
implemented for this C compiler" error.

Those two changes allowed PCRE to build. Then, in "make check"...

--------8<--------
Running JIT regression tests
   target CPU of SLJIT compiler: x86 32bit (little endian + unaligned)
   in  8 bit mode with UTF-8  enabled and ucp enabled:
   in 16 bit mode with UTF-16 enabled and ucp enabled:
   in 32 bit mode with UTF-32 enabled and ucp enabled:
............................................................
............................................................
............................................................
............................................................
........................................................../bin/sh: line 1: 22632 Segmentation fault      ${dir}$tst
FAIL: pcre_jit_test


PCRE C library tests using test data from ../testdata
PCRE version 8.32-RC1 2012-11-11

---- Testing 8-bit library ----

Test 1: Main functionality (Compatible with Perl >= 5.10)
   OK
   OK with study
../RunTest: line 441: 22655 Segmentation fault      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
FAIL: RunTest


Testing pcregrep version 8.32-RC1 2012-11-11
Testing pcregrep main features
Testing pcregrep UTF-8 features
Testing pcregrep newline settings
PASS: RunGrepTest
===================
2 of 3 tests failed
===================
make[2]: *** [check-TESTS] Error 1
-------->8--------


If I enable the conditional at sljitConfigInternal.h:307, so that
SLJIT_CALL is defined to __attribute__((fastcall)), everything still
builds but the test suite fails spectacularly:

--------8<--------
/bin/sh: line 1: 28044 Segmentation fault      ${dir}$tst
FAIL: pcre_jit_test


PCRE C library tests using test data from ../testdata
PCRE version 8.32-RC1 2012-11-11

---- Testing 8-bit library ----

Test 1: Main functionality (Compatible with Perl >= 5.10)
   OK
   OK with study
../RunTest: line 441: 28063 Segmentation fault      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
FAIL: RunTest


Testing pcregrep version 8.32-RC1 2012-11-11
Testing pcregrep main features
../RunGrepTest: line 73: 28076 Segmentation fault      $valgrind $pcregrep PATTERN ./testdata/grepinput
../RunGrepTest: line 77: 28078 Segmentation fault      $valgrind $pcregrep '^PATTERN' ./testdata/grepinput
../RunGrepTest: line 81: 28080 Segmentation fault      $valgrind $pcregrep -in PATTERN ./testdata/grepinput
../RunGrepTest: line 85: 28082 Segmentation fault      $valgrind $pcregrep -ic PATTERN ./testdata/grepinput
../RunGrepTest: line 89: 28084 Segmentation fault      $valgrind $pcregrep -in PATTERN ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 93: 28086 Segmentation fault      $valgrind $pcregrep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 97: 28088 Segmentation fault      $valgrind $pcregrep -il PATTERN ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 101: 28090 Segmentation fault      $valgrind $pcregrep -l PATTERN ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 105: 28092 Segmentation fault      $valgrind $pcregrep -q PATTERN ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 109: 28094 Segmentation fault      $valgrind $pcregrep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 113: 28096 Segmentation fault      $valgrind $pcregrep -vn pattern ./testdata/grepinputx
../RunGrepTest: line 117: 28098 Segmentation fault      $valgrind $pcregrep -ix pattern ./testdata/grepinputx
../RunGrepTest: line 122: 28100 Segmentation fault      $valgrind $pcregrep -f./testdata/greplist -f $builddir/testtemp1 ./testdata/grepinputx
../RunGrepTest: line 126: 28102 Segmentation fault      $valgrind $pcregrep -w pat ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 138: 28108 Segmentation fault      $valgrind $pcregrep -M 'the\noutput' ./testdata/grepinput
../RunGrepTest: line 142: 28110 Segmentation fault      $valgrind $pcregrep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput
../RunGrepTest: line 146: 28112 Segmentation fault      $valgrind $pcregrep -Mix 'Pattern' ./testdata/grepinputx
../RunGrepTest: line 150: 28114 Segmentation fault      $valgrind $pcregrep -Mixn 'complete pair\nof lines' ./testdata/grepinputx
../RunGrepTest: line 154: 28116 Segmentation fault      $valgrind $pcregrep -nA3 'four' ./testdata/grepinputx
../RunGrepTest: line 158: 28118 Segmentation fault      $valgrind $pcregrep -nB3 'four' ./testdata/grepinputx
../RunGrepTest: line 162: 28120 Segmentation fault      $valgrind $pcregrep -C3 'four' ./testdata/grepinputx
../RunGrepTest: line 166: 28122 Segmentation fault      $valgrind $pcregrep -A9 'four' ./testdata/grepinputx
../RunGrepTest: line 170: 28124 Segmentation fault      $valgrind $pcregrep -nB9 'four' ./testdata/grepinputx
../RunGrepTest: line 174: 28126 Segmentation fault      $valgrind $pcregrep -A9 -B9 'four' ./testdata/grepinputx
../RunGrepTest: line 178: 28128 Segmentation fault      $valgrind $pcregrep -A10 'four' ./testdata/grepinputx
../RunGrepTest: line 182: 28130 Segmentation fault      $valgrind $pcregrep -nB10 'four' ./testdata/grepinputx
../RunGrepTest: line 186: 28132 Segmentation fault      $valgrind $pcregrep -C12 -B10 'four' ./testdata/grepinputx
../RunGrepTest: line 190: 28134 Segmentation fault      $valgrind $pcregrep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 194: 28136 Segmentation fault      $valgrind $pcregrep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 198: 28138 Segmentation fault      $valgrind $pcregrep -L 'fox' ./testdata/grepinput ./testdata/grepinputx
../RunGrepTest: line 224: 28153 Segmentation fault      $valgrind $pcregrep '>\x00<' ./testdata/grepinput
../RunGrepTest: line 228: 28155 Segmentation fault      $valgrind $pcregrep -A1 'before the binary zero' ./testdata/grepinput
../RunGrepTest: line 232: 28157 Segmentation fault      $valgrind $pcregrep -B1 'after the binary zero' ./testdata/grepinput
../RunGrepTest: line 236: 28159 Segmentation fault      $valgrind $pcregrep -B1 -o '\w+ the binary zero' ./testdata/grepinput
../RunGrepTest: line 240: 28161 Segmentation fault      $valgrind $pcregrep -B1 -onH '\w+ the binary zero' ./testdata/grepinput
../RunGrepTest: line 244: 28163 Segmentation fault      $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput
../RunGrepTest: line 248: 28165 Segmentation fault      $valgrind $pcregrep -on -e before -ezero -e after ./testdata/grepinput
../RunGrepTest: line 252: 28167 Segmentation fault      $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput
../RunGrepTest: line 261: 28171 Segmentation fault      $valgrind $pcregrep -Fx "AB.VE
elephant" ./testdata/grepinput
../RunGrepTest: line 266: 28173 Segmentation fault      $valgrind $pcregrep -F "AB.VE
elephant" ./testdata/grepinput
../RunGrepTest: line 271: 28175 Segmentation fault      $valgrind $pcregrep -F -e DATA -e "AB.VE
elephant" ./testdata/grepinput
../RunGrepTest: line 275: 28177 Segmentation fault      $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx
../RunGrepTest: line 279: 28179 Segmentation fault      $valgrind $pcregrep -Mv "brown\sfox" ./testdata/grepinputv
../RunGrepTest: line 283: 28181 Segmentation fault      $valgrind $pcregrep --colour=always jumps ./testdata/grepinputv
../RunGrepTest: line 287: 28183 Segmentation fault      $valgrind $pcregrep --file-offsets 'before|zero|after' ./testdata/grepinput
../RunGrepTest: line 291: 28185 Segmentation fault      $valgrind $pcregrep --line-offsets 'before|zero|after' ./testdata/grepinput
../RunGrepTest: line 295: 28187 Segmentation fault      $valgrind $pcregrep -f./testdata/greplist --color=always ./testdata/grepinputx
../RunGrepTest: line 299: 28189 Segmentation fault      $valgrind $pcregrep -c lazy ./testdata/grepinput*
../RunGrepTest: line 303: 28191 Segmentation fault      $valgrind $pcregrep -c -l lazy ./testdata/grepinput*
../RunGrepTest: line 307: 28193 Segmentation fault      $valgrind $pcregrep --regex=PATTERN ./testdata/grepinput
../RunGrepTest: line 311: 28195 Segmentation fault      $valgrind $pcregrep --regexp=PATTERN ./testdata/grepinput
../RunGrepTest: line 315: 28197 Segmentation fault      $valgrind $pcregrep --regex PATTERN ./testdata/grepinput
../RunGrepTest: line 319: 28199 Segmentation fault      $valgrind $pcregrep --regexp PATTERN ./testdata/grepinput
../RunGrepTest: line 331: 28205 Segmentation fault      $valgrind $pcregrep -o1 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput
../RunGrepTest: line 335: 28207 Segmentation fault      $valgrind $pcregrep -o2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput
../RunGrepTest: line 339: 28209 Segmentation fault      $valgrind $pcregrep -o3 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput
../RunGrepTest: line 343: 28211 Segmentation fault      $valgrind $pcregrep -o12 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput
../RunGrepTest: line 347: 28213 Segmentation fault      $valgrind $pcregrep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput
../RunGrepTest: line 351: 28215 Segmentation fault      $valgrind $pcregrep -vn --colour=always pattern ./testdata/grepinputx
../RunGrepTest: line 355: 28217 Segmentation fault      $valgrind $pcregrep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3
../RunGrepTest: line 359: 28219 Segmentation fault      $valgrind $pcregrep -o "^01|^02|^03" ./testdata/grepinput
../RunGrepTest: line 363: 28221 Segmentation fault      $valgrind $pcregrep --color=always "^01|^02|^03" ./testdata/grepinput
../RunGrepTest: line 367: 28223 Segmentation fault      $valgrind $pcregrep -o --colour=always "^01|^02|^03" ./testdata/grepinput
../RunGrepTest: line 371: 28225 Segmentation fault      $valgrind $pcregrep -o "^01|02|^03" ./testdata/grepinput
../RunGrepTest: line 375: 28227 Segmentation fault      $valgrind $pcregrep --color=always "^01|02|^03" ./testdata/grepinput
../RunGrepTest: line 379: 28229 Segmentation fault      $valgrind $pcregrep -o --colour=always "^01|02|^03" ./testdata/grepinput
../RunGrepTest: line 383: 28231 Segmentation fault      $valgrind $pcregrep -o "^01|^02|03" ./testdata/grepinput
../RunGrepTest: line 387: 28233 Segmentation fault      $valgrind $pcregrep --color=always "^01|^02|03" ./testdata/grepinput
../RunGrepTest: line 391: 28235 Segmentation fault      $valgrind $pcregrep -o --colour=always "^01|^02|03" ./testdata/grepinput
../RunGrepTest: line 395: 28237 Segmentation fault      $valgrind $pcregrep -o "\b01|\b02" ./testdata/grepinput
../RunGrepTest: line 399: 28239 Segmentation fault      $valgrind $pcregrep --color=always "\\b01|\\b02" ./testdata/grepinput
../RunGrepTest: line 403: 28241 Segmentation fault      $valgrind $pcregrep -o --colour=always "\\b01|\\b02" ./testdata/grepinput
../RunGrepTest: line 482: 28282 Segmentation fault      $valgrind $pcregrep -Ho2 --only-matching=1 -o3 '(\w+) binary (\w+)(\.)?' ./testdata/grepinput
../RunGrepTest: line 486: 28284 Segmentation fault      $valgrind $pcregrep -o3 -Ho2 -o12 --only-matching=1 -o3 --colour=always --om-separator='|' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput
Files ../testdata/grepoutput and testtry differ
FAIL: RunGrepTest
===================
3 of 3 tests failed
===================
make[2]: *** [check-TESTS] Error 1
-------->8--------



Note that all these builds are without optimization, and if I disable JIT,
the test suite passes.


--Daniel


--
Daniel Richard G. || danielg@??? || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/