[LLVMbugs] [Bug 12297] New: clang segfaults with function definition in wrong namespace when function name is too long

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 18 06:45:44 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12297

             Bug #: 12297
           Summary: clang segfaults with function definition in wrong
                    namespace when function name is too long
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following (incorrect; function "global" should be defined in nested
namespace A::B instead of A) program segfaults clang r153011:

namespace A {
    typedef short   T;

    namespace B {
        typedef short   T;

        T global(); // Crashes
        //T globa(); // Raises correct error
    }
}

using namespace A::B;

T A::global(); // Crashes
//T A::globa(); // Raises correct error


This results in:

$ ~/LLVM/build/Release+Asserts/bin/clang++ -v clang.cpp 
clang version 3.1 (trunk 153011)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
 "/Users/rynnsauer/LLVM/build/Release+Asserts/bin/clang" -cc1 -triple
x86_64-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free -main-file-name
clang.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables
-target-cpu core2 -v -resource-dir
/Users/rynnsauer/LLVM/build/Release+Asserts/bin/../lib/clang/3.1
-fmodule-cache-path
/var/folders/RI/RI4iqAygH0OWeTzP0+rLU++++TI/-Tmp-/clang-module-cache
-fdeprecated-macro -fdebug-compilation-dir
/Volumes/Data/Work/Workplace/Writing/C++/UntitledTilebasedProject/src
-ferror-limit 19 -fmessage-length 100 -stack-protector 1 -mstackrealign
-fblocks -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/RI/RI4iqAygH0OWeTzP0+rLU++++TI/-Tmp-/clang-u46hJ1.o -x c++
clang.cpp
clang -cc1 version 3.1 based upon LLVM 3.1svn default target
x86_64-apple-darwin10.8.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.2.1
 /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64
 /usr/include/c++/4.2.1/backward
 /usr/include/c++/4.0.0
 /usr/include/c++/4.0.0/i686-apple-darwin8
 /usr/include/c++/4.0.0/backward
 /usr/local/include
 /Users/rynnsauer/LLVM/build/Release+Asserts/bin/../lib/clang/3.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg:
/var/folders/RI/RI4iqAygH0OWeTzP0+rLU++++TI/-Tmp-/clang-9pNyvy.ii
clang: note: diagnostic msg:
/var/folders/RI/RI4iqAygH0OWeTzP0+rLU++++TI/-Tmp-/clang-9pNyvy.sh

When shortening the function name to five letters (as in the commented lines),
the code compiles correctly.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list