[Top][All Lists]

[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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]