short C code that uses AVX and fails under Cygwin

Warren Young wyml@etr-usa.com
Thu Jan 14 23:03:00 GMT 2016


On Jan 14, 2016, at 1:20 PM, Ilya Razenshteyn <ilyaraz@mit.edu> wrote:
> 
> the below C code fails under Cygwin.

It segfaults here.  Is that what you mean by “fails”?

> the environment is: Windows 8.1, Cygwin 2.3.1, GCC 4.9.3, CPU 'Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz’

It fails on my recently-updated Windows 10 64-bit VM running a recently-updated 64-bit Cygwin on an Intel(R) Core i7-3770 CPU @ 3.40GHz.

> int main(void) {
>  void *buf = malloc(1);

The problem isn’t the malloc, the problem is the pointer pushing ‘res’ 4 or 8 bytes down the stack.  The same thing happens with an int.

This feels like an alignment problem, so I started throwing other stuff ahead of res to see if I could make the symptom go away.  This is the smallest object I’ve been able to make that does that:

      uint8_t x[20] = { 0 };

I haven’t tried every value between 1 and 19, but all of the obvious ones (8, 10, 12, 16) fail.  I don’t know what makes 20 magic.
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list