Re: Pointer arithmetic error

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

 



On Sat, 2008-06-28 at 00:32 +0100, David Given wrote:
> diff --git a/compile-i386.c b/compile-i386.c
> index 8526408..3bbc9c7 100644
> --- a/compile-i386.c
> +++ b/compile-i386.c
> @@ -1584,7 +1584,7 @@ static struct storage *emit_select_expr(struct
> expression *expr)
>  	/*
>  	 * Do the actual select: check the conditional for zero,
>  	 * move false over true if zero
> -	 */ 
> +	 */

Don't include whitespace changes in unrelated patches.  You have many
whitespace changes in this patch; I haven't commented on all of them.

> @@ -2040,7 +2040,7 @@ static struct symbol *evaluate_sizeof(struct
> expression *expr)
>  	if ((size < 0) || (size & 7))
>  		expression_error(expr, "cannot size expression");

This "size & 7" represents an assumption about bits_in_char as well; it
checks if the size represents an integral number of chars.  You'll need
to look for other instances of 7 as well, to catch cases like this.

> @@ -2074,7 +2074,7 @@ static struct symbol *evaluate_ptrsizeof(struct
> expression *expr)
>  	if (size & 7)
>  		size = 0;

Same problem here.

>  	 * storage for it..
>  	 */
>  	hash = find_storage_hash(pseudo, state->outputs);
> @@ -1829,8 +1829,8 @@ static void set_up_arch_entry(struct entrypoint
> *ep, struct instruction *entry)
>  
>  			in->type = REG_FRAME;
>  			in->offset = offset;
> -			
> -			offset += bits >> 3;
> +
> +			offset += bits / bits_in_char;

The first line represents a whitespace-only change.

> --- a/target.c
> +++ b/target.c
> @@ -11,6 +11,8 @@ struct symbol *ssize_t_ctype = &int_ctype;
>   */
>  int max_alignment = 16;
>  
> +int bits_in_unit = 8;
> +

Unused.

> @@ -483,7 +483,7 @@ static int escapechar(int first, int type,
> stream_t *stream, int *valp)
>  				int nr = 2;
>  				value -= '0';
>  				while (next >= '0' && next <= '9') {
> -					value = (value << 3) + (next-'0');
> +					value = (value*8) + (next-'0');

This does not relate to bits_per_char, and should not change.

- Josh Triplett


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux