Hi all, Could a gatekeeper review the attached patch for bug877, that happens when the program's last line does not end with a new line character.
symptoms -------- This failure happens when the program being compiled does not end with a new line character(LF) in the last line. The test case has the last line that does not end with LF. $ cat hello-no-LF.c #include <stdio.h> int main() { printf("Hello World\n");} <== This is EOF and there is no LF here. $ opencc hello-no-LF.c -S $ opencc hello-no-LF.s $ ./a.out Segmentation fault This is because one assembly line is generated after the comment line as follows. # 4 printf("Hello World\n");} movq $(.rodata),%rdi # [0] .rodata This should have been as follows. # 4 printf("Hello World\n");} movq $(.rodata),%rdi # [0] .rodata fix --- The fix is already there in cgdwarf.cxx but it is guarded with #ifdef's as follows. #if defined(TARG_SL) So, my fix is to remove the #ifdef's. Also, the guarded fix does not handle a small corner case where the first character of the read buffer is NULL, which is handled in this fix. Some other changes include improving performance (calling strlen just once as opposed to multiple times) and good coding practice (using 'sizeof' rather than constant numbers). Thanks zhuqing
no-LF.patch
Description: Binary data
------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel