[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] mbsstr: fix warnings reported by gcc -Wcast-align on ARM

From: Dmitry V. Levin
Subject: Re: [PATCH] mbsstr: fix warnings reported by gcc -Wcast-align on ARM
Date: Mon, 4 Oct 2010 22:15:39 +0400


On Sun, Oct 03, 2010 at 01:27:10PM +0200, Bruno Haible wrote:
> Dmitry V. Levin wrote:
> > * lib/mbsstr.c (knuth_morris_pratt_multibyte): Assign a raw memory
> > pointer returned by nmalloca() right to the variable of type
> > "mbchar_t *" thus removing redundant proxy variable of type "char *".
> Thanks for the patch, but I don't feel that it is an improvement over the
> existing code: it makes the code harder to understand.
> I allocate a variable 'memory' that contains both 'needle_mbchars' and
> 'table'. When I call free(memory), it is clear that both are freed.
> Whereas in your rewrite, 'table' becomes an backpack on 'needle_mbchars',
> and when you write free(needle_mbchars), one keeps wondering why there
> is no free(table).
> > mbsstr.c:50: error: cast increases required alignment of target type 
> > [-Wcast-align]
> How is one supposed to write address computations needed for dissecting
> a memory block into several memory blocks, when this warning is enabled?
> With 'void *' I cannot do address arithmetic. With 'char *' I get these
> warnings. 'uintptr_t'? Berk, no.
> In summary, please turn off -Werror when compiling gnulib code. We don't
> guarantee the absence of warnings.

The project where -Werror is enabled by default is GNU grep.  If the
statement that gnulib code may emit -Wcast-align warnings is correct, then
I suggest to remove either -Wcast-align or $(WERROR_CFLAGS) when compiling
gnulib in grep.


Attachment: pgpJ20MgsQz5_.pgp
Description: PGP signature

reply via email to

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