C-style casting can create a temporary when compiled by a C++ compiler, which was emitting a warning casting a reference to another reference. We can't use C++-style casting directly because it doesn't always work with incomplete types. In order to support the current use-cases, for references we switch to pointer space to perform the cast.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@qiongsiwu1 or @uabelho please let me know if this fixes the issue you saw. I don't think I see the warning emitted anywhere I was able to repro.
Thanks for the fast response @bzcheeseman ! I've tested this patch locally on a ppc machine. The warning is no longer there and all lit tests pass.
Hi, we're also getting the original error on AIX https://lab.llvm.org/buildbot/#/builders/214/builds/1255/steps/6/logs/stdio
I applied your patch here and it seems to fix the original error, but there is a new one:
/llvm-project/llvm/unittests/Support/ExtensibleRTTITest.cpp:69:3: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] cast<MyBaseType>(D); ^~~~~~~~~~~~~~~~ ~ /llvm-project/llvm/unittests/Support/ExtensibleRTTITest.cpp:70:3: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] cast<MyBaseType>(BD); ^~~~~~~~~~~~~~~~ ~~ /llvm-project/llvm/unittests/Support/ExtensibleRTTITest.cpp:71:3: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] cast<MyDerivedType>(BD); ^~~~~~~~~~~~~~~~~~~ ~~
This commit went in last night it looks like to fix that: 52328dafda13711653fd15aa4db34db350471a1f
@qiongsiwu1 I assume you ran the whole test suite with no problems? My machine is rather slow so running check-all takes ~many hours for me
Good call - no I did not run the whole test suite. I did run ninja check-all. Let me give the test suite a try as well.
That's what I meant. I think build kite is running ninja check-clang-tools check-bolt check-mlir check-flang check-all check-lld check-openmp check-clang check-polly check-libc check-llvm
build kite is being flaky right now so I'd love a clean bill of health before landing to unblock folks.
Ah I see. I tested check-all, but I did not build flang/openmp/polly/libc for my local testing. Let me give those a go instead of running the "test-suite".
Many thanks - I assume your build machine is better than mine :)
I got check-clang and check-llvm on my machine and both are all good (which is usually a good sign)
No problem! The ppc buildbot (e.g. https://lab.llvm.org/buildbot/#/builders/57/builds/17829/steps/6/logs/stdio) is only testing clang;llvm;clang-tools-extra;lld, and that was what included in my runs. Those were green!
My local OpenMP tests are having some hiccups but it does not seem to have anything to do with this patch. Bolt is not supported on PPC. polly, mlir and flang checks are green. So I am pretty confident that we are good for Linux on Power. @Jake-Egan can comment more on on AIX but it seems we are good there as well.
Finally got green on Debian build (seems like check-all on build kite only works at night?) https://buildkite.com/llvm-project/premerge-checks/builds/92657#5c473a5a-6e3d-4247-a307-30df72a6482d
I'll land this to unblock folks, thanks all for helping test!