[LLVMbugs] [Bug 7265] New: Pass 'Simplify well-known library calls' dies on sprintf of union member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 30 16:00:56 PDT 2010


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

           Summary: Pass 'Simplify well-known library calls' dies on
                    sprintf of union member
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu


Code fragment reduced from the FreeBSD xkbevd 1.1.0 port (an X11 event
daemon program):

========================================
typedef union {
  int xkb_type;
  char message[7];
} XkbEvent;

void CopyEventArg(XkbEvent *ev)
{
  char *sink;
  sprintf(sink,"%s",ev->message);
}
========================================

results in messages about "Unknown type!", "UNREACHABLE executed", and
an abort (ran this on Windows to get a nice stack dump):

badsig.c(9) :  warning: implicitly declaring C library function 'sprintf' with
type 'int (char *, char const *, ...)'
  sprintf(sink,"%s",ev->message);
  ^
badsig.c(9) :  note: please include the header <stdio.h> or explicitly provide
a declaration for 'sprintf'
Unknown type!
UNREACHABLE executed at .\ValueTypes.cpp:190!
Stack dump:
0.    Program arguments: D:/Home/Dim/Src/llvm/bin/Debug/clang.exe -cc1 -triple
i686-pc-win32 -S -disable-free -main-file-name badsig.c -mrelocation-model
static -mdisable-fp-elim -mconstructor-aliases -resource-dir
D:/Home/Dim/Src/llvm/bin/lib/clang/2.0 -O2 -ferror-limit 19 -fmessage-length 0
-fms-extensions -fgnu-runtime -fdiagnostics-show-option -o D:/Tmp/cc-000000.s
-x c badsig.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'badsig.c'.
4.    Running pass 'Simplify well-known library calls' on function
'@CopyEventArg'
1023C355 (0x0000000A 0xCCCCCCCC 0xCCCCCCCC 0xCCCCCCCC), _get_pgmptr()+0453
bytes(s)
102DEF1D (0x02CDD110 0x02CDD0F8 0x015CD4AA 0x02014BBC), abort()+0045 bytes(s)
0165AFF9 (0x02014BBC 0x02014BA8 0x000000BE 0x02CDD10C),
llvm::llvm_unreachable_internal()+0137 bytes(s),
d:\home\dim\src\llvm\lib\support\errorhandling.cpp, line 76+0008 byte(s)
015CD4AA (0x02CDD218 0x02E1F128 0x00000000 0x02CDD1F8),
llvm::EVT::getEVT()+0106 bytes(s),
d:\home\dim\src\llvm\lib\vmcore\valuetypes.cpp, line 191
015784F4 (0x02CDDE84 0x000000B7 0x02CDDEEC 0x00000003),
llvm::Intrinsic::getName()+7892 bytes(s),
d:\home\dim\src\llvm\lib\vmcore\function.cpp, line 352+0033 byte(s)
01580EC9 (0x02E03F38 0x000000B7 0x02CDDEEC 0x00000003),
llvm::Intrinsic::getDeclaration()+0105 bytes(s),
d:\home\dim\src\llvm\lib\vmcore\function.cpp, line 396+0051 byte(s)
01372184 (0x02E23DA0 0x02E237D0 0x02E79148 0x00000001), llvm::EmitMemCpy()+0100
bytes(s), d:\home\dim\src\llvm\lib\transforms\utils\buildlibcalls.cpp, line
116+0020 byte(s)
0127EBC6 (0x02E23F98 0x02E2A858 0x02CDE078 0x02CDE018), `anonymous
namespace'::SPrintFOpt::CallOptimizer()+1430 bytes(s),
d:\home\dim\src\llvm\lib\transforms\scalar\simplifylibcalls.cpp, line 1043+0046
byte(s)
0128069E (0x02E2A858 0x02E324C0 0x02CDE078 0x02CDE10C), `anonymous
namespace'::LibCallOptimization::OptimizeCall()+0110 bytes(s),
d:\home\dim\src\llvm\lib\transforms\scalar\simplifylibcalls.cpp, line 69+0032
byte(s)
01276EF4 (0x02E21FF0 0x4388D478 0x02CDE194 0x02CDE124), `anonymous
namespace'::SimplifyLibCalls::runOnFunction()+0404 bytes(s),
d:\home\dim\src\llvm\lib\transforms\scalar\simplifylibcalls.cpp, line 1336+0020
byte(s)
01481A4C (0x02E21FF0 0x4388D4C0 0x02CDE288 0x02CDE1BC),
llvm::FPPassManager::runOnFunction()+0332 bytes(s),
d:\home\dim\src\llvm\lib\vmcore\passmanager.cpp, line 1428+0023 byte(s)
01385EEB (0x02E36530 0x02CDE2DC 0x02E34240 0x02CDE277), `anonymous
namespace'::CGPassManager::RunPassOnSCC()+0507 bytes(s),
d:\home\dim\src\llvm\lib\analysis\ipa\callgraphsccpass.cpp, line 145+0016
byte(s)
01386DF2 (0x02CDE2DC 0x02E34240 0x02CDE2CB 0x4388D61C), `anonymous
namespace'::CGPassManager::RunAllPassesOnSCC()+0610 bytes(s),
d:\home\dim\src\llvm\lib\analysis\ipa\callgraphsccpass.cpp, line 399+0032
byte(s)
013870EC (0x02E03F38 0x4388D124 0x02CDE528 0x02CDE450), `anonymous
namespace'::CGPassManager::runOnModule()+0380 bytes(s),
d:\home\dim\src\llvm\lib\analysis\ipa\callgraphsccpass.cpp, line 454+0030
byte(s)
01481F6E (0x02E03F38 0x02CDE480 0x7EFDE000 0x00000000),
llvm::MPPassManager::runOnModule()+0430 bytes(s),
d:\home\dim\src\llvm\lib\vmcore\passmanager.cpp, line 1502+0023 byte(s)
01482524 (0x02E03F38 0x0030EE28 0x02CDE534 0x0044E66C),
llvm::PassManagerImpl::run()+0164 bytes(s),
d:\home\dim\src\llvm\lib\vmcore\passmanager.cpp, line 1583+0027 byte(s)
01482A4D (0x02E03F38 0x4388D054 0x02CDEE84 0x02CDE53C),
llvm::PassManager::run()+0029 bytes(s),
d:\home\dim\src\llvm\lib\vmcore\passmanager.cpp, line 1627
0044E66C (0x4388D00C 0x02CDE578 0x02E03E08 0xCCCCCCCC), `anonymous
namespace'::BackendConsumer::EmitAssembly()+0604 bytes(s),
d:\home\dim\src\llvm\tools\clang\lib\frontend\codegenaction.cpp, line 444
00450685 (0x02DFB570 0x4388DBF0 0x02CDEEFC 0x02CDEEAC), `anonymous
namespace'::BackendConsumer::HandleTranslationUnit()+0197 bytes(s),
d:\home\dim\src\llvm\tools\clang\lib\frontend\codegenaction.cpp, line 169
007674D8 (0x02DE7948 0x02E03BE8 0x02DFB570 0x00000000), clang::ParseAST()+0744
bytes(s), d:\home\dim\src\llvm\tools\clang\lib\sema\parseast.cpp, line 108+0019
byte(s)
00453C02 (0x4388DA68 0x02CDEF74 0x02CDEF10 0x02CDEEC0),
clang::ASTFrontendAction::ExecuteAction()+0226 bytes(s),
d:\home\dim\src\llvm\tools\clang\lib\frontend\frontendaction.cpp, line 224+0079
byte(s)
004538DA (0x4388DAE0 0x02CDF75C 0x02CDEF8C 0xCCCCCCCC),
clang::FrontendAction::Execute()+0282 bytes(s),
d:\home\dim\src\llvm\tools\clang\lib\frontend\frontendaction.cpp, line 150+0015
byte(s)
0042A243 (0x02DE5C78 0x4388C208 0x02CDFF5C 0x00000000),
clang::CompilerInstance::ExecuteAction()+0755 bytes(s),
d:\home\dim\src\llvm\tools\clang\lib\frontend\compilerinstance.cpp, line 514
0040E944 (0x003060F0 0x00306154 0x00306158 0x004017C1), cc1_main()+2004
bytes(s), d:\home\dim\src\llvm\tools\clang\tools\driver\cc1_main.cpp, line
286+0027 byte(s)
0040321D (0x0000001B 0x003060E8 0x003038C0 0x4388CAD8), main()+0253 bytes(s),
d:\home\dim\src\llvm\tools\clang\tools\driver\driver.cpp, line 186+0033 byte(s)
016B1488 (0x02CDFFF0 0x7D4E7D42 0x00000000 0x00000000),
__tmainCRTStartup()+0424 bytes(s),
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c, line 586+0025 byte(s)
016B12CF (0x00000000 0x00000000 0x7EFDE000 0x80000003), mainCRTStartup()+0015
bytes(s), f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c, line 403
7D4E7D42 (0x016B12C0 0x00000000 0x000000C8 0x0000017A),
BaseProcessInitPostImport()+0141 bytes(s)
clang: error: clang frontend command failed due to signal 2147483645 (use -v to
see invocation)

-- 
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