This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Speed-up sprintf() family of functions.


Andrew Lunn <andrew@lunn.ch> writes:

>> The updated patch is attached.
>> 
> Hi Sergei
>
> Im looking at the patch now ready for including into anoncvs. I have
> one minor problem which needs fixing. When i compile for the linux
> target with gcc 4.1.2 i get a warning:
>
> lunn@londo:~/eCos/work$ make -s
> headers finished
> /home/lunn/eCos/anoncvs-clean/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx: In function 'int vsnprintf(char*, size_t, const char*, char*)':
> /home/lunn/eCos/anoncvs-clean/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx:106: warning: dereferencing type-punned pointer will break strict-aliasing rules
> build finished
>
> Could you try to fix this please. Once i have a fix for this i will
> commit your change.

I don't think it's my patch problem, as initial vsnprintf implementation
had almost exactly the same line:

    rc = vfnprintf( (FILE *)&my_stream, size, format, arg );

and thus should have been triggering the same warning.

BTW, GCC folks admit themselves that this warning is very weak in GCC as
it has too many false negatives and too many false positives, the
latter being exactly the case here.

Anyway, if somebody suggests how to fix this warning in the *initial*
vsnprintf implementation, I'll be happy to adopt the solution.

-- Sergei Organov.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]