[cfe-dev] clang memory corruption

Prathamesh Kulkarni bilbotheelffriend at gmail.com
Tue Jan 7 04:14:46 PST 2014


Hi, when I compiled the following file (foo.c), with clang-3.4:
(clang foo.c -c):

#if !defined(FOO)
#define BAR
int x;
#endif

I got the following error:
foo.c:1:4: warning: 'FOO' is used as a header guard here, followed by
#define of a different macro [-Wheader-guard]
*** Error in `/usr/bin/clang': malloc(): memory corruption:
0x0000000002d285f0 ***
and i have to forcibly kill clang process by ctrl+C

However replacing, #if !defined(FOO) by #ifndef FOO works fine.

clang -v:
Ubuntu clang version 3.4-1ubuntu1 (trunk) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix

Thanks and Regards,
Prathamesh



More information about the cfe-dev mailing list