https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109883

--- Comment #2 from Matt Borland <matt at mattborland dot com> ---
(In reply to Xi Ruoyao from comment #1)
> Cannot reproduce for me.  Note that in this case GCC optimizes the entire
> function call away (see https://godbolt.org/z/968bPTvh9) even with -O0 so I
> can see no way how this will lead to a runtime error.

Here is an updated reproducer:

#include <iostream>
#include <stdfloat>
#include <cmath>

int main()
{
    auto val = std::pow(0.5F64, 2);
    std::cout << val << std::endl;
}

The failure can be seen godbolt here: https://godbolt.org/z/ej5nPn7o4. Running
this same snippet locally with ASAN yields:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==110879==ERROR: AddressSanitizer: stack-overflow on address 0x7fff6e2e7ff8 (pc
0x00000040126e bp 0x7fff6e2e8010 sp 0x7fff6e2e8000 T0)

    #0 0x40126e in __gnu_cxx::__promote_2<decltype
(((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0))), std::__is_integer<decltype
(((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0)))>::__value>::__type
std::pow<_Float64, _Float64>(_Float64, _Float64)
(/home/mborland/Documents/boost/libs/math/test/so+0x40126e) (BuildId:
6f720390f8d2a24a6dabec3c85e9cf5bb4c192ea)

SUMMARY: AddressSanitizer: stack-overflow
(/home/mborland/Documents/boost/libs/math/test/so+0x40126e) (BuildId:
6f720390f8d2a24a6dabec3c85e9cf5bb4c192ea) in __gnu_cxx::__promote_2<decltype
(((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0))), std::__is_integer<decltype
(((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64,
std::__is_integer<_Float64>::__value>::__type)(0)))>::__value>::__type
std::pow<_Float64, _Float64>(_Float64, _Float64)
==110879==ABORTING

For brevity I snipped out 245 more instances of the message next to #0.

> And GCC for aarch64-darwin target (i. e. "macOS 13.3.1 on M1") is not a part
> of this project, so are you using another fork?

It is provided by homebrew as gcc@13. For this reply I am using my Fedora 38
system with "gcc version 13.1.1 20230511 (Red Hat 13.1.1-2) (GCC)"

Reply via email to