# CALL and SWITCH executors segfault

- Thread: https://externals.io/message/16615
- Original archive: https://news-web.php.net/php.internals/16615
- Started by Sebastian Bergmann on 2005-06-12T20:48:42+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #16615 — Sebastian Bergmann — 2005-06-12T20:48:42+00:00

URL: https://externals.io/message/16615#16615

Tonight I wanted to do some benchmarks with PHP 4.3.11, PHP 5.0.4, and
 the three (CALL, GOTO, SWITCH) executors of PHP 5.1 with both GCC 3.4.4
 and GCC 4.0.1 to get a feeling for the improvements in the VM for
 PHP 5.1.

 Both the CALL and SWITCH executors segfault for me on my Linux system
 when running the ZendEngine2/bench.php script.

 Below is the backtrace for the GOTO executor:

(gdb) r Zend/bench.php
Starting program: /usr/local/src/php/php-5.1/sapi/cli/php Zend/bench.php
simple             0.294
simplecall         0.778
simpleucall        1.147
simpleudcall       1.379
mandel             1.223
mandel2            1.494

Program received signal SIGSEGV, Segmentation fault.
execute (op_array=0x826ffe0) at zend_vm_execute.h:3834
3834            memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var);
(gdb) bt
#0  execute (op_array=0x826ffe0) at zend_vm_execute.h:3834
#1  0x0816d534 in execute (op_array=0x812dcc0) at zend_vm_execute.h:3989
.
.
.
#871 0x0816d534 in execute (op_array=0x8285194) at zend_vm_execute.h:3989
#872 0x0812fa34 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/local/src/php/php-5.1/Zend/zend.c:1077
#873 0x080ecb4d in php_execute_script (primary_file=0xbffff7a0)
    at /usr/local/src/php/php-5.1/main/main.c:1670

#874 0x081d3b4a in main (argc=2, argv=0xbffff874)
    at /usr/local/src/php/php-5.1/sapi/cli/php_cli.c:1036

 Below is the backtrace for the SWITCH executor:

(gdb) r Zend/bench.php
Starting program: /usr/local/src/php/php-5.1/sapi/cli/php Zend/bench.php
simple             0.316
simplecall         0.779
simpleucall        1.170
simpleudcall       1.389
mandel             1.384
mandel2            1.630

Program received signal SIGSEGV, Segmentation fault.
execute (op_array=0x8273fe0) at zend_vm_execute.h:53
53              memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var);
(gdb) bt
#0  execute (op_array=0x8273fe0) at zend_vm_execute.h:53
#1  0x0816f7b8 in execute (op_array=0x812dcc0) at zend_vm_execute.h:211
.
.
.
#875 0x0816f7b8 in execute (op_array=0x8289194) at zend_vm_execute.h:211
#876 0x0812fa34 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /usr/local/src/php/php-5.1/Zend/zend.c:1077
#877 0x080ecb4d in php_execute_script (primary_file=0xbffff7a0) at
/usr/local/src/php/php-5.1/main/main.c:1670
#878 0x081d464a in main (argc=2, argv=0xbffff874) at
/usr/local/src/php/php-5.1/sapi/cli/php_cli.c:1036

-- 
Sebastian Bergmann                      http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

---

## #16618 — Sebastian Bergmann — 2005-06-13T06:55:01+00:00

URL: https://externals.io/message/16615#16618 · In reply to: #16615

Sebastian Bergmann wrote:
> Tonight I wanted to do some benchmarks with PHP 4.3.11, PHP 5.0.4, and
> the three (CALL, GOTO, SWITCH) executors of PHP 5.1 with both GCC 3.4.4
> and GCC 4.0.1 to get a feeling for the improvements in the VM for
> PHP 5.1.

 Initial results are here [1].

> Both the CALL and SWITCH executors segfault for me on my Linux system
> when running the ZendEngine2/bench.php script.

 The benchmark part that causes the segfault in both cases is the
 Ackermann function.

 --
 [1] http://sebastian-bergmann.de/stuff/benchmark.txt

-- 
Sebastian Bergmann                      http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

---

## #16619 — Dmitry Stogov — 2005-06-13T06:58:49+00:00

URL: https://externals.io/message/16615#16619 · In reply to: #16615

Hi Sebastian,

The problem in stack overflow.
We will see how this can be fixed without performance lost.

