Skip to content

[Bug]: GCC 14.2.0 ICE on Debian AArch64 when compiling GoogleTest 1.18.0 parameterized tests #5067

Description

@adamgene

Describe the issue

Summary

GCC 14.2.0 crashes with an internal compiler error while compiling a GoogleTest value-parameterized test on Debian AArch64.

The failure occurs during template instantiation in GoogleTest 1.18.0, specifically in:

testing::internal::CheckedDowncastToActualType()

called by:

ValuesInIteratorRangeGenerator::Iterator::Equals()

The same project and source code compile successfully in the following configurations:

GCC 14.2.0 on Ubuntu 24.04 AMD64 with GoogleTest 1.18.0
GCC 14.2.0 on Debian AArch64 with GoogleTest 1.17.0

The failure is reproducible only with the combination of:

GCC 14.2.0
Debian AArch64
GoogleTest 1.18.0

This appears to be an AArch64-specific GCC 14.2 compiler issue exposed by changes introduced in GoogleTest 1.18.0. GCC should report a normal diagnostic for invalid source code, if any, rather than terminate with a segmentation fault.

Reproduction matrix

GCC 14.2.0 | Ubuntu 24.04 | AMD64  | GoogleTest 1.18.0 | PASS
GCC 14.2.0 | Debian       | ARM64  | GoogleTest 1.17.0 | PASS
GCC 14.2.0 | Debian       | ARM64  | GoogleTest 1.18.0 | ICE

Affected parameter type

The GoogleTest parameter type involved in the failure is:

std::tuple<
    signed char,
    unsigned int,
    std::filesystem::path,
    std::filesystem::path
>

The compiler crashes while instantiating:

testing::internal::ValuesInIteratorRangeGenerator<
    std::tuple<
        signed char,
        unsigned int,
        std::filesystem::path,
        std::filesystem::path
    >
>::Iterator::Equals()

Steps to reproduce the problem

Minimal reproduction candidate

The following test case approximates the structure that triggers the issue:

#include <filesystem>
#include <tuple>

#include <gtest/gtest.h>

using Param = std::tuple<
    signed char,
    unsigned int,
    std::filesystem::path,
    std::filesystem::path
>;

class ReproTest : public testing::TestWithParam<Param> {};

TEST_P(ReproTest, CompilesParameterizedTest) {
    EXPECT_TRUE(true);
}

INSTANTIATE_TEST_SUITE_P(
    Repro,
    ReproTest,
    testing::Values(
        Param{
            1,
            2U,
            std::filesystem::path{"input.bin"},
            std::filesystem::path{"output.bin"}
        }
    )
);

Example compilation command:

g++ \
    -std=c++20 \
    -O3 \
    -isystem /home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include \
    -L /home/gene/.conan2/p/b/gtestc6cac63e9157e/p/lib \
    -flto=auto \
    -fno-fat-lto-objects \
    report.cpp \
    -lgtest \
    -lgtest_main \
    -pthread \
    -o report
Failed result:

gene@raspberrypi:~/proj/gtest_failed $ g++
-std=c++20
-O3
-isystem /home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include
-L /home/gene/.conan2/p/b/gtestc6cac63e9157e/p/lib
-flto=auto
-fno-fat-lto-objects
report.cpp
-lgtest
-lgtest_main
-pthread
-o report
In file included from /home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include/gtest/gtest-message.h:57,
from /home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include/gtest/gtest-assertion-result.h:46,
from /home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include/gtest/gtest.h:64,
from report.cpp:4:
/home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include/gtest/internal/gtest-port.h: In instantiation of ‘Derived* testing::internal::CheckedDowncastToActualType(Base*) [with Derived = const ValuesInIteratorRangeGenerator<std::tuple<signed char, unsigned int, std::filesystem::__cxx11::path, std::filesystem::__cxx11::path> >::Iterator; Base = const ParamIteratorInterface<std::tuple<signed char, unsigned int, std::filesystem::__cxx11::path, std::filesystem::__cxx11::path> >]’:
/home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include/gtest/internal/gtest-param-util.h:352:57: required from ‘bool testing::internal::ValuesInIteratorRangeGenerator::Iterator::Equals(const testing::internal::ParamIteratorInterface&) const [with T = std::tuple<signed char, unsigned int, std::filesystem::__cxx11::path, std::filesystem::_cxx11::path>]’
352 | CheckedDowncastToActualType(&other)->iterator
;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include/gtest/internal/gtest-param-util.h:345:10: required from here
345 | bool Equals(const ParamIteratorInterface& other) const override {
| ^~~~~~
/home/gene/.conan2/p/b/gtestc6cac63e9157e/p/include/gtest/internal/gtest-port.h:1171:10: internal compiler error: Segmentation fault
1171 | return static_cast<Derived*>(base);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
0xd5061f internal_error(char const*, ...)
???:0
0xe77ee3 comp_type_attributes(tree_node const*, tree_node const*)
???:0
0x114c523 perform_direct_initialization_if_possible(tree_node*, tree_node*, bool, int)
???:0
0x13a5123 build_static_cast(unsigned int, tree_node*, tree_node*, int)
???:0
0x12a455f tsubst_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x13c1f9f instantiate_decl(tree_node*, bool, bool)
???:0
0xf762a7 instantiate_pending_templates(int)
???:0
0xf6b497 c_parse_final_cleanups()
???:0
0x178a953 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See file:///usr/share/doc/gcc-14/README.Bugs for instructions.

What version of GoogleTest are you using?

Installed gtest package

    gtest/1.18.0
      revisions
        e2507fc4efe2ec9e2db9e5c91eefab9f (2026-08-11 11:14:07 UTC)
          packages
            919b3575c3d845dc9ef564f9dbf7b05101a8e69d
              info
                settings
                  arch: armv8
                  build_type: Release
                  compiler: gcc
                  compiler.cppstd: 20
                  compiler.libcxx: libstdc++11
                  compiler.version: 14.2
                  os: Linux
                options
                  build_gmock: True
                  disable_pthreads: False
                  fPIC: True
                  hide_symbols: False
                  shared: False

What operating system and version are you using?

Environment

Failing environment

Operating system: Debian Linux
Architecture: AArch64 / ARM64
Compiler: GCC 14.2.0
C++ standard: C++20
Build system: CMake with Ninja
Dependency manager: Conan 2
GoogleTest version: 1.18.0
Build type: Release

Passing configurations

Configuration 1

Operating system: Ubuntu 24.04
Architecture: AMD64 / x86_64
Compiler: GCC 14.2.0
GoogleTest version: 1.18.0
Result: PASS

Configuration 2

Operating system: Debian Linux
Architecture: AArch64 / ARM64
Compiler: GCC 14.2.0
GoogleTest version: 1.17.0
Result: PASS

What compiler and version are you using?

The same as before.

What build system are you using?

The same as before.

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions