[cfe-dev] clang++ redeclaration error and segfault

Matthieu Monrocq matthieu.monrocq at gmail.com
Mon Mar 19 06:12:59 PDT 2012


Le 19 mars 2012 12:49, Richtarsky, Martin <martin.richtarsky at sap.com> a
écrit :

>  Hello,
>
> I am currently trying to get a rather large C++ project to build on
> clang++. After some changes, it is looking quite good. However, on one file
> I encountered a segfault with LLVM/clang 3.0. Therefore, I checked out the
> latest version from SVN yesterday and tested with a Debug+Asserts build.
> This is running in another problem on a different .cpp file which clang 3.0
> can successfully compile.
>
>
> In file included from
> /local/build/git3/sys/src/ptime/query/catalog/metadata_context.cc:1:
> In file included from
> /local/build/git3/sys/src/ptime/query/catalog/metadata_context.h:6:
> In file included from
> /local/build/git3/sys/src/ptime/query/catalog/ct_def.h:34:
> In file included from
> /local/build/git3/sys/src/ptime/common/datatype/datatype.h:28:
> In file included from
> /local/build/git3/sys/src/Expression/Dictionary/Dictionary.h:4:
> In file included from
> /local/build/git3/sys/src/Expression/Dictionary/Description.h:35:
> /local/build/git3/sys/src/ptime/common/util/link_hash.h:247:3: error:
> constructor cannot be redeclared
>                 Bin();
>                 ^
> /local/build/git3/sys/src/ptime/common/util/link_hash.h:312:46: note: in
> instantiation of member class 'ptime::LinkHash<ltt_adp::basic_string<char,
> ltt::char_traits<char>, ltt::true_type>,
> ptime::NameLock::POSIX_COND_AND_MUTEX *, 509, 8>::Bin' requested here
>                 ptime_byte for_cacheline[P_CACHE_LINE_SIZE - BIN_SIZE];
>                                                            ^
> /local/build/git3/sys/src/ptime/common/util/link_hash.h:320:6: note: in
> instantiation of member class 'ptime::LinkHash<ltt_adp::basic_string<char,
> ltt::char_traits<char>, ltt::true_type>,
> ptime::NameLock::POSIX_COND_AND_MUTEX *, 509, 8>::Bin' requested here
>         Bin bins[FANOUT];
>             ^
> /local/build/git3/sys/src/ptime/common/util/namelock.h:47:52: note: in
> instantiation of template class
> 'ptime::LinkHash<ltt_adp::basic_string<char, ltt::char_traits<char>,
> ltt::true_type>, ptime::NameLock::POSIX_COND_AND_MUTEX *, 509, 8>'
> requested here
>     LinkHash<_STL::string, POSIX_COND_AND_MUTEX *> nameLockMap;
>                                                    ^
> /local/build/git3/sys/src/ptime/common/util/link_hash.h:247:3: note:
> previous declaration is here
>                 Bin();
>                 ^
>
> …[some more redeclaration errors omitted]
>
> /local/build/git3/sys/src/ptime/common/util/link_hash.h:283:12: note:
> previous declaration is here
> fatal error: too many errors emitted, stopping now [-ferror-limit=]
> 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:
> /local/build/git3/tmp/metadata_context-01e1fJ.ii
> clang: note: diagnostic msg:
> /local/build/git3/tmp/metadata_context-01e1fJ.sh
>
>
> The header file link_hash.h  has include guards. The preprocessed file
> contains for example
>
> template* *<class A, class B, class C, class D>
> class* *LinkHash
>
>  class* *Bin
> * *{
> * *public:
> *  *Bin();
> *  *~Bin();
> *}*
>
> and later the definition
>
> template* *<class* **A*,* *class* **B*,* *unsigned* **C*,* *unsigned* **D*
> >
> LinkHash<A,* **B*,* **C*,* **D*>::Bin::~Bin()
> {
> * *delete* *[]* *dir_;
> * *dir_=* *0;
> }
>
>
> I tried to put the complete definition in the class definition, but the
> same error showed up.
>
> Any idea what changed in clang-trunk that could make this fail?
>
> Best regards,
> Martin
>
>
>
Not at all, however if you could attach the smallest file possible that
triggers this issue to that thread of discussion, it would make
investigation that much easier for developers.

Since it seems like a bug, you will probably get redirected to submit a bug
report, and then such a file will be needed anyway.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120319/f3edae2a/attachment.html>


More information about the cfe-dev mailing list