H:\DOWNLOAD\gcc-4.2.2\gcc-4.2.2\gcc\testsuite\gcc.c-torture\execute\builtins\lib memset.c: line 15 n[(char *) dst] = c; => (char *) dst[n] = c;
This code written as a[(char*)b] is valid even C code, in C, d[e] is the same as *(d+e) so d[e] is the same as e[d]. So the code is valid and does the correct thing. There is no bug here. Unless you can explain exactly why you want the change, I am going to close this as invalid.
IMO the proposed change would make the code more readable.
(In reply to comment #2) > IMO the proposed change would make the code more readable. Johan, the code you quote is in a file from the testsuite. Such code is used to test for some correct behavior under various circumstances. Therefore, there is typically a very good reason for the code to be written like that. Moreover, in the testsuite you will find not only unreadable code but also code that is broken on purpose to test that the compiler can handle such code.