On Wed, Oct 18, 2017 at 10:22 AM, Michal Karm <michal.baba...@gmail.com> wrote:
> On 10/18/2017 03:39 PM, William A Rowe Jr wrote:
>> In building your repro case, you'll need to toggle several flags to see how 
>> to
>> trip this up;
>>
>> |- CMAKE_C_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /DNDEBUG +
>> CMAKE_C_FLAGS_RELEASE:STRING=/O2 /Wall /Zi|
>> I'd start with your problem case /O2 /Wall /Zi, and retest adding /Ob2, /MD
>> and /NDEBUG in that order. Simply slice and dice until you find the flags
>> which cause the negative min limit to fail ERANGE, but the positive max
>> case to not toggle errno.
>>
>> Good luck
>
> The "problem" is the presence or lack thereof of /MD.
>
> Updated notes: https://github.com/Karm/_strtoi64_reproducer#conclusion
>
> I'm gonna try to fiddle with VS and compare asm for that part.
> I don't understand why not having /MD is a problem for this single threaded
> dead simple case.
>
> I'm also bewildered as to why my trimmed down example works
> even without /MD...

There are four different representations of _strtoi64() in the
different c libraries
(/MD, /MT, their debug flavors) and then multiple representations depending
on your choice of the optimization level combined with /Ob# (1 or 2) for inline
expansion. One or more is clearly bugged.

Another option is that the wrong errno is in use in your resulting
testall.exe vs
the libapr-1.dll, because of mismatched c libraries, but that doesn't
explain why
the negative test correctly toggles errno, while the positive test does not.

Reply via email to