Do you use x86 (non x86-64)?
What is your ./configure options?

Thanks. Dmitry.

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Sebastian Bergmann
> Sent: Monday, June 13, 2005 12:49 AM
> To: internals@lists.php.net
> Subject: [PHP-DEV] CALL and SWITCH executors segfault
> 
> 
>  Tonight I wanted to do some benchmarks with PHP 4.3.11, PHP 
> 5.0.4, and  the three (CALL, GOTO, SWITCH) executors of PHP 
> 5.1 with both GCC 3.4.4  and GCC 4.0.1 to get a feeling for 
> the improvements in the VM for  PHP 5.1.
> 
>  Both the CALL and SWITCH executors segfault for me on my 
> Linux system  when running the ZendEngine2/bench.php script.
> 
>  Below is the backtrace for the GOTO executor:
> 
> (gdb) r Zend/bench.php
> Starting program: /usr/local/src/php/php-5.1/sapi/cli/php 
> Zend/bench.php
> simple             0.294
> simplecall         0.778
> simpleucall        1.147
> simpleudcall       1.379
> mandel             1.223
> mandel2            1.494
> 
> Program received signal SIGSEGV, Segmentation fault.
> execute (op_array=0x826ffe0) at zend_vm_execute.h:3834
> 3834            memset(EX(CVs), 0, sizeof(zval**) * 
> op_array->last_var);
> (gdb) bt
> #0  execute (op_array=0x826ffe0) at zend_vm_execute.h:3834
> #1  0x0816d534 in execute (op_array=0x812dcc0) at 
> zend_vm_execute.h:3989 . . . #871 0x0816d534 in execute 
> (op_array=0x8285194) at zend_vm_execute.h:3989 #872 
> 0x0812fa34 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
>     at /usr/local/src/php/php-5.1/Zend/zend.c:1077
> #873 0x080ecb4d in php_execute_script (primary_file=0xbffff7a0)
>     at /usr/local/src/php/php-5.1/main/main.c:1670
> 
> #874 0x081d3b4a in main (argc=2, argv=0xbffff874)
>     at /usr/local/src/php/php-5.1/sapi/cli/php_cli.c:1036
> 
>  Below is the backtrace for the SWITCH executor:
> 
> (gdb) r Zend/bench.php
> Starting program: /usr/local/src/php/php-5.1/sapi/cli/php 
> Zend/bench.php
> simple             0.316
> simplecall         0.779
> simpleucall        1.170
> simpleudcall       1.389
> mandel             1.384
> mandel2            1.630
> 
> Program received signal SIGSEGV, Segmentation fault.
> execute (op_array=0x8273fe0) at zend_vm_execute.h:53
> 53              memset(EX(CVs), 0, sizeof(zval**) * 
> op_array->last_var);
> (gdb) bt
> #0  execute (op_array=0x8273fe0) at zend_vm_execute.h:53
> #1  0x0816f7b8 in execute (op_array=0x812dcc0) at 
> zend_vm_execute.h:211 . . . #875 0x0816f7b8 in execute 
> (op_array=0x8289194) at zend_vm_execute.h:211 #876 0x0812fa34 
> in zend_execute_scripts (type=8, retval=0x0, file_count=3) at 
> /usr/local/src/php/php-5.1/Zend/zend.c:1077
> #877 0x080ecb4d in php_execute_script 
> (primary_file=0xbffff7a0) at 
> /usr/local/src/php/php-5.1/main/main.c:1670
> #878 0x081d464a in main (argc=2, argv=0xbffff874) at 
> /usr/local/src/php/php-5.1/sapi/cli/php_cli.c:1036
> 
> -- 
> Sebastian Bergmann                      
> http://www.sebastian-bergmann.de/
> GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 
> C514 B85B 5D69

---

## #16621 — Sebastian Bergmann — 2005-06-13T07:01:01+00:00

URL: https://externals.io/message/16615#16621 · In reply to: #16619

Dmitry Stogov wrote:
> Do you use x86 (non x86-64)?
> What is your ./configure options?

 Intel(R) Pentium(R) M Processor 1500MHz / 1024 KB Cache / 512 MB RAM
 Linux 2.6.11-gentoo-r11

 CFLAGS="-march=pentium-m -O2 -pipe"
 ./configure --disable-cgi --disable-all

-- 
Sebastian Bergmann                      http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
