<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>189078</bug_id>
          
          <creation_ts>2018-08-29 06:23:20 -0700</creation_ts>
          <short_desc>[JSC] Build broken after r234975 on s390x, ppc64le, armv7hl</short_desc>
          <delta_ts>2018-09-06 09:42:27 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70124</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tomas Popela">tpopela</reporter>
          <assigned_to name="Tomas Popela">tpopela</assigned_to>
          <cc>berto</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1454758</commentid>
    <comment_count>0</comment_count>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-08-29 06:23:20 -0700</bug_when>
    <thetext>After r234975 the build fails on s390x, ppc64le, armv7hl with:

[ 48%] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource68.cpp.o
cd /builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/Source/JavaScriptCore &amp;&amp; /usr/bin/c++  -DBUILDING_GTK__=1 -DBUILDING_JavaScriptCore -DBUILDING_WITH_CMAKE=1 -DGETTEXT_PACKAGE=\&quot;WebKit2GTK-4.0\&quot; -DHAVE_CONFIG_H=1 -DJSC_COMPILATION -DJSC_GLIB_API_ENABLED -DJavaScriptCore_EXPORTS -DSTATICALLY_LINKED_WITH_WTF -DWEBKITGTK_API_VERSION_STRING=\&quot;4.0\&quot; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/ForwardingHeaders -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/API -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/assembler -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/b3 -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/b3/air -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/bindings -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/builtins -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/bytecode -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/bytecompiler -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/dfg -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/disassembler -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/disassembler/ARM64 -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/disassembler/udis86 -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/domjit -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/ftl -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/debugger -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/agents -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/augmentable -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/remote -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/interpreter -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/jit -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/llint -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/parser -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/profiler -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/runtime -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/tools -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/wasm -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/wasm/js -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/yarr -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore/inspector -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore/runtime -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore/yarr -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/ForwardingHeaders/JavaScriptCore/glib -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore/javascriptcoregtk/jsc -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/API/glib -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore/javascriptcoregtk -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/remote/glib -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/bmalloc -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/ThirdParty -isystem /usr/include/glib-2.0 -isystem /usr/lib/glib-2.0/include  -Wno-expansion-to-defined -Wno-noexcept-type -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wextra -Wall -O2 -g1 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -DUSER_AGENT_GTK_DISTRIBUTOR_NAME=&apos;&quot;Fedora&quot;&apos; -fno-strict-aliasing -fno-exceptions -fno-rtti -std=c++14 -DNDEBUG -fPIC   -ffp-contract=off -o CMakeFiles/JavaScriptCore.dir/__/__/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource68.cpp.o -c /builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource68.cpp
In file included from /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/MachineStackMarker.h:24,
                 from /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/MachineStackMarker.cpp:23,
                 from /builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource68.cpp:7:
/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/MachineStackMarker.cpp: In function &apos;int JSC::callWithCurrentThreadState(const WTF::ScopedLambda&lt;void(JSC::CurrentThreadState&amp;)&gt;&amp;)&apos;:
/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/MachineStackMarker.cpp:224:46: error: requested alignment is not an integer constant
     DECLARE_AND_COMPUTE_CURRENT_THREAD_STATE(state);
                                              ^~~~~
/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/RegisterState.h:169:77: note: in definition of macro &apos;ALLOCATE_AND_GET_REGISTER_STATE&apos;
     alignas(std::max(alignof(void*), alignof(RegisterState))) RegisterState registers; \
                                                                             ^~~~~~~~~
