On Fri, Sep 29, 2017 at 2:25 PM, Jason Ekstrand <[email protected]> wrote:
> diff --git a/src/mesa/drivers/dri/i965/gen6_constant_state.c 
> b/src/mesa/drivers/dri/i965/gen6_constant_state.c
> index b2e357f..93a12c7 100644
> --- a/src/mesa/drivers/dri/i965/gen6_constant_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_constant_state.c
> @@ -24,21 +24,84 @@
>  #include "brw_context.h"
>  #include "brw_state.h"
>  #include "brw_defines.h"
> +#include "brw_program.h"
>  #include "intel_batchbuffer.h"
>  #include "intel_buffer_objects.h"
>  #include "program/prog_parameter.h"
>
> +static uint32_t
> +f_as_u32(float f)
> +{
> +   return *(uint32_t *)&f;
> +}

PSA: This breaks C's aliasing rules and is not allowed in Mesa. GCC
warns about this, at least when optimizing.

I've pushed a trivial patch that uses a union instead:

-   return *(uint32_t *)&f;
+   union fi fi = { .f = f };
+   return fi.ui;
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to