[PATCH] D49503: [test-suite] Added Image Processing Kernels Using Benchmark Library: Dither Algorithms
Pankaj via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 27 14:48:50 PDT 2018
proton added inline comments.
================
Comment at: MicroBenchmarks/ImageProcessing/Dither/main.cpp:36
+
+ initializeRandomImage((int *)*inputImage, HEIGHT, WIDTH);
+
----------------
Meinersbur wrote:
> Does this work? It dereferences the pointer returned by malloc (which should be the //uninitialized// first bytes of the memory allocated be malloc) and then casts it to a pointer. Id' expect this to result in a segfault.
Yes, It works properly because the pointer returned by malloc is casted as **int (*) [][]**. So to access the array we have to first dereference the pointer (use it as (*inputImage)[i][j]).
https://reviews.llvm.org/D49503
More information about the llvm-commits
mailing list