/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/MachineStackMarker.cpp:224:5: note: in expansion of macro &apos;DECLARE_AND_COMPUTE_CURRENT_THREAD_STATE&apos;
     DECLARE_AND_COMPUTE_CURRENT_THREAD_STATE(state);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I temporarily reverted the commit and the build passes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1454776</commentid>
    <comment_count>1</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-08-29 08:25:26 -0700</bug_when>
    <thetext>(In reply to Tomas Popela from comment #0)
&gt; After r234975 the build fails on s390x, ppc64le, armv7hl with:
&gt; 
&gt; [ 48%] Building CXX object
&gt; Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/DerivedSources/
&gt; JavaScriptCore/unified-sources/UnifiedSource68.cpp.o
&gt; cd
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/Source/
&gt; JavaScriptCore &amp;&amp; /usr/bin/c++  -DBUILDING_GTK__=1 -DBUILDING_JavaScriptCore
&gt; -DBUILDING_WITH_CMAKE=1 -DGETTEXT_PACKAGE=\&quot;WebKit2GTK-4.0\&quot;
&gt; -DHAVE_CONFIG_H=1 -DJSC_COMPILATION -DJSC_GLIB_API_ENABLED
&gt; -DJavaScriptCore_EXPORTS -DSTATICALLY_LINKED_WITH_WTF
&gt; -DWEBKITGTK_API_VERSION_STRING=\&quot;4.0\&quot;
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/ForwardingHeaders
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/API
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/assembler
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/b3
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/b3/air
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/bindings
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/builtins
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/bytecode
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/bytecompiler
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/dfg
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/disassembler
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/disassembler/
&gt; ARM64
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/disassembler/
&gt; udis86
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/domjit
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/ftl
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/debugger
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/
&gt; agents
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/
&gt; augmentable
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/
&gt; remote
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/interpreter
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/jit
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/llint
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/parser
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/profiler
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/runtime
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/tools
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/wasm
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/wasm/js
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/yarr
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore/inspector
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore/runtime
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore/yarr
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/ForwardingHeaders/JavaScriptCore/glib
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore/javascriptcoregtk/jsc
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/API/glib
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore/javascriptcoregtk
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/inspector/
&gt; remote/glib -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/bmalloc
&gt; -I/builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources -I/builddir/build/BUILD/webkitgtk-2.21.92/Source/ThirdParty
&gt; -isystem /usr/include/glib-2.0 -isystem /usr/lib/glib-2.0/include 
&gt; -Wno-expansion-to-defined -Wno-noexcept-type -Wno-maybe-uninitialized
&gt; -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute
&gt; -Wformat-security -Wcast-align -Wextra -Wall -O2 -g1 -pipe -Wall
&gt; -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
&gt; -fexceptions -fstack-protector-strong -grecord-gcc-switches
&gt; -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
&gt; -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16
&gt; -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard
&gt; -DUSER_AGENT_GTK_DISTRIBUTOR_NAME=&apos;&quot;Fedora&quot;&apos; -fno-strict-aliasing
&gt; -fno-exceptions -fno-rtti -std=c++14 -DNDEBUG -fPIC   -ffp-contract=off -o
&gt; CMakeFiles/JavaScriptCore.dir/__/__/DerivedSources/JavaScriptCore/unified-
&gt; sources/UnifiedSource68.cpp.o -c
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore/unified-sources/UnifiedSource68.cpp
&gt; In file included from
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/
&gt; MachineStackMarker.h:24,
&gt;                  from
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/
&gt; MachineStackMarker.cpp:23,
&gt;                  from
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/armv7hl-redhat-linux-gnueabi/
&gt; DerivedSources/JavaScriptCore/unified-sources/UnifiedSource68.cpp:7:
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/
&gt; MachineStackMarker.cpp: In function &apos;int
&gt; JSC::callWithCurrentThreadState(const
&gt; WTF::ScopedLambda&lt;void(JSC::CurrentThreadState&amp;)&gt;&amp;)&apos;:
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/
&gt; MachineStackMarker.cpp:224:46: error: requested alignment is not an integer
&gt; constant
&gt;      DECLARE_AND_COMPUTE_CURRENT_THREAD_STATE(state);
&gt;                                               ^~~~~
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/
&gt; RegisterState.h:169:77: note: in definition of macro
&gt; &apos;ALLOCATE_AND_GET_REGISTER_STATE&apos;
&gt;      alignas(std::max(alignof(void*), alignof(RegisterState))) RegisterState
&gt; registers; \
&gt;                                                                             
&gt; ^~~~~~~~~
&gt; /builddir/build/BUILD/webkitgtk-2.21.92/Source/JavaScriptCore/heap/
&gt; MachineStackMarker.cpp:224:5: note: in expansion of macro
&gt; &apos;DECLARE_AND_COMPUTE_CURRENT_THREAD_STATE&apos;
&gt;      DECLARE_AND_COMPUTE_CURRENT_THREAD_STATE(state);
&gt;      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&gt; 
&gt; I temporarily reverted the commit and the build passes.

This is because std::max is not annotated as constexpr in old GCC&apos;s libstdc++. (It was a bug since they should be constexpr in C++14).
https://github.com/gcc-mirror/gcc/commit/d3ab86117a4b67ca76491e13e4f705cfb9efb79e
Can you fix it by using `? :` operator instead?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455167</commentid>
    <comment_count>2</comment_count>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-08-29 23:18:26 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #1)
&gt; This is because std::max is not annotated as constexpr in old GCC&apos;s
&gt; libstdc++. (It was a bug since they should be constexpr in C++14).
&gt; https://github.com/gcc-mirror/gcc/commit/
&gt; d3ab86117a4b67ca76491e13e4f705cfb9efb79e

This is definitely not an old libstdc++. It&apos;s GCC 8.2.1. 

&gt; Can you fix it by using `? :` operator instead?

Yes, it fixes it. I will upload the patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455168</commentid>
    <comment_count>3</comment_count>
      <attachid>348487</attachid>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-08-29 23:20:18 -0700</bug_when>
    <thetext>Created attachment 348487
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455169</commentid>
    <comment_count>4</comment_count>
      <attachid>348487</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2018-08-29 23:32:58 -0700</bug_when>
    <thetext>Comment on attachment 348487
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=348487&amp;action=review

r=me if EWS bots are happy.

&gt; Source/JavaScriptCore/ChangeLog:8
&gt; +        Use ternary operator instead of std::max().

I think you should document the gcc bug (that Yusuke pointed out) here e.g.

    std::max is not annotated as constexpr in old GCC libstdc++, which is a bug since they should be constexpr in C++14.
    https://github.com/gcc-mirror/gcc/commit/d3ab86117a4b67ca76491e13e4f705cfb9efb79e

    This patch works around this bug by using a ternary operator instead of std::max().

This way:
1. other people reading this code will understand why the ternary operator is needed here (to work around a bug, not because it&apos;s the preferred way to express this).
2. people will know in the future the motivation for this change, and can remove it when the workaround is no longer needed.

Technically, one can reverse engineer the reasoning by digging further back to the comments in this bugzilla.  But the ChangeLog is meant to document the motivation behind changes when it&apos;s not obvious.  So, let&apos;s do that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455170</commentid>
    <comment_count>5</comment_count>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-08-29 23:37:58 -0700</bug_when>
    <thetext>(In reply to Mark Lam from comment #4)
&gt; Comment on attachment 348487 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=348487&amp;action=review
&gt; 
&gt; r=me if EWS bots are happy.
&gt; 
&gt; &gt; Source/JavaScriptCore/ChangeLog:8
&gt; &gt; +        Use ternary operator instead of std::max().
&gt; 
&gt; I think you should document the gcc bug (that Yusuke pointed out) here e.g.
&gt; 
&gt;     std::max is not annotated as constexpr in old GCC libstdc++, which is a
&gt; bug since they should be constexpr in C++14.

True, the change log entry should be more descriptive, but I&apos;m not sure that the information from Yusuke about an old GCC is true, as I&apos;m using the latest libstdc++ up to date. I will update the change log in case of landing it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455172</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2018-08-29 23:41:23 -0700</bug_when>
    <thetext>(In reply to Tomas Popela from comment #5)
&gt; (In reply to Mark Lam from comment #4)
&gt; &gt; Comment on attachment 348487 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=348487&amp;action=review
&gt; &gt; 
&gt; &gt; r=me if EWS bots are happy.
&gt; &gt; 
&gt; &gt; &gt; Source/JavaScriptCore/ChangeLog:8
&gt; &gt; &gt; +        Use ternary operator instead of std::max().
&gt; &gt; 
&gt; &gt; I think you should document the gcc bug (that Yusuke pointed out) here e.g.
&gt; &gt; 
&gt; &gt;     std::max is not annotated as constexpr in old GCC libstdc++, which is a
&gt; &gt; bug since they should be constexpr in C++14.
&gt; 
&gt; True, the change log entry should be more descriptive, but I&apos;m not sure that
&gt; the information from Yusuke about an old GCC is true, as I&apos;m using the
&gt; latest libstdc++ up to date. I will update the change log in case of landing
&gt; it.

Does your libstdc++ already include the changes in PR https://github.com/gcc-mirror/gcc/commit/d3ab86117a4b67ca76491e13e4f705cfb9efb79e?  If not, then it is not adequately up to date (for the purpose of the need for this workaround).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455178</commentid>
    <comment_count>7</comment_count>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-08-30 00:35:17 -0700</bug_when>
    <thetext>(In reply to Mark Lam from comment #6)
&gt; Does your libstdc++ already include the changes in PR
&gt; https://github.com/gcc-mirror/gcc/commit/
&gt; d3ab86117a4b67ca76491e13e4f705cfb9efb79e?  If not, then it is not adequately
&gt; up to date (for the purpose of the need for this workaround).

Yes, that&apos;s what I was talking about. This was fixed in 2014 in GCC 5.1 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60271.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1457064</commentid>
    <comment_count>8</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-09-06 06:59:05 -0700</bug_when>
    <thetext>(In reply to Tomas Popela from comment #7)
&gt; (In reply to Mark Lam from comment #6)
&gt; &gt; Does your libstdc++ already include the changes in PR
&gt; &gt; https://github.com/gcc-mirror/gcc/commit/
&gt; &gt; d3ab86117a4b67ca76491e13e4f705cfb9efb79e?  If not, then it is not adequately
&gt; &gt; up to date (for the purpose of the need for this workaround).
&gt; 
&gt; Yes, that&apos;s what I was talking about. This was fixed in 2014 in GCC 5.1 -
&gt; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60271.

I think GCC requirement of WebKit is 6.0.0.
Do you use pre-5.1 libstdc++ with GCC 6.0.0?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1457065</commentid>
    <comment_count>9</comment_count>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-09-06 07:05:05 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #8)
&gt; I think GCC requirement of WebKit is 6.0.0.
&gt; Do you use pre-5.1 libstdc++ with GCC 6.0.0?

As I already mentioned, I&apos;m using the latest stable GCC and libstdc++ and it&apos;s 8.2.1.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1457070</commentid>
    <comment_count>10</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-09-06 07:30:19 -0700</bug_when>
    <thetext>(In reply to Tomas Popela from comment #9)
&gt; (In reply to Yusuke Suzuki from comment #8)
&gt; &gt; I think GCC requirement of WebKit is 6.0.0.
&gt; &gt; Do you use pre-5.1 libstdc++ with GCC 6.0.0?
&gt; 
&gt; As I already mentioned, I&apos;m using the latest stable GCC and libstdc++ and
&gt; it&apos;s 8.2.1.

Do you have any idea why it does not include the fix?
I have debian unstable environment in x86_64, which gcc and libstdc++ are 8.2.0-5.
And it includes the above fix.

$ apt show libstdc++-8-dev
Package: libstdc++-8-dev
Version: 8.2.0-5
Priority: optional
Section: libdevel
Source: gcc-8
Maintainer: Debian GCC Maintainers &lt;debian-gcc@lists.debian.org&gt;
Installed-Size: 16.7 MB
Provides: libstdc++-dev
Depends: gcc-8-base (= 8.2.0-5), libgcc-8-dev (= 8.2.0-5), libstdc++6 (&gt;= 8.2.0-5), libc6-dev (&gt;= 2.13-5)
Suggests: libstdc++-8-doc
Conflicts: libg++2.8-dev, libg++27-dev, libg++272-dev (&lt;&lt; 2.7.2.8-1), libstdc++2.10-dev (&lt;&lt; 1:2.95.3-2), libstdc++2.8-dev, libstdc++2.9-dev, libstdc++2.9-glibc2.1-dev, libstdc++3.0-dev
Homepage: http://gcc.gnu.org/
Tag: devel::library, role::devel-lib
Download-Size: 1,527 kB
APT-Manual-Installed: no
APT-Sources: http://ftp.jp.debian.org/debian unstable/main amd64 Packages
Description: GNU Standard C++ Library v3 (development files)
 This package contains the headers and static library files necessary for
 building C++ programs which use libstdc++.
 .
 libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which
 was included up to g++-2.95. The first version of libstdc++-v3 appeared
 in g++-3.0.

 216   │   template&lt;typename _Tp&gt;
 217   │     _GLIBCXX14_CONSTEXPR
 218   │     inline const _Tp&amp;
 219   │     max(const _Tp&amp; __a, const _Tp&amp; __b)
 220   │     {
 221   │       // concept requirements
 222   │       __glibcxx_function_requires(_LessThanComparableConcept&lt;_Tp&gt;)
 223   │       //return  __a &lt; __b ? __b : __a;
 224   │       if (__a &lt; __b)
 225   │        return __b;
 226   │       return __a;
 227   │     }

in /usr/include/c++/8/bits/stl_algobase.h.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1457073</commentid>
    <comment_count>11</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-09-06 07:34:45 -0700</bug_when>
    <thetext>(In reply to Tomas Popela from comment #9)
&gt; (In reply to Yusuke Suzuki from comment #8)
&gt; &gt; I think GCC requirement of WebKit is 6.0.0.
&gt; &gt; Do you use pre-5.1 libstdc++ with GCC 6.0.0?
&gt; 
&gt; As I already mentioned, I&apos;m using the latest stable GCC and libstdc++ and
&gt; it&apos;s 8.2.1.

Can you show the implementation of `std::max` in your environment?
Can we fix the bug by including &lt;algorithm&gt; in RegisterState.h? (speculative fix).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1457107</commentid>
    <comment_count>12</comment_count>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-09-06 09:37:41 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #11)
&gt; Can you show the implementation of `std::max` in your environment?
&gt; Can we fix the bug by including &lt;algorithm&gt; in RegisterState.h? (speculative
&gt; fix).

In the end we figure out that it&apos;s a GCC bug - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70124. I&apos;m going to commit the current patch with updated changelog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1457109</commentid>
    <comment_count>13</comment_count>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2018-09-06 09:41:40 -0700</bug_when>
    <thetext>Committed r235740: &lt;https://trac.webkit.org/changeset/235740&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1457110</commentid>
    <comment_count>14</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-09-06 09:42:27 -0700</bug_when>
    <thetext>&lt;rdar://problem/44184508&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>348487</attachid>
            <date>2018-08-29 23:20:18 -0700</date>
            <delta_ts>2018-08-29 23:32:58 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-189078-20180830082017.patch</filename>
            <type>text/plain</type>
            <size>1431</size>
            <attacher name="Tomas Popela">tpopela</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjM1NDU5CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCA1
N2I0ZTk0MzRkYzM2ZGY4OTE5MmFkZTA2YWMzNGZkOWYxYjRiYjQzLi41Y2ZiMjgxNjE5YzQ4OThi
MmQxOWQzNTBjMWQyYzhhNDNiNmIyMDlhIDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
MyArMSwxNCBAQAorMjAxOC0wOC0yOSAgVG9tYXMgUG9wZWxhICA8dHBvcGVsYUByZWRoYXQuY29t
PgorCisgICAgICAgIFtKU0NdIEJ1aWxkIGJyb2tlbiBhZnRlciByMjM0OTc1IG9uIHMzOTB4LCBw
cGM2NGxlLCBhcm12N2hsCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVn
LmNnaT9pZD0xODkwNzgKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKwor
ICAgICAgICBVc2UgdGVybmFyeSBvcGVyYXRvciBpbnN0ZWFkIG9mIHN0ZDo6bWF4KCkuCisKKyAg
ICAgICAgKiBoZWFwL1JlZ2lzdGVyU3RhdGUuaDoKKwogMjAxOC0wOC0yOCAgTWFyayBMYW0gIDxt
YXJrLmxhbUBhcHBsZS5jb20+CiAKICAgICAgICAgRml4IGJpdC1yb3R0ZWQgSW50ZXJwcmV0ZXI6
OmR1bXBSZWdpc3RlcnMoKSBhbmQgbW92ZSBpdCB0byB0aGUgVk1JbnNwZWN0b3IuCmRpZmYgLS1n
aXQgYS9Tb3VyY2UvSmF2YVNjcmlwdENvcmUvaGVhcC9SZWdpc3RlclN0YXRlLmggYi9Tb3VyY2Uv
SmF2YVNjcmlwdENvcmUvaGVhcC9SZWdpc3RlclN0YXRlLmgKaW5kZXggYmFhZWY0Yzc4NTdiZTg1
NDEzODA0NDQ4ZWM4Nzk1MWRiM2YyMDk4OS4uYjMwMzdkYmExOGNmNGQ5YmM1YWI1YzI1MTY4ZDc2
NzBhNTczMWQyOSAxMDA2NDQKLS0tIGEvU291cmNlL0phdmFTY3JpcHRDb3JlL2hlYXAvUmVnaXN0
ZXJTdGF0ZS5oCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9oZWFwL1JlZ2lzdGVyU3RhdGUu
aApAQCAtMTY2LDcgKzE2Niw3IEBAIHVzaW5nIFJlZ2lzdGVyU3RhdGUgPSBqbXBfYnVmOwogI3By
YWdtYSB3YXJuaW5nKGRpc2FibGU6IDQ2MTEpCiAjZW5kaWYKICNkZWZpbmUgQUxMT0NBVEVfQU5E
X0dFVF9SRUdJU1RFUl9TVEFURShyZWdpc3RlcnMpIFwKLSAgICBhbGlnbmFzKHN0ZDo6bWF4KGFs
aWdub2Yodm9pZCopLCBhbGlnbm9mKFJlZ2lzdGVyU3RhdGUpKSkgUmVnaXN0ZXJTdGF0ZSByZWdp
c3RlcnM7IFwKKyAgICBhbGlnbmFzKGFsaWdub2Yodm9pZCopID4gYWxpZ25vZihSZWdpc3RlclN0
YXRlKSA/IGFsaWdub2Yodm9pZCopIDogYWxpZ25vZihSZWdpc3RlclN0YXRlKSkgUmVnaXN0ZXJT
dGF0ZSByZWdpc3RlcnM7IFwKICAgICBzZXRqbXAocmVnaXN0ZXJzKQogCiAjaWYgQ09NUElMRVIo
TVNWQykK
</data>
<flag name="review"
          id="366121"
          type_id="1"
          status="+"
          setter="mark.lam"
    />
          </attachment>
      

    </bug>

</bugzilla>