Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hphp crash with define statement #40

Closed
lcastelli opened this issue Feb 23, 2010 · 2 comments
Closed

hphp crash with define statement #40

lcastelli opened this issue Feb 23, 2010 · 2 comments

Comments

@lcastelli
Copy link
Contributor

When defining a constant with a name computed from other constants, hphp crashes during the "inferring types" phase.

This is a minimal PHP file to reproduce the issue:

<?php
define('A', 'B');
define('A_'.A, 'B');
?>

The error:

hphp: /usr/include/boost/shared_ptr.hpp:419: T* boost::shared_ptr<  >::operator->() const [with T = HPHP::BlockScope]: Assertion `px != 0' failed.

And the stack trace:

#0  0x00007ffff3ef14b5 in raise () from /lib/libc.so.6
#1  0x00007ffff3ef4f50 in abort () from /lib/libc.so.6
#2  0x00007ffff3eea481 in __assert_fail () from /lib/libc.so.6
#3  0x000000000084007b in boost::shared_ptr::operator->() const ()
#4  0x000000000085fd11 in HPHP::SimpleFunctionCall::inferAndCheck(boost::shared_ptr, boost::shared_ptr, bool) ()
#5  0x0000000000982bf1 in HPHP::ExpStatement::inferTypes(boost::shared_ptr) ()
#6  0x000000000097fb77 in HPHP::StatementList::inferTypes(boost::shared_ptr) ()
#7  0x000000000096a6b6 in HPHP::MethodStatement::inferTypes(boost::shared_ptr) ()
#8  0x000000000098fefb in HPHP::FunctionStatement::inferTypes(boost::shared_ptr) ()
#9  0x00000000009114be in HPHP::FileScope::inferTypes(boost::shared_ptr) ()
#10 0x00000000008733ca in HPHP::AnalysisResult::inferTypes(int) ()
#11 0x000000000080fd2a in cppTarget(ProgramOptions const&, boost::shared_ptr, bool) ()
#12 0x0000000000810479 in runTargetCheck(ProgramOptions const&, boost::shared_ptr) ()
#13 0x000000000080e792 in process(ProgramOptions const&) ()
#14 0x000000000080bb09 in main ()
@scottmac
Copy link
Contributor

Reported internally to 214543

@scottmac
Copy link
Contributor

Fixed now.

hhvm-bot pushed a commit that referenced this issue Jan 25, 2018
Summary:
This adds the Aarch64 equivalent code that was seen at the bottom of  commit 1c338be.
This takes advantage of the assert to save 2 instructions per instance.

The standard regression tests were run with 6 option sets.  No new problems were observed.
The generated assembly code was as expected.

Before
=====
0000000005e8b574 <_ZN4HPHP5ffs64Em>:
...
 5e8b5e4:       52801382        mov     w2, #0x9c                       // #156
 5e8b5e8:       97dc48c9        bl      559d90c <_ZN4HPHP11assert_failEPKcS1_jS1_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE>
 5e8b5ec:       f94017a0        ldr     x0, [x29,#40]
 5e8b5f0:       f100001f        cmp     x0, #0x0        //<<---
 5e8b5f4:       dac00000        rbit    x0, x0          //<<---
 5e8b5f8:       dac01000        clz     x0, x0          //<<---
 5e8b5fc:       9a8007e0        csinc   x0, xzr, x0, eq //<<---
 5e8b600:       51000400        sub     w0, w0, #0x1

After
====
0000000005e8b574 <_ZN4HPHP5ffs64Em>:
...
 5e8b5e4:       52801382        mov     w2, #0x9c                       // #156
 5e8b5e8:       97dc48c9        bl      559d90c <_ZN4HPHP11assert_failEPKcS1_jS1_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE>
 5e8b5ec:       f94017a0        ldr     x0, [x29,#40]
 5e8b5f0:       dac00000        rbit    x0, x0          //<<---
 5e8b5f4:       dac01000        clz     x0, x0          //<<---
 5e8b5f8:       f90023a0        str     x0, [x29,#64]
 5e8b5fc:       f94023a0        ldr     x0, [x29,#64]
Closes #8077

Reviewed By: edwinsmith

Differential Revision: D6766056

Pulled By: mxw

fbshipit-source-id: 65242fbf90ed8fbc39e2f3776e251e248ff3cab2
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants