[LLVMbugs] [Bug 16441] New: Assertion failed: (OldFn->isDeclaration() && "Shouldn't replace non-declaration") with asm body
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jun 25 04:48:20 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16441
Bug ID: 16441
Summary: Assertion failed: (OldFn->isDeclaration() &&
"Shouldn't replace non-declaration") with asm body
Product: clang
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: achristensen at clcbio.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 10755
--> http://llvm.org/bugs/attachment.cgi?id=10755&action=edit
Examples and run scripts
When compiling the code
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#include <sys/stat.h>
with -O1 or higher, I get the exception
clang:
/home/achristensen/llvm-3.3.src/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2086:
void
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl):
Assertion `OldFn->isDeclaration() && "Shouldn't replace non-declaration"'
failed.
0 clang 0x0a5fadd0 llvm::sys::PrintStackTrace(_IO_FILE*) + 48
I reduced the code down to
struct stat { int dummy; };
struct stat64 { int dummy; };
extern int
stat (__const char *__restrict __file, struct stat *__restrict __buf) __asm__
("" "stat64");
extern int
stat64 (__const char *__restrict __file, struct stat64 *__restrict __buf);
extern __inline__ int
stat (__const char *__path, struct stat *__statbuf)
{
return 1;
}
extern __inline__ int
stat64 (__const char *__path, struct stat64 *__restrict __buf)
{
return 2;
}
for which the full dump is:
clang:
/home/achristensen/llvm-3.3.src/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2086:
void
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl):
Assertion `OldFn->isDeclaration() && "Shouldn't replace non-declaration"'
failed.
0 clang 0x0a5fadd0 llvm::sys::PrintStackTrace(_IO_FILE*) + 48
Stack dump:
0. Program arguments:
/home/achristensen/llvm-3.3.src/build-linux32/Release+Asserts/bin/clang -cc1
-triple i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
crashtest4.c -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version
2.17.50.0.6 -resource-dir
/home/achristensen/llvm-3.3.src/build-linux32/Release+Asserts/bin/../lib/clang/3.3
-internal-isystem /usr/local/include -internal-isystem
/home/achristensen/llvm-3.3.src/build-linux32/Release+Asserts/bin/../lib/clang/3.3/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/achristensen/hpc/c_code/c_module -ferror-limit 19
-fmessage-length 172 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fdiagnostics-show-option
-fcolor-diagnostics -backend-option -vectorize-loops -o
/tmp/crashtest4-BloQ8J.o -x c crashtest4.c
1. <eof> parser at end of file
2. crashtest4.c:18:1: LLVM IR generation of declaration 'stat64'
3. crashtest4.c:18:1: Generating code for declaration 'stat64'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (tags/RELEASE_33/final)
Target: i386-pc-linux-gnu
Thread model: posix
If I remove the second parameter of the functions...
extern int
stat (__const char *__restrict __file) __asm__ ("" "stat64");
extern int
stat64 (__const char *__restrict __file);
extern __inline__ int
stat (__const char *__path)
{
return 1;
}
extern __inline__ int
stat64 (__const char *__path)
{
return 2;
}
I get a different assertion:
clang:
/home/achristensen/llvm-3.3.src/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:490:
void clang::CodeGen::CodeGenFunction::StartFunction(clang::GlobalDecl,
clang::QualType, llvm::Function*, const clang::CodeGen::CGFunctionInfo&, const
clang::CodeGen::FunctionArgList&, clang::SourceLocation): Assertion
`CurFn->isDeclaration() && "Function already has body?"' failed.
0 clang 0x0a5fadd0 llvm::sys::PrintStackTrace(_IO_FILE*) + 48
Stack dump:
0. Program arguments:
/home/achristensen/llvm-3.3.src/build-linux32/Release+Asserts/bin/clang -cc1
-triple i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
crashtest3.c -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version
2.17.50.0.6 -resource-dir
/home/achristensen/llvm-3.3.src/build-linux32/Release+Asserts/bin/../lib/clang/3.3
-internal-isystem /usr/local/include -internal-isystem
/home/achristensen/llvm-3.3.src/build-linux32/Release+Asserts/bin/../lib/clang/3.3/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/achristensen/hpc/c_code/c_module -ferror-limit 19
-fmessage-length 172 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fdiagnostics-show-option
-fcolor-diagnostics -backend-option -vectorize-loops -o
/tmp/crashtest3-xYbifP.o -x c crashtest3.c
1. <eof> parser at end of file
2. crashtest3.c:16:1: LLVM IR generation of declaration 'stat64'
3. crashtest3.c:16:1: Generating code for declaration 'stat64'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (tags/RELEASE_33/final)
Target: i386-pc-linux-gnu
Thread model: posix
I built clang from the 3.3 final sources on 32-bit Linux (CentOS 5.9) using gcc
4.1.2 with these configuration options:
../llvm/configure --enable-optimized --enable-jit=NO
--enable-targets=x86,x86_64
--with-python=/home/achristensen/Python-linux32/python
--
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/20130625/0c737e9b/attachment.html>
More information about the llvm-bugs
mailing list