Re: [Mesa-dev] [PATCH 2/2] ac/nir: Make intrinsic_name buffer long enough

2017-06-21 Thread Grazvydas Ignotas
On Wed, Jun 21, 2017 at 6:59 PM, James Legg  wrote:
> When using cmpswap on an image, it was being trunctated to
> lvm.amdgcn.image.atomic.cmpswa, with the coords type missing entirely.

You could add an assert to catch this easier in future, like

MAYBE_UNUSED int ret;
...
ret = snprintf(intrinsic_name, ...
assert(ret < sizeof(intrinsic_name));

In either case
Reviewed-by: Grazvydas Ignotas 

> ---
>  src/amd/common/ac_nir_to_llvm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 49117d2..3a26668 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -3366,7 +3366,7 @@ static LLVMValueRef visit_image_atomic(struct 
> nir_to_llvm_context *ctx,
> const char *base_name = "llvm.amdgcn.image.atomic";
> const char *atomic_name;
> LLVMValueRef coords;
> -   char intrinsic_name[32], coords_type[8];
> +   char intrinsic_name[41], coords_type[8];
> const struct glsl_type *type = glsl_without_array(var->type);
>
> if (ctx->stage == MESA_SHADER_FRAGMENT)
> --
> 2.9.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] ac/nir: Make intrinsic_name buffer long enough

2017-06-21 Thread James Legg
When using cmpswap on an image, it was being trunctated to
lvm.amdgcn.image.atomic.cmpswa, with the coords type missing entirely.
---
 src/amd/common/ac_nir_to_llvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 49117d2..3a26668 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3366,7 +3366,7 @@ static LLVMValueRef visit_image_atomic(struct 
nir_to_llvm_context *ctx,
const char *base_name = "llvm.amdgcn.image.atomic";
const char *atomic_name;
LLVMValueRef coords;
-   char intrinsic_name[32], coords_type[8];
+   char intrinsic_name[41], coords_type[8];
const struct glsl_type *type = glsl_without_array(var->type);
 
if (ctx->stage == MESA_SHADER_FRAGMENT)
-- 
2.9.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev