Re: -Wstringop-overflow warning on compiling info

Gavin Smith <[email protected]>
Newsgroups gmane.comp.tex.texinfo.bugs
Message-ID <aXfRFvmxm1FScDY6@orangestar>
On Fri, Jan 23, 2026 at 06:30:10PM +0000, Gavin Smith wrote:
> On Fri, Jan 23, 2026 at 12:11:27AM +0100, Patrice Dumas wrote:
> > > I haven't understand fully all the reasons for the changes to types in
> > > this code.  I expect this problem is a hangover from people deciding to
> > > convert from unsigned integer types to signed integer types or vice versa.
> > > 
> > > (In commit 219bed49caf262a (2012-11-17), types were changed from long (signed)
> > > to size_t (unsigned).  This was further changed in the commit above.)
> > 
> > I can say for the changes I made.  The idea was to avoid mixing signed
> > and unsigned integers because it can easily lead to bugs because going
> > through 0 may get unnoticed, and also probably because it is undefined
> > behaviour.  When this is anavoidable, at least add something that shows
> > that a conversion is needed or such.
> 
> Yes, that sounds like a good idea.  Your changes make sense, as far as I can
> tell.  It's probably good to use signed integer types in more places, where
> possible.  It's just led to a compiler warning in this case but there is
> likely no real problem that wasn't there before.
> 

FWIW there was also the same warning from code in info/makedoc.c which 
hasn't been touched since 2002 or earlier.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.