<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62453>62453</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[BUG?]the length of key cause diffrent result when using llvm::ScopedHashTable
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
95833
</td>
</tr>
</table>
<pre>
```
#include "iostream"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/ScopedHashTable.h"
llvm::ScopedHashTable<llvm::StringRef, std::string> symbolTable;
void declare(std::string key, std::string val)
{
symbolTable.insert(key, val);
}
int main()
{
llvm::ScopedHashTableScope<llvm::StringRef, std::string> varScope(symbolTable);
declare("short_key_is_0", "123");
llvm::errs() << symbolTable.count("short_key_is_0") << "\n";
declare("long_long_long_long_long_long_long_long_long_long_long_long_key_is_1", "abc");
llvm::errs() << symbolTable.count("long_long_long_long_long_long_long_long_long_long_long_long_key_is_1") << "\n";
declare("short_key_is_0", "123");
llvm::errs() << symbolTable.count("short_key_is_0") << "\n";
return 0;
}
```
building will output 0 1 0, How to fix it ?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVMlu2zAQ_RrqMqhBD63toIOXqjk36dmgJEpiQ4sGF7v--4KKGsuB0w09FDBkcHnz3rwBH7dWdoMQBYk3JN5F3LtemyKPM8aiSjeXgiR0-tEdoWuCTA618o0Agii1dUbwA0G8d6zU6UCwXO-eCJaPB67UozNy6Bb9zwGP_njUxhEsDT_vJ45fgSaWWh9F88Bt_8QrJeag8TteZmvC1m9uEradnY0yP4uW4Basa1527bhL2Eewl0Ol1YTbzOuftGygEbXiRhDM3mDhWVzulIQTVwTzqU46FQSAOdFCDlYEU7KpyAR65U93cyFycHDgciCY3S_9rhPj8o_sOHHzAsJs7sxMXCC8ukIQba-N2z-Ly17aPQ1Dwm0Y5hLZuJhBrzqEMfalHyBsS9j2xp9a-8G9W_0VElbxdgh_bAMw9-xWotJDt__Lz0S9vDbGq_ptYzdD-O3e_pms-47c-PGfTm2iMMJ5MwC98wRuQ6vyUjXhnZ2lUqC9O3oHFJZAg3540GdwGlr5DaQDwsqoKViTs5xHolgmGaZpkqww6gvOkzZtBGKd5TzPGavbrMVklTKR0DalkSyQIqMrzJcsThEXabykSYoizpY8rTEnKyoOXKpF8GehTRdJa70oElzFLFK8Esr-CGNThEsfKt9ZsqJKWmevMCedGmN78-UTYSWJd64XoMTQuR50G5IGau6tgEa2rRGDAyOsVw7OvRjA2-DHuxkQeaOK3rmjDcdYEiw76XpfLWodwnbK3FHf0eivog5pPbZiCZZjN98DAAD___4j6Jo">