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

format-test failing on ppc64el #3365

Closed
trldp opened this issue Mar 26, 2023 · 6 comments
Closed

format-test failing on ppc64el #3365

trldp opened this issue Mar 26, 2023 · 6 comments

Comments

@trldp
Copy link

trldp commented Mar 26, 2023

When running unit tests on Ubuntu compiled with gcc on the architecture ppc64el, the test format-test fails with the following error:

./test/format-test.cc:1493: Failure
Expected equality of these values:
  buffer
    Which is: "0x1.a7ae147ae147ae147ae147ae148p+1"
  fmt::format("{:a}", 3.31l)
    Which is: "0x0.0000000000001a7ae147ae147bp+54"

The error was detected on Ubuntu 22.04, but seems to occur on all other currently supported versions. Full logs can be found at https://launchpadlibrarian.net/657130777/buildlog_ubuntu-focal-ppc64el.fmtlib_9.1.0-1~git202303230019+5~ubuntu20.04.1_BUILDING.txt.gz.

@phprus
Copy link
Contributor

phprus commented Mar 26, 2023

@trldp

Please, build and run next code:

#include <iostream>
#include <limits>
#include <typeinfo>

int main()
{
    auto v = 3.31l;
    using T = decltype(v);
    std::cout << typeid(T).name() << std::endl;   
    std::cout << std::numeric_limits<T>::is_iec559 << std::endl;
    std::cout << "size:" << sizeof(T) << std::endl;
    std::cout << std::endl;
    std::cout << std::numeric_limits<T>::is_specialized << std::endl;
    std::cout << std::numeric_limits<T>::is_signed << std::endl;
    std::cout << std::numeric_limits<T>::is_integer << std::endl;
    std::cout << std::numeric_limits<T>::is_exact << std::endl;
    std::cout << std::numeric_limits<T>::has_infinity << std::endl;
    std::cout << std::numeric_limits<T>::has_quiet_NaN << std::endl;
    std::cout << std::numeric_limits<T>::has_signaling_NaN << std::endl;
    std::cout << std::numeric_limits<T>::has_denorm << std::endl;
    std::cout << std::numeric_limits<T>::has_denorm_loss << std::endl;
    std::cout << std::numeric_limits<T>::round_style << std::endl;
    std::cout << std::numeric_limits<T>::is_iec559 << std::endl;
    std::cout << std::numeric_limits<T>::is_bounded << std::endl;
    std::cout << std::numeric_limits<T>::is_modulo << std::endl;
    std::cout << std::numeric_limits<T>::digits << std::endl;
    std::cout << std::numeric_limits<T>::digits10 << std::endl;
    std::cout << std::numeric_limits<T>::max_digits10 << std::endl;
    std::cout << std::numeric_limits<T>::radix << std::endl;
    std::cout << std::numeric_limits<T>::min_exponent << std::endl;
    std::cout << std::numeric_limits<T>::min_exponent10 << std::endl;
    std::cout << std::numeric_limits<T>::max_exponent << std::endl;
    std::cout << std::numeric_limits<T>::max_exponent10 << std::endl;
    std::cout << std::numeric_limits<T>::traps << std::endl;
    std::cout << std::numeric_limits<T>::tinyness_before << std::endl;
    return 0;
}

and command:

c++filt -t <first_line_of_output>

@trldp
Copy link
Author

trldp commented Mar 26, 2023

This is the output of your code above

g
1
size:16

1
1
0
0
1
1
1
1
0
1
1
1
0
106
31
33
2
-968
-291
1024
308
0
0

and this is de output of the command c++filt -t g

__float128

@phprus
Copy link
Contributor

phprus commented Mar 27, 2023

@trldp
Please compile fmtlib with the flag

CXXFLAGS="-mabi=ieeelongdouble"

and run tests.

An error due to limited support for the double-double format in fmtlib.

I'll make a workaround for tests.

@phprus
Copy link
Contributor

phprus commented Mar 28, 2023

Please test this branch: https://github.com/phprus/fmt/tree/hexfloat-ppc64el

@trldp
Copy link
Author

trldp commented Mar 30, 2023

With the flag -mabi=ieeelongdouble, I do get the following error in format-test:

./include/fmt/format.h:3439: assertion failed: value is negativeterminate called without an active exception.

The branch above does works like a charm (without -mabi=ieeelongdouble).

@phprus
Copy link
Contributor

phprus commented Mar 30, 2023

With the flag -mabi=ieeelongdouble, I do get the following error in format-test:

I think this is a different bug not related with this issue.

The branch above does works like a charm

I created PR #3366.
But this is not a very fair fix, since fmt does not support double-double and converts it to double.

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

3 participants