neshkatrapati / marisa-trie

Automatically exported from code.google.com/p/marisa-trie
Other
0 stars 0 forks source link

failing win 64bit build #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Marisa-trie under win64 compiles but fails in marisa-test (segfault in 
TestTinyTrie).

I guess, the cause is that size_t is a 64bit value in win64 and marisa-trie 
assumes it's an 32bit value.

Original issue reported on code.google.com by thec...@gmail.com on 5 Aug 2013 at 7:01

GoogleCodeExporter commented 9 years ago
Thank you for your report.

Unfortunately, I have only a 32-bit Windows and I can't test it on a native 
Win64.
So, I've tested marisa-test, compiled with MinGW, on Wine (64-bit Ubuntu 12.04) 
as follows.

$ ./configure --host=x86_64-w64-mingw32 LDFLAGS="-static-libgcc 
-static-libstdc++"
...
$ make check
...
marisa-test.cc:13: TestEmptyTrie(): ok
marisa-test.cc:87: TestTinyTrie(): ok
marisa-test.cc:350: TestTrie(): TEXT, WEIGHT: ok
marisa-test.cc:350: TestTrie(): TEXT, LABEL: ok
marisa-test.cc:350: TestTrie(): BINARY, WEIGHT: ok
marisa-test.cc:350: TestTrie(): BINARY, LABEL: ok
PASS: marisa-test.exe
...

This settings could not reproduce the problem.

Would you give me more details?

Original comment by susumu.y...@gmail.com on 7 Aug 2013 at 1:04

GoogleCodeExporter commented 9 years ago
Maybe the output of my compilation (visual studio 2008) and the following 
document helps:
http://msdn.microsoft.com/en-us/library/3b2e7499.aspx

===========================
1>------ Rebuild All started: Project: libmarisa, Configuration: Release x64 
------
1>Deleting intermediate and output files for project 'libmarisa', configuration 
'Release|x64'
1>Compiling...
1>agent.cc
1>writer.cc
1>..\..\lib\marisa\grimoire\io\writer.cc(121) : warning C4267: 'initializing' : 
conversion from 'size_t' to 'const unsigned int', possible loss of data
1>trie.cc
1>tail.cc
1>reader.cc
1>..\..\lib\marisa\grimoire\io\reader.cc(121) : warning C4267: 'initializing' : 
conversion from 'size_t' to 'const unsigned int', possible loss of data
1>mapper.cc
1>louds-trie.cc
1>t:\marisa-0.2.4\lib\marisa\grimoire\trie\range.h(16) : warning C4267: '=' : 
conversion from 'size_t' to 'marisa::UInt32', possible loss of data
1>t:\marisa-0.2.4\lib\marisa\grimoire\trie\range.h(20) : warning C4267: '=' : 
conversion from 'size_t' to 'marisa::UInt32', possible loss of data
1>t:\marisa-0.2.4\lib\marisa\grimoire\trie\range.h(24) : warning C4267: '=' : 
conversion from 'size_t' to 'marisa::UInt32', possible loss of data
1>..\..\lib\marisa\grimoire\trie\louds-trie.cc(304) : warning C4267: 'argument' 
: conversion from 'size_t' to 'int', possible loss of data
1>        ..\..\lib\marisa\grimoire\trie\louds-trie.cc(256) : see reference to 
function template instantiation 'void 
marisa::grimoire::trie::LoudsTrie::build_trie<marisa::grimoire::trie::Key>(maris
a::grimoire::vector::Vector<T> 
&,marisa::grimoire::vector::Vector<marisa::UInt32> *,const 
marisa::grimoire::trie::Config &,size_t)' being compiled
1>        with
1>        [
1>            T=marisa::grimoire::trie::Key
1>        ]
1>..\..\lib\marisa\grimoire\trie\louds-trie.cc(304) : warning C4267: 'argument' 
: conversion from 'size_t' to 'int', possible loss of data
1>        ..\..\lib\marisa\grimoire\trie\louds-trie.cc(452) : see reference to 
function template instantiation 'void 
marisa::grimoire::trie::LoudsTrie::build_trie<marisa::grimoire::trie::ReverseKey
>(marisa::grimoire::vector::Vector<T> 
&,marisa::grimoire::vector::Vector<marisa::UInt32> *,const 
marisa::grimoire::trie::Config &,size_t)' being compiled
1>        with
1>        [
1>            T=marisa::grimoire::trie::ReverseKey
1>        ]
1>keyset.cc
1>bit-vector.cc
1>..\..\lib\marisa\grimoire\vector\bit-vector.cc(771) : warning C4267: 
'argument' : conversion from 'size_t' to 'const marisa::UInt32', possible loss 
of data
1>..\..\lib\marisa\grimoire\vector\bit-vector.cc(776) : warning C4267: 
'argument' : conversion from 'size_t' to 'const marisa::UInt32', possible loss 
of data
1>..\..\lib\marisa\grimoire\vector\bit-vector.cc(815) : warning C4267: 
'argument' : conversion from 'size_t' to 'const marisa::UInt32', possible loss 
of data
1>..\..\lib\marisa\grimoire\vector\bit-vector.cc(819) : warning C4267: 
'argument' : conversion from 'size_t' to 'const marisa::UInt32', possible loss 
of data
1>Creating library...
1>Build log was saved at 
"file://t:\marisa-0.2.4\vs2008\libmarisa\x64\Release\BuildLog.htm"
1>libmarisa - 0 error(s), 11 warning(s)
2>------ Rebuild All started: Project: marisa-build, Configuration: Release x64 
------
2>Deleting intermediate and output files for project 'marisa-build', 
configuration 'Release|x64'
2>Compiling...
2>marisa-build.cc
2>cmdopt.cc
2>Linking...
2>Generating code
2>Finished generating code
2>Embedding manifest...
2>Build log was saved at 
"file://t:\marisa-0.2.4\vs2008\marisa-build\x64\Release\BuildLog.htm"
2>marisa-build - 0 error(s), 0 warning(s)
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========

