[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using stpcpy
From: |
Eli Zaretskii |
Subject: |
Re: Using stpcpy |
Date: |
Sat, 27 Dec 2014 22:17:45 +0200 |
> From: David Engster <address@hidden>
> Cc: address@hidden, address@hidden
> Date: Sat, 27 Dec 2014 21:03:10 +0100
>
> > Incredible as it sounds, in an optimized build, GCC (sometimes?) calls
> > stpcpy even though the source calls strcpy, provided that the
> > prototype of stpcpy is in scope. In this case, ntlib.c includes
> > windows.h, which includes string.h, which comes from lib/string.h,
> > which declares the prototype of stpcpy, and that is enough to trigger
> > this misfeature.
> >
> > I fixed this by switching the order of the libraries, as suggested,
> > but only because doing so is TRT in general.
>
> Yes, it seems gcc optimizes this because of the following strlen
> call. You can disable this optimization with -fno-optimize-strlen.
GCC shouldn't have done that by default. It's nasty.
- Re: Using stpcpy, (continued)
- Re: Using stpcpy, Eli Zaretskii, 2014/12/26
- Re: Using stpcpy, Dani Moncayo, 2014/12/26
- Re: Using stpcpy, cg, 2014/12/27
- Re: Using stpcpy, Eli Zaretskii, 2014/12/27
- Re: Using stpcpy, Dani Moncayo, 2014/12/27
- Re: Using stpcpy, Eli Zaretskii, 2014/12/27
- Re: Using stpcpy, Dani Moncayo, 2014/12/27
- Re: Using stpcpy, cg, 2014/12/27
- Re: Using stpcpy, Eli Zaretskii, 2014/12/27
- Re: Using stpcpy, David Engster, 2014/12/27
- Re: Using stpcpy,
Eli Zaretskii <=
- Re: Using stpcpy, Eli Zaretskii, 2014/12/27
- Re: Using stpcpy, David Engster, 2014/12/27
- Re: Using stpcpy, Eli Zaretskii, 2014/12/27
- Re: Using stpcpy, Richard Stallman, 2014/12/28