为了用llvm打印unicode字符,我在llvm ir中使用了setLocale:
call i8* @setlocale(i32 6, i8* getelementptr inbounds ([1 x i8]* @pe, i32 0, i32 0)) nounwind
其中@pe的定义如下:
@pe = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
但是,我收到以下错误:
*** glibc detected *** ./test/bin/executable: free(): invalid next size (fast): 0x08f93140 ***
我使用gdb来调试程序,回溯如下:
#0 0xb7728424 in __kernel_vsyscall ()
#1 0xb74aee71 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xb74b234e in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0xb74e5577 in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0xb74ef961 in ?? () from /lib/i386-linux-gnu/libc.so.6
#5 0xb74f128b in ?? () from /lib/i386-linux-gnu/libc.so.6
#6 0xb74f441d in free () from /lib/i386-linux-gnu/libc.so.6
#7 0xb74a6730 in ?? () from /lib/i386-linux-gnu/libc.so.6
#8 0xb74a5299 in ?? () from /lib/i386-linux-gnu/libc.so.6
#9 0xb74a4cd1 in setlocale () from /lib/i386-linux-gnu/libc.so.6
...
如何解决此问题?任何帮助将不胜感激