On Wed, 9 Nov 2016, Nikita Popov wrote:
> On Wed, Nov 9, 2016 at 4:09 PM, Derick Rethans <derick@php.net> wrote:
>
> > On Wed, 9 Nov 2016, Christoph M. Becker wrote:
> >
> > > On 09.11.2016 at 15:21, Derick Rethans wrote:
> >
> > <snip>
> >
> > > > And running it with "valgrind php -n index.php", produces:
> > > >
> > > > root@debian-8-64bit:/home/derick/xdebug-issue-1185# valgrind php -n index.php
> > > > ==760== Memcheck, a memory error detector
> > > > ==760== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
> > > > ==760== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
> > > > ==760== Command: php -n index.php
> > > > ==760==
> > > > ==760== Conditional jump or move depends on uninitialised value(s)
> > > > ==760== at 0x797992: zend_std_get_static_method (zend_object_handlers.c:1261)
> > > > ==760== by 0x7B66FE: ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:3887)
> > > > ==760== by 0x7A379F: execute_ex (zend_vm_execute.h:363)
> > > > ==760== by 0x76E2AF: zend_execute_scripts (zend.c:1341)
> > > > ==760== by 0x70CC87: php_execute_script (main.c:2613)
> > > > ==760== by 0x81A990: do_cli (php_cli.c:998)
> > > > ==760== by 0x431996: main (php_cli.c:1382)
> > > > ==760==
> >
> > > zend_std_get_static_method() declares use_heap[1] (if there's support
> > > for alloca), but doesn't initialize it with SET_ALLOCA_FLAG()[2]. It
> > > seems to me that ALLOCA_FLAG()[3] should be defined like so:
> > >
> > > # define ALLOCA_FLAG(name) \
> > > zend_bool name = 0;
> >
> > That sounds about right - Dmitry, Nikita?
>
> This shouldn't be a problem. alloca is only used in the !key branches, in
> which case the flag is initialized by do_alloca.
However, it is a problem as my valgrind note says. However, I wouldn't
be surprised if this was a (Debian) GCC bug. I can't reproduce this when
I change -O2 to -O0 in the Makefile.
In the past, I have found a similar issue in Xdebug, where it was really
something Xdebug was doing wrong, but in a very vague way
(https://github.com/xdebug/xdebug/commit/c36ea38141cb9403ff4bf72602fcf4ae62e5ba1e).
However, right now, it's a bug with this GCC version.
cheers,
Derick
--
https://derickrethans.nl | https://xdebug.org | https://dram.io
Like Xdebug? Consider a donation: https://xdebug.org/donate.php
twitter: @derickr and @xdebug