googletest icon indicating copy to clipboard operation
googletest copied to clipboard

WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD

Open ngie-eign opened this issue 6 years ago • 4 comments
trafficstars

WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD 13.0-CURRENT with clang 7.0.1, clang 8.0.0, and gcc 8.2.0 with the following message:

$ script WhenDynamicCastToTest.AmbiguousCast.typescript  ./googlemock/gmock-matchers_test --gtest_filter=WhenDynamicCastToTest.AmbiguousCast --gtest_color=no
Script started on Sat Mar  9 10:33:53 2019
Command: ./googlemock/gmock-matchers_test --gtest_filter=WhenDynamicCastToTest.AmbiguousCast --gtest_color=no
Running main() from gmock_main.cc
Note: Google Test filter = WhenDynamicCastToTest.AmbiguousCast
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from WhenDynamicCastToTest
[ RUN      ] WhenDynamicCastToTest.AmbiguousCast
/home/ngie/nfs/git/googletest/googlemock/test/gmock-matchers_test.cc:3732: Failure
Value of: as_base_ptr
Expected: when dynamic_cast to testing::gmock_matchers_test::(anonymous namespace)::AmbiguousCastTypes::VirtualDerived*, is NULL
  Actual: 0x7fffffffe280, 0x7fffffffe280
[  FAILED  ] WhenDynamicCastToTest.AmbiguousCast (1 ms)
[----------] 1 test from WhenDynamicCastToTest (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] WhenDynamicCastToTest.AmbiguousCast

 1 FAILED TEST

Command exit status: 1
Script done on Sat Mar  9 10:33:53 2019
$ uname -a
FreeBSD pinklady-fbsd-current.local 13.0-CURRENT FreeBSD 13.0-CURRENT r344424+96f6a9dbf063(projects/import-googletest-1.8.1) GENERIC-NODEBUG  amd64

The test seems correct in the RTTI case, but I'm unsure about the other cases. That being said, RTTI is enabled with clang/g++ with the cmake build and the FreeBSD project tree build.

(This is part of the impetus behind my proposed change in #2148 BTW).

For now this is a tracking bug. I will dig into this further and add more details at a later point.

CC: @asomers, @emaste

ngie-eign avatar Mar 09 '19 18:03 ngie-eign

@ngie-eign we should submit a PR to add Cirrus-CI support to get CI coverage for FreeBSD.

emaste avatar Mar 11 '19 15:03 emaste

The same issue occurs with clang 6.0.0 on 11.2-RELEASE-p7:

[ngie@picasso ~/git/googletest]$ ./googlemock/gmock-matchers_test --gtest_filter=WhenDynamicCastToTest.AmbiguousCast
Running main() from gmock_main.cc
Note: Google Test filter = WhenDynamicCastToTest.AmbiguousCast
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from WhenDynamicCastToTest
[ RUN      ] WhenDynamicCastToTest.AmbiguousCast
/home/ngie/git/googletest/googlemock/test/gmock-matchers_test.cc:3732: Failure
Value of: as_base_ptr
Expected: when dynamic_cast to testing::gmock_matchers_test::(anonymous namespace)::AmbiguousCastTypes::VirtualDerived*, is NULL
  Actual: 0x7fffffffe040, 0x7fffffffe040
[  FAILED  ] WhenDynamicCastToTest.AmbiguousCast (1 ms)
[----------] 1 test from WhenDynamicCastToTest (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] WhenDynamicCastToTest.AmbiguousCast

 1 FAILED TEST
[ngie@picasso ~/git/googletest]$ clang
clang         clang-cpp     clang-tblgen  clang++       
[ngie@picasso ~/git/googletest]$ clang++ --version
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0)
Target: x86_64-unknown-freebsd11.2
Thread model: posix
InstalledDir: /usr/bin
[ngie@picasso ~/git/googletest]$ uname -a
FreeBSD picasso.local 11.2-RELEASE-p7 FreeBSD 11.2-RELEASE-p7 #0: Tue Dec 18 08:29:33 UTC 2018     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64

ngie-eign avatar Mar 11 '19 16:03 ngie-eign

Same thing happens with clang 3.8.1 and clang 4.0.1.

ngie-eign avatar Mar 11 '19 20:03 ngie-eign

This test case still fails on FreeBSD 13.2-RELEASE with clang++ 14.0.5:

[ RUN      ] WhenDynamicCastToTest.AmbiguousCast
/home/ngie/git/googletest/googlemock/test/gmock-matchers-comparisons_test.cc:2227: Failure
Value of: as_base_ptr
Expected: when dynamic_cast to testing::gmock_matchers_test::(anonymous namespace)::AmbiguousCastTypes::VirtualDerived*, is NULL
  Actual: 0x8206916c0, 0x8206916c0

[  FAILED  ] WhenDynamicCastToTest.AmbiguousCast (0 ms)

ngie-eign avatar Aug 07 '23 21:08 ngie-eign