<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108109>108109</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[WPD] SPEC 2006 xalancbmk fails with Whole Program Devirtualization turned on.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
llvm:optimizations
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
aeubanks,
teresajohnson
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
UsmanNadeem
</td>
</tr>
</table>
<pre>
Minimal flags to reproduce the issue: `-flto -O0 -fvisibility=hidden -fwhole-program-vtables`
Flag to enable verification trap: `-Wl,-mllvm,-wholeprogramdevirt-check=trap`
I have reproduced the issue with other optimization levels as well.
With the trap enabled we hit the trap, otherwise we crash with a segmentation fault (failure might be flaky). Execution on QEMU-aarch64 fails more consistently but it can be reproduced on physical devices as well.
We hit the trap in function: `xercesc_2_5::SchemaValidator::preContentValidation(bool, bool)` or `_ZN11xercesc_2_515SchemaValidator20preContentValidationEbb` this function is in `SchemaValidator.cpp`
The devirtualized call is to: `xercesc_2_5::SchemaGrammar::getGrammarType() const` or `_ZNK11xercesc_2_513SchemaGrammar14getGrammarTypeEv`
Debugging reveals that the actual pointer is for: `xercesc_2_5::DTDGrammar::getGrammarType() const` or `_ZNK11xercesc_2_510DTDGrammar14getGrammarTypeEv`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslEFv47YTxT8NfRnYoChbsQ865B_HfxTFblNstgF6CUbUSOSGIg2SkuP99AUlbRwHQU-9SAlp_uY9DedhCLq1RCXb_I8JgdRXaF8CE4KJOyZEJE8Bfzhlg7NpdbNfYB-V8-X30KH9ijVRt6hcfS6_aKs7NNAYbANEB56O3tW9JIiKQIfQE8tvgRV82ZjoYPkHh2Uz6KArbXQ8s3yvdF2ThWVzUs7Q8uhd67FbDhErQ4EVnPE947cHg22qQDatw0BeN1pi1M5C9Hj8VebJMHG37IwZuvTHCJ2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