[LLVMbugs] [Bug 7490] New: Incomplete default initialization of arrays
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 24 16:24:28 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7490
Summary: Incomplete default initialization of arrays
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: collinwinter at google.com
CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu,
dgregor at apple.com, jyasskin at google.com
Created an attachment (id=5108)
--> (http://llvm.org/bugs/attachment.cgi?id=5108)
Reduced test case
It appears Clang does not default-initialize all elements of an array. The
attached program passes with gcc but fails with Clang built from r106806
(x86-64 Linux).
If I install a malloc() that poisons memory, something like "new int[2]()"
should zero out both bytes. Clang currently only zeros the first element.
The problem reproduces easily when linking against tcmalloc's debug allocator:
0) Install tcmalloc from
http://google-perftools.googlecode.com/files/google-perftools-1.5.tar.gz to
/tmp/tcmalloc
1) clang -lstdc++ -L/tmp/tcmalloc/lib -Wl,--rpath=/tmp/tcmalloc/lib
-ltcmalloc_debug intrusive_hash_map_test.cc -o intrusive_hash_map_test &&
./intrusive_hash_map_test && echo "Test passed"
The program fails with an assertion error when compiled with Clang.
--
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