[PATCH] D112663: [clang-repl] Allow Interpreter::getSymbolAddress to take a mangled name.
Vassil Vassilev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 30 12:53:49 PST 2021
v.g.vassilev added inline comments.
Comment at: clang/unittests/Interpreter/InterpreterTest.cpp:237-240
+ std::string MangledName = MangleName(TmpltSpec);
+ typedef int (*TemplateSpecFn)(void *);
+ auto fn = (TemplateSpecFn)cantFail(Interp->getSymbolAddress(MangledName));
+ EXPECT_EQ(42, fn(NewA));
> aaron.ballman wrote:
> > This test is broken for some of our internal build bots at Intel. I think something suspicious is going on here, but I'm not certain of the intent behind the test, so I'm not certain the best way to fix it. The behavior of the test is that on an x86 Windows machine, sometimes this particular test fails:
> > ```
> > [ RUN ] IncrementalProcessing.InstantiateTemplate^M
> > unknown file: error: SEH exception with code 0x3221225477 thrown in the test body.^M
> > [ FAILED ] IncrementalProcessing.InstantiateTemplate (35 ms)^M
> > ```
> > but it's not a consistent failure (seems to happen about one out of every three runs).
> > `callme` is a templated member function of `B` but here we're trying to call it like it's a free function. That's... not good. We could either make `callme` a `static` member function so that it can be called in this manner, or we could try to come up with a magic incantation to call it as a PMF.
> > Can you investigate, @v.g.vassilev? If it is going to take considerable time to resolve, it might be worth reverting temporarily. Thanks!
> To be perhaps succinct, the problem is calling Pointer-to-member-function as a free-function. The cast on line 239 is completely invalid, and can't be done in C++ code itself without UB.
> We believe this shows up on x86 in particular since there is ALSO a calling-convention mismatch here, but this cast to TemplateSpecFn seems completely invalid to me.
Thanks for the ping, @aaron.ballman. Does making the function static fixes it? If it does, please go ahead and commit the fix otherwise I can do it in 12 hours.
If it does not fix it, could you share the bot logs or at least the cmake configure line and the platform?
CHANGES SINCE LAST ACTION
More information about the cfe-commits