-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 16.10.2013 13:18, LRN wrote:
> On 15.10.2013 19:14, LRN wrote:
>> On 15.10.2013 16:34, LRN wrote:
>>> Testcase is attached. Some invocations of stpcpy work, some don't.
> 
>> expand_builtin_stpcpy() from gcc/builtins.c sheds some light on this
>> (when return value is ignored, stpcpy() is replaced with strcpy()).
>> After reading a diff between the asm output (at jon_y's suggestion) i
>> concluded that builtin stpcpy is not a full implementation. It's there
>> only to optimize for cases where second argument is known at compile
>> time. When that is not the case, it just calls system stpcpy. Which
>> isn't available :(
> 
>> Here are patches that add stpcpy() to mingw-w64.
> 
> Changed the patches in the way it was suggested on the IRC, used
> __mingw_printf() as a template for inlining.
> 

I've done two complete (with bootstrapping a mingw toolchain) sbuild
builds - one with current mingw-w64 crt/headers (with __mingw_stpcpy()
in libmingwex and a macro-guarded stpcpy() inline in string.h) and one
with patched mingw-w64 crt/headers (with plain stpcpy() in libmingwex
and a macro-guarded prototype in string.h).

Results for __mingw_stpcpy():
binutils fails to build (internal gettext implementation fails to build
- - fails to find stpcpy() at configure-time, compiles is own
implementation of stpcpy() and fails due to duplicate symbols).
gcc fails to build (same as binutils)
gettext fails to build (obviously)
libiberty (in gdb) does not find stpcpy, but gdb builds
glib fails to find stpcpy, but builds
libgcrypt fails to build
libunistring fails to find stpcpy, but builds
glib (in pkg-config) does not find stpcpy, but pkg-config builds

All of these failures are fixable (and i do have patches).

Results for plain stpcpy():
Everything builds.

So i'm really begin to question the wisdom of ktietz's suggestion that
stpcpy() should be kept unreachable unless string.h is included and
proper macros are defined.

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJSZJH/AAoJEOs4Jb6SI2CwhCQIAI/gfuVGZE/+Ds6V9hy7blJz
I9WjAgwPkR3ySJRHNmWqrlisDmhnFf4U4ghjh7FXggUD9gNg42OBlxxa9MmVO71x
5vHqMpL90Y7dE6Opwp3bfn3brHjG+xC9lpxDV6ZuCRLAa7Ed8yAymfMPRz82N+0J
5m0lU1J5C5OB+9qBn0uUK4kv2B4FdZLuHqLFlM2OKCCUTLnestttJyGpOyASoL0K
8YVu202e48mnpnZjdJdLEkRtRzCjRCf2r/fc3IWYw3HBRBy4EDEs9GUujkuWw05Y
u+WleLYcy3/9G80kdr4mDGIF5QPJL8VMHF3VDoLC3vL8GgwdzpexYQevLJLRt3I=
=Mq/u
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to