On Thursday 22 January 2009 16:23:30 Dmitry Smirnov wrote:
[You top-posted here; please don't do this. If you do it again, I
will simply decline to answer]
> Ok, why it successfuly compiles with -O2?
> Why it does not produce error in that case?
Already answered, in the reference Greg pointed you to...
> > Answered here:
> > http://cygwin.com/ml/cygwin/2009-01/msg00665.html
(...and this was his original answer to *you*, when you asked this
same question on the cygwin list).
> > You're trying to compile code that depends on a posix function,
> > so it's not portable. Wouldn't the correct solution be to make
> > the code portable? MinGW is minimalist: it uses the C runtime
> > provided with ms windows, and it doesn't try to emulate posix.
Yes, it is a POSIX function, and there is no external implementation
provided for native MS-Windows platforms. However, GCC provides a
built-in (a.k.a. intrinsic) implementation, which is expanded inline,
when you allow the compiler to optimise, as you do with `-O2'; such
inline expansion is suppressed, when you disable optimisation with
`-O0', and the linker then has to look for an external implementation,
which does not exist.
You can force the expansion of the intrinsic, even with `-O0', by
referring to it explicitly; try adding '-D ffs=__builtin_ffs' to the
CFLAGS, when you configure or make the application.
--
Regards,
Keith.
|