On 02/19/2014 01:25 AM, Vinson Lee wrote:
> This patch fixes this GCC aggressive-loop-optimizations warning.
> 
> alignment.c: In function 'piglit_display':
> alignment.c:184:28: warning: iteration 32u invokes undefined behavior 
> [-Waggressive-loop-optimizations]
>     0x00010203 + 0x04040404 * i;
>                             ^

Because signed overflow is undefined?  Maybe the literals should also
get decorated with u.  Even after all these years, the weirdness in C
never fails to amaze me...

With or without u added to the literals,

Reviewed-by: Ian Romanick <[email protected]>

> alignment.c:182:2: note: containing loop
>   for (i = 0; i < EXPECTED_NUM_OUTPUTS; ++i) {
>   ^
> 
> Signed-off-by: Vinson Lee <[email protected]>
> ---
>  tests/spec/ext_transform_feedback/alignment.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/spec/ext_transform_feedback/alignment.c 
> b/tests/spec/ext_transform_feedback/alignment.c
> index dda8823..5014066 100644
> --- a/tests/spec/ext_transform_feedback/alignment.c
> +++ b/tests/spec/ext_transform_feedback/alignment.c
> @@ -151,7 +151,7 @@ enum piglit_result piglit_display(void)
>       GLuint *readback;
>       GLuint buffer[BUFFER_SIZE];
>       GLuint expected[BUFFER_SIZE];
> -     int i;
> +     unsigned int i;
>       GLboolean pass = GL_TRUE;
>  
>       glUseProgram(prog);
> 

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to