[Mesa-dev] [android-x86-devel] [PATCH 1/2] android: fix building error in st_glsl_to_tgsi

Ilia Mirkin imirkin at alum.mit.edu
Tue May 31 15:05:38 UTC 2016


[removing closed or non-existent android-x86-devel list from cc -
reply here to avoid annoyance for others]

On Tue, May 31, 2016 at 11:00 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Tue, May 31, 2016 at 10:39 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> On 31 May 2016 at 01:00, Mauro Rossi <issor.oruam at gmail.com> wrote:
>>> Fixes the following building error:
>>>
>>> bionic/libc/include/string.h:105:33: error: call to '__memcpy_dest_size_error'
>>> declared with attribute error: memcpy called with size bigger than destination
>>>
>>> Cc: <mesa-stable at lists.freedesktop.org>
>>> ---
>>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> index aa443a5..46079d2 100644
>>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> @@ -3455,7 +3455,7 @@ glsl_to_tgsi_visitor::visit_image_intrinsic(ir_call *ir)
>>>     if (reladdr.file != PROGRAM_UNDEFINED) {
>>>        emit_arl(ir, sampler_reladdr, reladdr);
>>>        image.reladdr = ralloc(mem_ctx, st_src_reg);
>>> -      memcpy(image.reladdr, &sampler_reladdr, sizeof(reladdr));
>>> +      memcpy(image.reladdr, &sampler_reladdr, sizeof(sampler_reladdr));
>> Pretty sure that the original code is correct/intentional, as one
>> wants to copy only the reladdr part of sampler_reladdr. Perhaps one
>> could use an assignment operator here.
>>
>> Ilia, any suggestions ?
>
> This code is very confused, which probably reflects my state of mind
> as I was trying to add indirect sampler support a very long time ago.
> sampler_reladdr is a st_dst_reg while image.reladdr (and the ralloc
> right above it) are st_src_reg's. They have similar but different
> fields. I suspect all of these should be changed to
>
> *image.reladdr = st_src_reg(sampler_reladdr)
>
> or similar, whenever I did that memcpy() bs with sampler_reladdr. Nice find!
>
>   -ilia


More information about the mesa-dev mailing list