[cfe-dev] cfe-dev Digest, Vol 74, Issue 24

Robert Ankeney rrankene at gmail.com
Tue Aug 6 10:42:53 PDT 2013


On Tue, Aug 6, 2013 at 5:11 PM, <cfe-dev-request at cs.uiuc.edu> wrote:

>
> Date: Tue, 6 Aug 2013 08:10:46 -0700 (PDT)
> From: Rambo <hunanlwm at sina.cn>
> To: cfe-dev at cs.uiuc.edu
> Subject: [cfe-dev] error as "glibc detected" occurd in CItutorial6.cpp
>         when clang version is 3.3
> Message-ID: <1375801845981-4033763.post at n3.nabble.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hi,
>    I can compile and run CItutorial6.cpp Perfectly when clang version is
> 3.1,Now I reset my OS(ubuntu 12.04 ) and upgrade clang to 3.3.I can compile
> the CItutorial6.cpp,Unfortunately as long as I run it ,It is terminate with
> an error as follow.
>
> administrator at ubuntu:~/Clang-tutorial-master$ ./CItutorial6
> input04.c:1:10: fatal error: 'stdio.h' file not found
> #include <stdio.h>
>          ^
> Read top-level variable decl: 'a
> Read top-level variable decl: 'a
> Read top-level variable decl: 'b
> Read top-level variable decl: 'c
> Read top-level variable decl: 'funcp
> Read top-level variable decl: 'fp2
> Read top-level variable decl: 'fp3
> Read top-level variable decl: 't
> *** glibc detected *** ./CItutorial6: free(): invalid pointer: 0x094adc40
> ***
> ======= Backtrace: =========
> /lib/i386-linux-gnu/libc.so.6(+0x73e42)[0xb7471e42]
> /usr/lib/i386-linux-gnu/libstdc++.so.6(_ZdlPv+0x1f)[0xb766a51f]
> ./CItutorial6[0x8bad43e]
> ./CItutorial6[0x80bb38a]
> ./CItutorial6[0x80bb3f9]
> ./CItutorial6[0x8a88616]
> ./CItutorial6[0x806e415]
> ./CItutorial6[0x806c62e]
> ./CItutorial6[0x806a866]
> ./CItutorial6[0x8068055]
> ./CItutorial6[0x805b923]
> ./CItutorial6[0x805876f]
> /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xb74174d3]
> ======= Memory map: ========
> 08048000-09475000 r-xp 00000000 07:00 1329507
> /home/administrator/Clang-tutorial-master/CItutorial6
> 09475000-094ab000 r--p 0142d000 07:00 1329507
> /home/administrator/Clang-tutorial-master/CItutorial6
> 094ab000-094ac000 rw-p 01463000 07:00 1329507
> /home/administrator/Clang-tutorial-master/CItutorial6
> 094ac000-094ae000 rw-p 00000000 00:00 0
> 0a6d9000-0a71b000 rw-p 00000000 00:00 0          [heap]
> b73fb000-b73fe000 rw-p 00000000 00:00 0
> b73fe000-b759d000 r-xp 00000000 07:00 785824
> /lib/i386-linux-gnu/libc-2.15.so
> b759d000-b759f000 r--p 0019f000 07:00 785824
> /lib/i386-linux-gnu/libc-2.15.so
> b759f000-b75a0000 rw-p 001a1000 07:00 785824
> /lib/i386-linux-gnu/libc-2.15.so
> b75a0000-b75a3000 rw-p 00000000 00:00 0
> b75a3000-b75bf000 r-xp 00000000 07:00 785845
> /lib/i386-linux-gnu/libgcc_s.so.1
> b75bf000-b75c0000 r--p 0001b000 07:00 785845
> /lib/i386-linux-gnu/libgcc_s.so.1
> b75c0000-b75c1000 rw-p 0001c000 07:00 785845
> /lib/i386-linux-gnu/libgcc_s.so.1
> b75c1000-b7699000 r-xp 00000000 07:00 1182424
> /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
> b7699000-b769a000 ---p 000d8000 07:00 1182424
> /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
> b769a000-b769e000 r--p 000d8000 07:00 1182424
> /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
> b769e000-b769f000 rw-p 000dc000 07:00 1182424
> /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
> b769f000-b76a6000 rw-p 00000000 00:00 0
> b76a6000-b76d0000 r-xp 00000000 07:00 785856
> /lib/i386-linux-gnu/libm-2.15.so
> b76d0000-b76d1000 r--p 00029000 07:00 785856
> /lib/i386-linux-gnu/libm-2.15.so
> b76d1000-b76d2000 rw-p 0002a000 07:00 785856
> /lib/i386-linux-gnu/libm-2.15.so
> b76d2000-b76d5000 r-xp 00000000 07:00 785837
> /lib/i386-linux-gnu/libdl-2.15.so
> b76d5000-b76d6000 r--p 00002000 07:00 785837
> /lib/i386-linux-gnu/libdl-2.15.so
> b76d6000-b76d7000 rw-p 00003000 07:00 785837
> /lib/i386-linux-gnu/libdl-2.15.so
> b76d7000-b76d8000 rw-p 00000000 00:00 0
> b76d8000-b76df000 r-xp 00000000 07:00 785910
> /lib/i386-linux-gnu/librt-2.15.so
> b76df000-b76e0000 r--p 00006000 07:00 785910
> /lib/i386-linux-gnu/librt-2.15.so
> b76e0000-b76e1000 rw-p 00007000 07:00 785910
> /lib/i386-linux-gnu/librt-2.15.so
> b76e1000-b76f8000 r-xp 00000000 07:00 785904
> /lib/i386-linux-gnu/libpthread-2.15.so
> b76f8000-b76f9000 r--p 00016000 07:00 785904
> /lib/i386-linux-gnu/libpthread-2.15.so
> b76f9000-b76fa000 rw-p 00017000 07:00 785904
> /lib/i386-linux-gnu/libpthread-2.15.so
> b76fa000-b76fc000 rw-p 00000000 00:00 0
> b770b000-b770e000 rw-p 00000000 00:00 0
> b770e000-b770f000 r-xp 00000000 00:00 0          [vdso]
> b770f000-b772f000 r-xp 00000000 07:00 785804
> /lib/i386-linux-gnu/ld-2.15.so
> b772f000-b7730000 r--p 0001f000 07:00 785804
> /lib/i386-linux-gnu/ld-2.15.so
> b7730000-b7731000 rw-p 00020000 07:00 785804
> /lib/i386-linux-gnu/ld-2.15.so
> bff55000-bff76000 rw-p 00000000 00:00 0          [stack]
> ?????(????????
>
> you can get the CItutorial6.cpp and corresponding makefile at this website
> https://github.com/loarabia/Clang-tutorial
> <https://github.com/loarabia/Clang-tutorial>  .
> Actually,CIrewriter.cpp,CItutorial1-CItutorial6 would Encounter Problems as
> above,but tutorial1-tutorial6 are Running the perfectly.why them happend?
> Any help would be appreciated.
>
>
I believe that if you change the lines:

    CompilerInstance ci;
    DiagnosticOptions diagnosticOptions;
    TextDiagnosticPrinter *pTextDiagnosticPrinter =
        new TextDiagnosticPrinter(
            llvm::outs(),
            &diagnosticOptions,
            true);
    ci.createDiagnostics(pTextDiagnosticPrinter);

to simply:

    CompilerInstance ci;
    ci.createDiagnostics();

the problem will go away. I'm not sure why clang allows the current call,
as the interface changed.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130806/20d48fb7/attachment.html>


More information about the cfe-dev mailing list