Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test PathFuncs.move_or_copy fails on GCC 13 #22

Open
sin-ack opened this issue Nov 12, 2024 · 1 comment
Open

Test PathFuncs.move_or_copy fails on GCC 13 #22

sin-ack opened this issue Nov 12, 2024 · 1 comment

Comments

@sin-ack
Copy link

sin-ack commented Nov 12, 2024

Fails on both arm64 and amd64. Version 2024.11.04.00.

Log:

# ctest -j24 --test-load 24 --rerun-failed --output-on-failure
Test project /var/tmp/portage/dev-cpp/edencommon-2024.11.04.00/work/edencommon-2024.11.04.00_build
    Start 123: PathFuncs.move_or_copy
1/1 Test #123: PathFuncs.move_or_copy ...........***Failed    0.08 sec
Running main() from gmock_main.cc
Note: Google Test filter = PathFuncs.move_or_copy
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from PathFuncs
[ RUN      ] PathFuncs.move_or_copy
/var/tmp/portage/dev-cpp/edencommon-2024.11.04.00/work/edencommon-2024.11.04.00/eden/common/utils/test/PathFuncsTest.cpp:1378: Failure
Expected equality of these values:
  moved
    Which is: 2
  1

[  FAILED  ] PathFuncs.move_or_copy (2 ms)
[----------] 1 test from PathFuncs (2 ms total)

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

 1 FAILED TEST


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.15 sec

The following tests FAILED:
	123 - PathFuncs.move_or_copy (Failed)
Errors while running CTest
@sin-ack
Copy link
Author

sin-ack commented Nov 12, 2024

Reduced it to https://godbolt.org/z/fYdTaarTM, seems to be compiler weirdness... Removing the redundant block inside b will cause moved to be equal to 1 on both GCC 13 and 14.

Code
#include <cstdint>
#include <utility>
template <typename a> a b(a c) {
  {
    auto copied = std::move(c);
    return copied;
  }
}

int main() {
  uint32_t moved;
  
  class g {
  public:
    g(uint32_t *d) : d{d} {}
    g(g &e) : d{e.d} {}
    g(g &&e) : d{e.d} { *d += 1; }
    uint32_t *d;
  };

  g f{&moved};
  b(f);

  return moved != 1;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant