[cfe-dev] clang memory corruption

Justin Bogner mail at justinbogner.com
Tue Jan 7 09:15:46 PST 2014

Prathamesh Kulkarni <bilbotheelffriend at gmail.com> writes:
> 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

I'm pretty sure this is fixed in the 3.4 release, by r192547.

More information about the cfe-dev mailing list