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

compilation broken since commit 2b6f7fc7 #2771

Closed
moiwi opened this issue Feb 16, 2022 · 4 comments
Closed

compilation broken since commit 2b6f7fc7 #2771

moiwi opened this issue Feb 16, 2022 · 4 comments

Comments

@moiwi
Copy link
Contributor

moiwi commented Feb 16, 2022

Since commit 2b6f7fc (Add partial support for extended precision FP) I get these errors compiling format.cc with gcc 8.1:

t:\fmt.org\include\fmt\format-inl.h: In instantiation of 'constexpr bool fmt::v8::detail::fp::assign(Float) [with Float = long double; typename std::enable_if<std::integral_constant<bool, (((sizeof (Float) == sizeof (unsigned int)) || (sizeof (Float) == (2 * sizeof (unsigned int)))) || (std::numeric_limits<_Tp>::digits == 64))>::value, int>::type <anonymous> = 0]':
t:\fmt.org\include\fmt\format-inl.h:245:66:   required from 'constexpr fmt::v8::detail::fp::fp(Float) [with Float = long double]'
t:\fmt.org\include\fmt\format-inl.h:2264:30:   required from 'int fmt::v8::detail::format_float(T, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer<char>&) [with T = long double]'
../../fmt.org/src/format.cc:111:64:   required from here
t:\fmt.org\include\fmt\format-inl.h:260:24: error: cannot convert 'long long unsigned int' to 'const carrier_uint' {aka 'const fmt::v8::detail::uint128_t'} in initialization
     const carrier_uint significand_mask = implicit_bit - 1;
                        ^~~~~~~~~~~~~~~~
t:\fmt.org\include\fmt\format-inl.h:262:11: error: no match for 'operator&' (operand types are 'fmt::v8::detail::uint128_t' and 'const carrier_uint' {aka 'const fmt::v8::detail::uint128_t'})
     f = u & significand_mask;
         ~~^~~~~~~~~~~~~~~~~~
t:\fmt.org\include\fmt\format-inl.h:264:29: error: no match for 'operator&' (operand types are 'fmt::v8::detail::uint128_t' and 'fmt::v8::detail::dragonbox::float_info<long double, void>::carrier_uint' {aka 'fmt::v8::detail::uint128_t'})
         static_cast<int>((u & exponent_mask<Float>()) >>
                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from t:\fmt.org\include\fmt\format-inl.h:29,
                 from ../../fmt.org/src/format.cc:8:
t:\fmt.org\include\fmt\format.h: In instantiation of 'constexpr typename fmt::v8::detail::dragonbox::float_info<T>::carrier_uint fmt::v8::detail::exponent_mask() [with T = long double; typename fmt::v8::detail::dragonbox::float_info<T>::carrier_uint = fmt::v8::detail::uint128_t]':
t:\fmt.org\include\fmt\format-inl.h:264:51:   required from 'constexpr bool fmt::v8::detail::fp::assign(Float) [with Float = long double; typename std::enable_if<std::integral_constant<bool, (((sizeof (Float) == sizeof (unsigned int)) || (sizeof (Float) == (2 * sizeof (unsigned int)))) || (std::numeric_limits<_Tp>::digits == 64))>::value, int>::type <anonymous> = 0]'
t:\fmt.org\include\fmt\format-inl.h:245:66:   required from 'constexpr fmt::v8::detail::fp::fp(Float) [with Float = long double]'
t:\fmt.org\include\fmt\format-inl.h:2264:30:   required from 'int fmt::v8::detail::format_float(T, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer<char>&) [with T = long double]'
../../fmt.org/src/format.cc:111:64:   required from here
t:\fmt.org\include\fmt\format.h:1271:20: error: no match for 'operator<<' (operand types are 'uint' {aka 'fmt::v8::detail::uint128_t'} and 'const int')
   return ((uint(1) << dragonbox::float_info<T>::exponent_bits) - 1)
           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@vitaut
Copy link
Contributor

vitaut commented Feb 16, 2022

I was not able to repro it on https://godbolt.org/z/rza3b9KfE. Could you provide more details (ideally a godbolt repro)?

@moiwi
Copy link
Contributor Author

moiwi commented Feb 17, 2022

The error seems to be due to 32 bit mode (https://godbolt.org/z/5c5bx9vfT)

@vitaut
Copy link
Contributor

vitaut commented Feb 17, 2022

Should be fixed in ce93a66. Thanks for reporting.

@vitaut vitaut closed this as completed Feb 17, 2022
@moiwi
Copy link
Contributor Author

moiwi commented Feb 17, 2022

Sorry, now I get this error:

t:\fmt.org\fmt\format.h: In instantiation of 'To fmt::v8::detail::bit_cast(const From&) [with To = fmt::v8::detail::uint128_t; From = long double]':
t:\fmt.org\fmt\format-inl.h:261:36:   required from 'constexpr bool fmt::v8::detail::fp::assign(Float) [with Float = long double; typename std::enable_if<std::integral_constant<bool, (((sizeof (Float) == sizeof (unsigned int)) || (sizeof (Float) == (2 * sizeof (unsigned int)))) || (std::numeric_limits<_Tp>::digits == 64))>::value, int>::type <anonymous> = 0]'
t:\fmt.org\fmt\format-inl.h:245:66:   required from 'constexpr fmt::v8::detail::fp::fp(Float) [with Float = long double]'
t:\fmt.org\fmt\format-inl.h:2264:30:   required from 'int fmt::v8::detail::format_float(T, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer<char>&) [with T = long double]'
../../fmt.org/src/format.cc:111:64:   required from here
t:\fmt.org\fmt\format.h:293:28: error: static assertion failed: size mismatch
   static_assert(sizeof(To) == sizeof(From), "size mismatch");
                 ~~~~~~~~~~~^~~~~~~~~~~~~~~
t:\fmt.org\fmt\format.h:298:14: warning: 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'class fmt::v8::detail::uint128_t' from an array of 'const long double' [-Wclass-memaccess]
   std::memcpy(&to, &from, sizeof(to));
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from t:\fmt.org\fmt\format.h:50,
                 from t:\fmt.org\fmt\format-inl.h:29,
                 from ../../fmt.org/src/format.cc:8:
t:\fmt.org\fmt\core.h:393:7: note: 'class fmt::v8::detail::uint128_t' declared here
 class uint128_t {
       ^~~~~~~~~

(plus an initialization order warning:

t:\fmt.org\fmt\core.h: In constructor 'constexpr fmt::v8::detail::uint128_t::uint128_t(uint64_t)':
t:\fmt.org\fmt\core.h:395:17: warning: 'fmt::v8::detail::uint128_t::hi_' will be initialized after [-Wreorder]
   uint64_t lo_, hi_;
                 ^~~
t:\fmt.org\fmt\core.h:395:12: warning:   'uint64_t fmt::v8::detail::uint128_t::lo_' [-Wreorder]
   uint64_t lo_, hi_;
            ^~~
t:\fmt.org\fmt\core.h:399:13: warning:   when initialized here [-Wreorder]
   constexpr uint128_t(uint64_t value = 0) : hi_(0), lo_(value) {}
             ^~~~~~~~~

)

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

2 participants