<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:w = "urn:schemas-microsoft-com:office:word" xmlns:m = "http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=Generator content="Microsoft Word 15 (filtered medium)">
<STYLE>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</STYLE>

<STYLE><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.Code, li.Code, div.Code
        {mso-style-name:Code;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-top:6.0pt;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></STYLE>
</HEAD>
<BODY lang=EN-GB link=blue vLink=purple>
<DIV>
<DIV style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">I posted a working and tested patch last night. Please feel free to commit it, I haven't the rights to do it.<BR><BR>Niklas</DIV></DIV>
<DIV dir=ltr>
<HR>
<SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">Från: </SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><A href="mailto:simonpj@microsoft.com">Simon Peyton Jones</A></SPAN><BR><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">Skickat: </SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">‎2014-‎07-‎18 15:55</SPAN><BR><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">Till: </SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><A href="mailto:metaniklas@gmail.com">Niklas Larsson</A>; <A href="mailto:johan.tibell@gmail.com">Johan Tibell</A></SPAN><BR><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">Kopia: </SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><A href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</A></SPAN><BR><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">Ämne: </SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">RE: Windows breakage -- again</SPAN><BR><BR></DIV>
<DIV class=WordSection1>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; mso-fareast-language: EN-US">Thank you all for pursuing this.  I gather that you know what is going on, so no further info needed from me.  Yell if it is otherwise.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; mso-fareast-language: EN-US"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; mso-fareast-language: EN-US">Meanwhile, is the fix imminent, or should we revert Johan’s patch?<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; mso-fareast-language: EN-US"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; mso-fareast-language: EN-US">Simon<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; mso-fareast-language: EN-US"><o:p> </o:p></SPAN></P>
<DIV style="BORDER-TOP: medium none; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm; PADDING-LEFT: 4pt; BORDER-LEFT: blue 1.5pt solid; PADDING-RIGHT: 0cm">
<DIV>
<DIV style="BORDER-TOP: #e1e1e1 1pt solid; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; PADDING-BOTTOM: 0cm; PADDING-TOP: 3pt; PADDING-LEFT: 0cm; BORDER-LEFT: medium none; PADDING-RIGHT: 0cm">
<P class=MsoNormal><B><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">From:</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'"> Niklas Larsson [mailto:metaniklas@gmail.com] <BR><B>Sent:</B> 16 July 2014 19:58<BR><B>To:</B> Johan Tibell; Simon Peyton Jones<BR><B>Cc:</B> ghc-devs@haskell.org<BR><B>Subject:</B> Re: Windows breakage -- again<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p> </o:p></P>
<DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">I get the same failure when I try to build HEAD. Turns out the error occurs on the 32-bit Windows build, and my successful build was a 64-bit build. My 64-bit build still succeeds.<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">Also, gcc is 4.5.2 on 32-bit, not 4.6.3 as on 64-bit.<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">Niklas<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">2014-07-16 14:48 GMT+02:00 Niklas Larsson <<A href="mailto:metaniklas@gmail.com" target=_blank>metaniklas@gmail.com</A>>:<o:p></o:p></P>
<BLOCKQUOTE style="BORDER-TOP: medium none; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm; PADDING-LEFT: 6pt; MARGIN-LEFT: 4.8pt; BORDER-LEFT: #cccccc 1pt solid; PADDING-RIGHT: 0cm; MARGIN-RIGHT: 0cm">
<DIV>
<DIV>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">I have built ghc on windows after that was added with no issue.<BR><BR>I can take a look this evening and  see how HEAD works for me.<BR><BR>The standard gcc in the tarballs is 4.6.3, which is getting long in the tooth, there is an issue on trac to upgrade it. <BR><BR>-- Niklas<o:p></o:p></SPAN></P></DIV></DIV>
<DIV>
<DIV class=MsoNormal style="MARGIN-BOTTOM: 6pt; TEXT-ALIGN: center; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt" align=center>
<HR align=center SIZE=2 width="100%">
</DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">Från: </SPAN></B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'"><A href="mailto:johan.tibell@gmail.com" target=_blank>Johan Tibell</A></SPAN><BR><B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">Skickat: </SPAN></B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">‎2014-‎07-‎16 09:57</SPAN><BR><B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">Till: </SPAN></B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'"><A href="mailto:simonpj@microsoft.com" target=_blank>Simon Peyton Jones</A></SPAN><BR><B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">Kopia: </SPAN></B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'"><A href="mailto:ghc-devs@haskell.org" target=_blank>ghc-devs@haskell.org</A></SPAN><BR><B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">Ämne: </SPAN></B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri','sans-serif'">Re: Windows breakage -- again</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">You can rollback the commit (git revert <SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">4ee4ab01c1d97845aecb7707ad2f9a80933e7a49) and push that to the repo if you wish. I will try to re-add the primop again after I figure out what's wrong.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">On Wed, Jul 16, 2014 at 9:37 AM, Johan Tibell <<A href="mailto:johan.tibell@gmail.com" target=_blank>johan.tibell@gmail.com</A>> wrote:<o:p></o:p></P>
<BLOCKQUOTE style="BORDER-TOP: medium none; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm; PADDING-LEFT: 6pt; MARGIN-LEFT: 4.8pt; BORDER-LEFT: #cccccc 1pt solid; PADDING-RIGHT: 0cm; MARGIN-RIGHT: 0cm">
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">I added some primops about a month ago (4ee4ab01c1d97845aecb7707ad2f9a80933e7a49) that call __sync_fetch_and_add, a gcc/llvm builtin. I'm a bit surprised to see this error. The GCC manual [1] says: <o:p></o:p></P>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">> " Not all operations are supported by all target processors. If a particular operation cannot be implemented on the target processor, a warning will be generated and a call an external function will be generated. The external function will carry the same name as the builtin, with an additional suffix `_n' where n is the size of the data type."<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">I'm a bit surprised by this error for two reasons:<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"> * A call to that symbol should only be generated if the CPU doesn't support the atomic instructions. What CPU model does Windows report that you have?<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"> * gcc should define such a symbol. For me the following test program compiles:<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">#include <stdint.h><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">uint8_t test(uint8_t* ptr, uint8_t val) {<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">  return __sync_fetch_and_add_1(ptr, val);<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">}<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">int main(void) {<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">  uint8_t n;<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">  return test(&n, 1);<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">}<o:p></o:p></P></DIV></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">Does that compile for you? Which version of GCC do we end up using on Windows?<o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">The reported symbol (<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">___sync_fetch_and_add_1) has three leading underscores, that looks weird. Can you compile just libraries/ghc-prim/cbits/atomic.c and see if it's indeed GCC that generates a reference to that symbol?</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P></DIV>
<DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">1. <A href="http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html" target=_blank>http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html</A><o:p></o:p></P></DIV></DIV></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt"><o:p> </o:p></P>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 6pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 6.0pt">On Wed, Jul 16, 2014 at 12:29 AM, Simon Peyton Jones <<A href="mailto:simonpj@microsoft.com" target=_blank>simonpj@microsoft.com</A>> wrote:<o:p></o:p></P></DIV></DIV>
<BLOCKQUOTE style="BORDER-TOP: medium none; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm; PADDING-LEFT: 6pt; MARGIN-LEFT: 4.8pt; BORDER-LEFT: #cccccc 1pt solid; PADDING-RIGHT: 0cm; MARGIN-RIGHT: 0cm">
<DIV>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">Aargh!  The Windows build has broken – again.  I can’t build GHC on my laptop any more.  <o:p></o:p></P></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV></DIV></BLOCKQUOTE></DIV></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV></DIV></DIV></DIV><BR>
<DIV>[Hela det ursprungliga meddelandet tas inte med.]</DIV></BODY></HTML>