Original comment by thec...@gmail.com on 7 Aug 2013 at 7:36

GoogleCodeExporter commented 9 years ago
Thank you for your helps.
However, these warnings seem to be not critical.

I would like to make sure if the test fails when it is compiled in DEBUG mode.

Original comment by susumu.y...@gmail.com on 9 Aug 2013 at 1:31

GoogleCodeExporter commented 9 years ago
Hi,

this is indeed a problem as I am experiencing the same. Is there any way I 
could help you reproduce that?

I've found that it fails on test:
>   marisa-test.exe!marisa::grimoire::vector::`anonymous 
namespace'::select_bit(unsigned __int64 i, unsigned __int64 bit_id, unsigned 
__int64 unit)  Line 206 C++
    marisa-test.exe!marisa::grimoire::vector::BitVector::select1(unsigned __int64 i)  Line 492  C++
    marisa-test.exe!marisa::grimoire::trie::LoudsTrie::reverse_lookup(marisa::Agent & agent)  Line 78 + 0x2c bytes  C++
    marisa-test.exe!marisa::Trie::reverse_lookup(marisa::Agent & agent)  Line 100   C++
    marisa-test.exe!`anonymous namespace'::TestTinyTrie()  Line 120 C++

It seems that select1 returns an invalid id and the programs fails on a call
  void set_node_id(std::size_t node_id) {
    MARISA_DEBUG_IF(node_id > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
    node_id_ = (UInt32)node_id;
  }

Original comment by tadas.subonis@gmail.com on 23 Oct 2014 at 2:08

GoogleCodeExporter commented 9 years ago
I could try fixing it but I think I don't have enough expertise to do that...

Original comment by tadas.subonis@gmail.com on 23 Oct 2014 at 2:09