如何为 gcc-trunk 报告这个 ICE
How to report this ICE for gcc-trunk
我想让这段代码正常工作
#include <cstddef>
template <bool B, auto T, auto F>
struct conditional { static constexpr auto value = T; };
template <auto T, auto F>
struct conditional<false, T, F> { static constexpr auto value = F; };
template <std::size_t N, auto... Dims>
struct static_extent;
template <std::size_t N>
struct static_extent<N> {
static constexpr std::size_t value = 0;
};
template <std::size_t N, auto Dim, auto... Dims>
struct static_extent<N, Dim, Dims...> {
static constexpr auto value =
conditional<
(N == 0),
Dim,
static_extent<N-1, Dims...>::value
>::value;
};
enum class dynamic_extent_tag {};
inline constexpr dynamic_extent_tag dyn{-1};
int main()
{
static_assert(static_extent<1, 33, dyn, 19>::value == dyn, "");
static_assert(static_extent<0, 33, dyn, 19>::value == 33, "");
}
我已经在 godbolt and it seems to work with clang. I am unfortunately bound to gcc which gives me an ICE plus a stack trace. I tried to surf on their bugzilla 上测试过了,我有点迷路了。
是否值得为 trunk 版本提交错误报告?它甚至想要吗?
有人知道这是否已经是一个已知问题吗?
我查找了关键字 "ice",但在那里找不到任何有用的东西。
是的,应该报告所有 ICE。
我已经为你打开https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79556
谢谢。
我想为所有发现你问题的读者解答:
- 是的,非常感谢提交 trunk 的错误报告。在开发阶段,修复 bug 比发布后要容易得多。
- 是的,是通缉令。如果错误或回归是几天前或几周前引入的,则更改仍然存在并且修复起来不那么困难。
你应该如何进行?
- 尝试使用最新版本的 trunk 或尽可能新的版本。
- 重新编译添加了
-save-temps
的代码。这将生成一个 .i(对于 C,对于 C++ 将是 .ii)文件。
- 使用与上述相同的标志进行编译,但使用 .i/.ii 文件来检查问题是否仍然存在。
- Post 错误位于 gcc.gnu.org/bugzilla/,包括错误消息、GCC 版本 (
gcc - v
),并附上您的 .i/-ii 文件.
顺便说一下,LLVM/Clang 的工作方式类似:https://releases.llvm.org/1.9/docs/HowToSubmitABug.html
进一步阅读:
我想让这段代码正常工作
#include <cstddef>
template <bool B, auto T, auto F>
struct conditional { static constexpr auto value = T; };
template <auto T, auto F>
struct conditional<false, T, F> { static constexpr auto value = F; };
template <std::size_t N, auto... Dims>
struct static_extent;
template <std::size_t N>
struct static_extent<N> {
static constexpr std::size_t value = 0;
};
template <std::size_t N, auto Dim, auto... Dims>
struct static_extent<N, Dim, Dims...> {
static constexpr auto value =
conditional<
(N == 0),
Dim,
static_extent<N-1, Dims...>::value
>::value;
};
enum class dynamic_extent_tag {};
inline constexpr dynamic_extent_tag dyn{-1};
int main()
{
static_assert(static_extent<1, 33, dyn, 19>::value == dyn, "");
static_assert(static_extent<0, 33, dyn, 19>::value == 33, "");
}
我已经在 godbolt and it seems to work with clang. I am unfortunately bound to gcc which gives me an ICE plus a stack trace. I tried to surf on their bugzilla 上测试过了,我有点迷路了。
是否值得为 trunk 版本提交错误报告?它甚至想要吗? 有人知道这是否已经是一个已知问题吗? 我查找了关键字 "ice",但在那里找不到任何有用的东西。
是的,应该报告所有 ICE。
我已经为你打开https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79556
谢谢。
我想为所有发现你问题的读者解答:
- 是的,非常感谢提交 trunk 的错误报告。在开发阶段,修复 bug 比发布后要容易得多。
- 是的,是通缉令。如果错误或回归是几天前或几周前引入的,则更改仍然存在并且修复起来不那么困难。
你应该如何进行?
- 尝试使用最新版本的 trunk 或尽可能新的版本。
- 重新编译添加了
-save-temps
的代码。这将生成一个 .i(对于 C,对于 C++ 将是 .ii)文件。 - 使用与上述相同的标志进行编译,但使用 .i/.ii 文件来检查问题是否仍然存在。
- Post 错误位于 gcc.gnu.org/bugzilla/,包括错误消息、GCC 版本 (
gcc - v
),并附上您的 .i/-ii 文件.
顺便说一下,LLVM/Clang 的工作方式类似:https://releases.llvm.org/1.9/docs/HowToSubmitABug.html
进一步阅读: