<div dir="ltr"><div>Hi,</div><div><br></div><div>I am wondering about the behavioural difference of the same code on two different platforms, under same conditions. For example, consider following code in css/CSSCalculationValue.cpp (under class CSSCalcBinaryOperation):</div><div><br></div><div> static PassRefPtr<CSSCalcBinaryOperation> create(PassRefPtr<CSSCalcExpressionNode> leftSide, PassRefPtr<CSSCalcExpressionNode> rightSide, CalcOperator op)<br> {<br> ASSERT(leftSide->category() != CalcOther && rightSide->category() != CalcOther);</div><div> CalculationCategory newCategory = determineCategory(*leftSide, *rightSide, op);</div><div> if (newCategory == CalcOther)<br> return 0;</div><div> return adoptRef(new CSSCalcBinaryOperation(leftSide, rightSide, op, newCategory));<br> }</div><div><br></div><div>The values in question are as follows:</div><div>calling CSSCalcBinaryOperation::create from parseAdditiveValueExpression<br>operatorCharacter 2 = -<br>lhs = 1 rhs = 1<br>in CSSCalcBinaryOperation::create<br>leftSide category = 5<br>rightSide category = 1<br><br></div><div>Now exactly same values cause ASSERT on ppc64le, causing a crash whereas it just passes smoothly on x86_64. The C/C++ compiler is identical on both the platforms:</div><div><br></div><div>on x86_64:</div><div># g++ -v<br>Using built-in specs.<br>COLLECT_GCC=g++<br>COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper<br>Target: x86_64-linux-gnu<br>Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu<br>Thread model: posix<br>gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)</div><div><br></div><div>on ppc64le:</div><div># g++ -v<br>Using built-in specs.<br>COLLECT_GCC=g++<br>COLLECT_LTO_WRAPPER=/usr/lib/gcc/powerpc64le-linux-gnu/5/lto-wrapper<br>Target: powerpc64le-linux-gnu<br>Configured with: ../src/configure -v --with-pkgversion='Ubuntu/IBM 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-ppc64el --with-arch-directory=ppc64le --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-secureplt --with-cpu=power8 --enable-targets=powerpcle-linux --disable-multilib --enable-multiarch --disable-werror --with-long-double-128 --enable-checking=release --build=powerpc64le-linux-gnu --host=powerpc64le-linux-gnu --target=powerpc64le-linux-gnu<br>Thread model: posix<br>gcc version 5.4.0 20160609 (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.4)</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 4:26 PM, Atul Sowani <span dir="ltr"><<a href="mailto:sowani@gmail.com" target="_blank">sowani@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>@Konstantin Thanks for the update and it is definitely relieving to know that those were known issues and have been fixed in later version of QtWebKit. I will work with PhantomJS maintainers to get the QtWebKit version upgraded in the latest PhantomJS version.</div><div><br></div><div>Thanks!</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 3:41 PM, Konstantin Tokarev <span dir="ltr"><<a href="mailto:annulen@yandex.ru" target="_blank">annulen@yandex.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><br>
<br>
13.02.2017, 11:52, "Atul Sowani" <<a href="mailto:sowani@gmail.com" target="_blank">sowani@gmail.com</a>>:<br>
<span>> I am using Qt 5.5.1.<br>
<br>
</span>It ships with obsolete WebKit version based on trunk from 2013. Indeed it is known to have assertion failures related to calc like those you've posted, which were fixed since that times.<br>
<br>
Please upgrade to QtWebKit TP5 [1]. It is much closer to trunk, and will be a hard requirement for Phantom JS 2.5<br>
<br>
[1] <a href="https://github.com/annulen/webkit/releases/tag/qtwebkit-tp5" target="_blank" rel="noreferrer">https://github.com/annulen/web<wbr>kit/releases/tag/qtwebkit-tp5</a><br>
<div class="m_120364450077430790HOEnZb"><div class="m_120364450077430790h5"><br>
><br>
> On Thu, Feb 9, 2017 at 10:15 PM, Simon Fraser <<a href="mailto:simon.fraser@apple.com" target="_blank">simon.fraser@apple.com</a>> wrote:<br>
>> What WebKit revision are your sources based on? It's quite likely the this bug has been fixed.<br>
>><br>
>> Simon<br>
>><br>
>>> On Feb 9, 2017, at 4:09 AM, Atul Sowani <<a href="mailto:sowani@gmail.com" target="_blank">sowani@gmail.com</a>> wrote:<br>
>>><br>
>>> Finally I zeroed in on 3 "calc" candidates from the stylesheet which are causing the CSS parser to fail:<br>
>>><br>
>>> height:calc(100vh - 200px)<br>
>>> height:calc(100vh - 230px)<br>
>>> max-height:calc(100vh - 200px)<br>
>>><br>
>>> I think it is the very first one and the remaining two never get processed.<br>
>>><br>
>>> I put in some debug statements in the code and the corresponding output for this is:<br>
>>><br>
>>> ATUL: value->id = 0 propId = 1080<br>
>>> ATUL: in CSSPropertyHeight<br>
>>> ATUL: in CSSPropertyWebkitLogicalHeight<br>
>>> ATUL: in CSSCalcValue::create<br>
>>> ATUL: in parseValueExpression, calling parseAdditiveValueExpression<br>
>>> ATUL: calling CSSCalcBinaryOperation::create from parseAdditiveValueExpression<br>
>>> ATUL: operatorCharacter = -<br>
>>> ATUL: lhs = 1 rhs = 1<br>
>>> ATUL: leftSide category = ATUL: m_category = 5<br>
>>> 5<br>
>>> ATUL: rightSide category = ATUL: m_category = 1<br>
>>> 1<br>
>>> ATUL: m_category = 5<br>
>>> ASSERTION FAILED: leftSide->category() != CalcOther && rightSide->category() != CalcOther<br>
>>> css/CSSCalculationValue.cpp(29<wbr>3) : static WTF::PassRefPtr<WebCore::CSSCa<wbr>lcBinaryOperation> WebCore::CSSCalcBinaryOperatio<wbr>n::create(WTF::PassRefPtr<WebC<wbr>ore::CSSCalcExpressionNode>, WTF::PassRefPtr<WebCore::CSSCa<wbr>lcExpressionNode>, WebCore::CalcOperator)<br>
>>> 1 0x12e8a80c bin/phantomjs() [0x12e8a80c]<br>
>>> < stack trace removed ><br>
>>><br>
>>> So the question is, is the calc expression valid one?<br>
>>><br>
>>> Best regards,<br>
>>> Atul.<br>
>>><br>
>>> On Thu, Feb 9, 2017 at 2:17 PM, Atul Sowani <<a href="mailto:sowani@gmail.com" target="_blank">sowani@gmail.com</a>> wrote:<br>
>>>> @Konstantin thanks for the suggestions. I disabled CSS JIT on x85 but there was no negative impact on the results on x86. So I guess the issue is a genuine ppc64le problem. I have picked up the starting points mentioned in this thread earlier and debugging the issue. I have also isolated the issue to a single CSS file which is causing the problem. Now I am trying to isolate the exact entry in the CSS file which is causing the trouble.<br>
>>>><br>
>>>> Thanks!<br>
>>>> Atul.<br>
>>>><br>
>>>> On Tue, Feb 7, 2017 at 3:53 PM, Konstantin Tokarev <<a href="mailto:annulen@yandex.ru" target="_blank">annulen@yandex.ru</a>> wrote:<br>
>>>><br>
>>>>> 07.02.2017, 12:55, "Atul Sowani" <<a href="mailto:sowani@gmail.com" target="_blank">sowani@gmail.com</a>>:<br>
>>>>>> Thanks Geoffrey, Alex, Yoav for the debugging pointer. I am debugging the issue further using this information and will most likely need some more help in immediate future as well.<br>
>>>>>><br>
>>>>>> Unfortunately, I don't have a stand-alone test case which can be tested with qtwebkit. I am trying to load a page using PhantomJS and it's crashing. The typical URLs which cause it to crash are <a href="http://engadget.com" target="_blank" rel="noreferrer">http://engadget.com</a> and <a href="http://cnn.com" target="_blank" rel="noreferrer">http://cnn.com</a> - both of these load without any issue on x86 platform though, so the issue seems to be specific to ppc64le.<br>
>>>>><br>
>>>>> A few suggestions:<br>
>>>>><br>
>>>>> 1. I suppose you are building with disabled JIT, as WebKit does not implement JIT for any PPC variant in official tree. This may introduce subtle differences in behavior, for example I once encountered layout test that was failing only when CSS JIT was disabled. You can try building without JIT on x86_64 and compare.<br>
>>>>><br>
>>>>> 2. It might be miscompilation, as your platform may not be as thoroughly tested as more mainstream ones. You can try to build with -O0, -O1, -O2 (default is -O3). Alternatively, try building with different compiler (at least GCC and Clang support ppc64le and are fine for WebKit, xlC may not work though), or try different version of your compiler.<br>
>>>>><br>
>>>>> 3. Note that webkit-qt list is more appropriate for issues specific for QtWebKit. Make sure you are using latest release (technology preview 5 at the moment [1])<br>
>>>>><br>
>>>>> [1] <a href="https://github.com/annulen/webkit/releases/tag/qtwebkit-tp5" target="_blank" rel="noreferrer">https://github.com/annulen/web<wbr>kit/releases/tag/qtwebkit-tp5</a><br>
>>>>><br>
>>>>>><br>
>>>>>> Thanks,<br>
>>>>>> Atul.<br>
>>>>>><br>
>>>>>> On Mon, Feb 6, 2017 at 5:56 PM, Yoav Weiss <<a href="mailto:yoav@yoav.ws" target="_blank">yoav@yoav.ws</a>> wrote:<br>
>>>>>>> Hi Atul,<br>
>>>>>>><br>
>>>>>>> I second Alex's suggestion (perhaps followed by HTMLLinkElement::process() and other places in that file that refer to `hrefAttr`).<br>
>>>>>>> If you have a test case online, I could try to take a look and maybe provide more guidance.<br>
>>>>>>><br>
>>>>>>> Cheers :)<br>
>>>>>>> Yoav<br>
>>>>>>><br>
>>>>>>> On Fri, Feb 3, 2017 at 9:19 PM Alex Christensen <<a href="mailto:achristensen@apple.com" target="_blank">achristensen@apple.com</a>> wrote:<br>
>>>>>>>> I would start looking at HTMLLinkElement::parseAttribut<wbr>e.<br>
>>>>>>>> LinkHeader.cpp contains parsers for link headers, which are related. Yoav knows more about those. Those parsers ought to be united more.<br>
>>>>>>>><br>
>>>>>>>>> On Feb 3, 2017, at 1:17 AM, Atul Sowani <<a href="mailto:sowani@gmail.com" target="_blank">sowani@gmail.com</a>> wrote:<br>
>>>>>>>>> At present I am focusing on CSSParser::findURI() particularly and CSSParser::realLex() other related functionality in CSSParser.cpp - hope I am on right track. ;-)<br>
>>>>>>>>><br>
>>>>>>>>> Please let me know if I should be looking at some other functionality as well to resolve this issue.<br>
>>>>>>>>><br>
>>>>>>>>> Thanks!<br>
>>>>>>>>> Atul.<br>
>>>>>>>>><br>
>>>>>>>>> On Fri, Feb 3, 2017 at 2:33 PM, Atul Sowani <<a href="mailto:sowani@gmail.com" target="_blank">sowani@gmail.com</a>> wrote:<br>
>>>>>>>>>> Hi,<br>
>>>>>>>>>><br>
>>>>>>>>>> I came across an issue in qtwebkit CSS parser while working on a PhantomJS crash. The issue seems to be with parsing of <link rel="..." href="..."> type elements in an HTML page. What I observed is that the parser is trying to interpret the value for href given inside double-quotes. The value contains a "-" (e.g. "<a href="http://some.domain.com/some-page-etc-etc" target="_blank" rel="noreferrer">http://some.domain.com/some-p<wbr>age-etc-etc</a>"). The "-" sign is being interpreted as minus and then things go wrong. In another case I found that "\g" embedded in the value (e.g. "<a href="http://some.domain.com/some-page/global/something" target="_blank" rel="noreferrer">http://some.domain.com/some-p<wbr>age/global/something</a>") is also creating issues. In essence, the parser is trying to interpret the value, which I believe, it should not.<br>
>>>>>>>>>><br>
>>>>>>>>>> I am willing to dive further into it to debug and fix the issue, but looking at the complexity and size of WebCore, I think I would benefit a lot to expedite a fix, if I could get some tips about which code area/functionality I should specifically focus in the WebCore. Looking forward to some help in this regard.<br>
>>>>>>>>>><br>
>>>>>>>>>> Thanks,<br>
>>>>>>>>>> Atul.<br>
>>>>>>>>> ______________________________<wbr>_________________<br>
>>>>>>>>> webkit-dev mailing list<br>
>>>>>>>>> <a href="mailto:webkit-dev@lists.webkit.org" target="_blank">webkit-dev@lists.webkit.org</a><br>
>>>>>>>>> <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank" rel="noreferrer">https://lists.webkit.org/mailm<wbr>an/listinfo/webkit-dev</a><br>
>>>>>> ,<br>
>>>>>><br>
>>>>>> ______________________________<wbr>_________________<br>
>>>>>> webkit-dev mailing list<br>
>>>>>> <a href="mailto:webkit-dev@lists.webkit.org" target="_blank">webkit-dev@lists.webkit.org</a><br>
>>>>>> <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank" rel="noreferrer">https://lists.webkit.org/mailm<wbr>an/listinfo/webkit-dev</a><br>
>>>>><br>
>>>>> --<br>
>>>>> Regards,<br>
>>>>> Konstantin<br>
>>> ______________________________<wbr>_________________<br>
>>> webkit-dev mailing list<br>
>>> <a href="mailto:webkit-dev@lists.webkit.org" target="_blank">webkit-dev@lists.webkit.org</a><br>
>>> <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank" rel="noreferrer">https://lists.webkit.org/mailm<wbr>an/listinfo/webkit-dev</a><br>
> ,<br>
><br>
> ______________________________<wbr>_________________<br>
> webkit-dev mailing list<br>
> <a href="mailto:webkit-dev@lists.webkit.org" target="_blank">webkit-dev@lists.webkit.org</a><br>
> <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank" rel="noreferrer">https://lists.webkit.org/mailm<wbr>an/listinfo/webkit-dev</a><br>
<br>
<br>
-- <br>
Regards,<br>
Konstantin<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>