[llvm-bugs] [Bug 25836] New: crash during name mangling of overloadable function with parameter type pointer-to-incomplete-struct

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 15 14:17:07 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25836

            Bug ID: 25836
           Summary: crash during name mangling of overloadable function
                    with parameter type pointer-to-incomplete-struct
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dgross at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15454
  --> https://llvm.org/bugs/attachment.cgi?id=15454&action=edit
preprocessed source

To reproduce:
% cat junk.c
static void __attribute__((overloadable)) aiAccum(struct A *a, int b) { }
% clang -c junk.c

Result:
junk.c:1:58: warning: declaration of 'struct A' will not be visible outside of
this function [-Wvisibility]
static void __attribute__((overloadable)) aiAccum(struct A *a, int b) { }
                                                         ^
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (http://llvm.org/git/clang.git
87a1c47cfd870a22a67068d03007a260458392ea) (http://llvm.org/git/llvm.git
f730abdc9da305a1af78459b62143e4904047522)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Beginning of stack trace:
0x0000000002cd8a05 in clang::LinkageInfo::LinkageInfo (this=0x7fffff7ff080,
L=clang::InternalLinkage, V=clang::DefaultVisibility, E=<error reading
variable: Cannot access memory at address 0x7fffff7feffc>) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/../../include/clang/Basic/Visibility.h:60
60        LinkageInfo(Linkage L, Visibility V, bool E)
#0  0x0000000002cd8a05 in clang::LinkageInfo::LinkageInfo (this=0x7fffff7ff080,
L=clang::InternalLinkage, V=clang::DefaultVisibility, E=<error reading
variable: Cannot access memory at address 0x7fffff7feffc>) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/../../include/clang/Basic/Visibility.h:60
#1  0x0000000002cdd5da in clang::LinkageComputer::getLVForDecl (D=0x7dc42d0,
computation=LVForLinkageOnly) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/Decl.cpp:1318
#2  0x0000000002cdd813 in getLVForDecl (D=0x7dc42d0,
computation=LVForLinkageOnly) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/Decl.cpp:1357
#3  0x0000000002cdc9d5 in clang::NamedDecl::getLinkageInternal (this=0x7dc42d0)
at /media/dgross/ssd01/git/llvm/tools/clang/lib/AST/Decl.cpp:1030
#4  0x0000000001bdabd6 in clang::NamedDecl::hasExternalFormalLinkage
(this=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/Sema/../../include/clang/AST/Decl.h:276
#5  0x0000000002ce8331 in getDeclLanguageLinkage<clang::FunctionDecl> (D=...)
at /media/dgross/ssd01/git/llvm/tools/clang/lib/AST/Decl.cpp:1840
#6  0x0000000002ce1a1c in clang::FunctionDecl::getLanguageLinkage
(this=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/Decl.cpp:2534
#7  0x0000000002ce8432 in isDeclExternC<clang::FunctionDecl> (D=...) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/Decl.cpp:1874
#8  0x0000000002ce1a36 in clang::FunctionDecl::isExternC (this=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/Decl.cpp:2538
#9  0x0000000002db0625 in (anonymous namespace)::getEffectiveDeclContext
(D=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:77
#10 0x0000000002db23f6 in (anonymous
namespace)::CXXNameMangler::mangleUnqualifiedName (this=0x7fffffffa0f0,
ND=0x7dc42d0, Name=..., KnownArity=4294967295) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:942
#11 0x0000000002db0ea0 in (anonymous
namespace)::CXXNameMangler::mangleUnqualifiedName (this=0x7fffffffa0f0,
ND=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:343
#12 0x0000000002db184e in (anonymous
namespace)::CXXNameMangler::mangleUnscopedName (this=0x7fffffffa0f0,
ND=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:647
#13 0x0000000002db170c in (anonymous namespace)::CXXNameMangler::mangleName
(this=0x7fffffffa0f0, ND=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:616
#14 0x0000000002db11aa in (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding (this=0x7fffffffa0f0,
FD=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:476
#15 0x0000000002db2d73 in (anonymous
namespace)::CXXNameMangler::mangleLocalName (this=0x7fffffffa0f0, D=0x7d79788)
at /media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:1159
#16 0x0000000002db1666 in (anonymous namespace)::CXXNameMangler::mangleName
(this=0x7fffffffa0f0, ND=0x7d79788) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:601
#17 0x0000000002db580a in (anonymous namespace)::CXXNameMangler::mangleType
(this=0x7fffffffa0f0, T=0x7d79810) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:2111
#18 0x0000000002db57d9 in (anonymous namespace)::CXXNameMangler::mangleType
(this=0x7fffffffa0f0, T=0x7d79810) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:2108
#19 0x0000000002db4f28 in (anonymous namespace)::CXXNameMangler::mangleType
(this=0x7fffffffa0f0, T=...) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/../../include/clang/AST/TypeNodes.def:91
#20 0x0000000002db5b31 in (anonymous namespace)::CXXNameMangler::mangleType
(this=0x7fffffffa0f0, T=0x7dc40d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:2187
#21 0x0000000002db4d00 in (anonymous namespace)::CXXNameMangler::mangleType
(this=0x7fffffffa0f0, T=...) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/../../include/clang/AST/TypeNodes.def:64
#22 0x0000000002db5714 in (anonymous
namespace)::CXXNameMangler::mangleBareFunctionType (this=0x7fffffffa0f0,
T=0x7dc4260, MangleReturnType=false) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:2087
#23 0x0000000002db13be in (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding (this=0x7fffffffa0f0,
FD=0x7dc42d0) at
/media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:528
#24 0x0000000002db2d73 in (anonymous
namespace)::CXXNameMangler::mangleLocalName (this=0x7fffffffa0f0, D=0x7d79788)
at /media/dgross/ssd01/git/llvm/tools/clang/lib/AST/ItaniumMangle.cpp:1159

Frames 16..24 then repeat thousands of times.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151215/4a5a732b/attachment.html>


More information about the llvm-bugs mailing list