From murdoch.duncan at gmail.com  Mon Apr  4 13:29:10 2016
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Mon, 4 Apr 2016 07:29:10 -0400
Subject: [Rd] Optimization bug when byte compiling with gcc 5.3.0 on
 windows
In-Reply-To: <CAF5kcVVy6mGeQ0kQOTviR53ehOf64xQHoVGdLMKg0tzOMFDr_A@mail.gmail.com>
References: <CAF5kcVVy6mGeQ0kQOTviR53ehOf64xQHoVGdLMKg0tzOMFDr_A@mail.gmail.com>
Message-ID: <57025006.1090301@gmail.com>

On 03/04/2016 9:44 PM, Ray Donnelly wrote:
> Hi,
>
> Apologies for breaking the threading on this, I've only just signed up to
> the list and the last email was from September 2015.
>
> I've started to look into building R for Windows using MSYS2 as both the
> build environment and tools + libraries provider (where possible). I've
> managed to get the testsuite to pass on a recent MSYS2 MinGW-w64 x86-64 GCC:
> gcc.exe (Rev1, Built by MSYS2 project) 5.3.1 20160228
>
> I've attached two patches that I needed, described below. I hope this is
> the appropriate place and way to suggest patches. Comments for improvements
> are very welcome.

There were no patches attached, just the link to the mingw-w64 project 
on Github.

Generally the way to produce patches for R is to use svn diff on a 
checked out working copy of the trunk. On Windows, Tortoisesvn makes 
this really simple.  Then the patch will include information about the 
revision it's based on.  You then upload it to bugs.r-project.org, along 
with a description of the problem it solves, and mark it as a bug fix or 
enhancement request.

>
> 0005-Win32-Extend-sqrt-NA_real_-hack-to-all-GCC-versions.patch
> Removes the __GNUC__ <= 4 for Windows ISNAN R_sqrt hack and doesn't replace
> it with any version check since I don't see any reason to second-guess when
> it might be fixed. When it is fixed in MinGW-w64 we can just remove the
> hack and be happy (I would hope to be able to get round to this in the next
> few months).

I can see increasing the version limit when we commit to gcc 5.x, but I 
think the point of the test is to remind users of new versions to remind 
the developers that they have a bug.  If we work around it forever, it 
will never get fixed.

>
> 0006-Win32-GCC-5.3-Fix-ISNAN-int-emits-UD2-insn.patch
> The reason that boxplot.stats() was crashing was because when isnan() is
> called with an int it emits a UD2 instruction to force a crash, so let us
> just cast the input value to a double to prevent that. The code for this
> can be seen here:
> https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/crt/math.h#L612-L622

This one I can't guess at without seeing the patch.

Duncan Murdoch


>
> --
>
> Best regards,
>
> Ray Donnelly,
>
> Continuum Analytics Inc.
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Optimization bug when byte compiling with gcc 5.3.0 on windows
Duncan Murdoch