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

            Bug ID: 120192
           Summary: Internal compiler error when building ring Rust crate
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.stamcar at hotmail dot com
  Target Milestone: ---

When building a Rust project that depends on a ring
(https://github.com/briansmith/ring) Rust crate using
`stable-x86_64-pc-windows-gnu` toolchain on Windows, I get internal compiler
error:

        ❯ cargo build          
           Compiling yoke v0.7.5
           Compiling socket2 v0.5.9
           Compiling mio v1.0.3
           Compiling darling_macro v0.20.11
           Compiling dioxus-core v0.6.3
           Compiling gemm-common v0.17.1
           Compiling ring v0.17.14
           Compiling aho-corasick v1.1.3
           Compiling rustls-pki-types v1.11.0
           Compiling indexmap v2.9.0
           Compiling phf v0.11.3
           Compiling untrusted v0.9.0
           Compiling precomputed-hash v0.1.1                                    
        warning: ring@0.17.14: during RTL pass: expand                          
        warning: ring@0.17.14: In file included from
E:\Cache\rust\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ring-0.17.14\crypto/curve25519/internal.h:20,
        warning: ring@0.17.14:                  from
E:\Cache\rust\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ring-0.17.14\crypto/curve25519/curve25519.c:24:
        warning: ring@0.17.14:
E:/Cache/rust/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/crypto/internal.h:
In function 'constant_time_conditional_memxor':
        warning: ring@0.17.14:
E:/Cache/rust/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/crypto/internal.h:260:20:
internal compiler error: in expand_one_stack_var_1, at cfgexpand.cc:1738
        warning: ring@0.17.14:   260 | static inline void
constant_time_conditional_memxor(void *dst, const void *src,
        warning: ring@0.17.14:       |                   
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        warning: ring@0.17.14: Please submit a full bug report, with
preprocessed source (by using -freport-bug).
        warning: ring@0.17.14: See <https://github.com/niXman/mingw-builds> for
instructions.
        error: failed to run custom build command for `ring v0.17.14`

        Caused by:
          process didn't exit successfully:
`E:\Projects\School\SrednjeveskiArhivi\target\debug\build\ring-f4c4918d144c179c\build-script-build`
(exit code: 1)
          --- stdout
          cargo:rerun-if-env-changed=CARGO_MANIFEST_DIR
          cargo:rerun-if-env-changed=CARGO_PKG_NAME
          cargo:rerun-if-env-changed=CARGO_PKG_VERSION_MAJOR
          cargo:rerun-if-env-changed=CARGO_PKG_VERSION_MINOR
          cargo:rerun-if-env-changed=CARGO_PKG_VERSION_PATCH
          cargo:rerun-if-env-changed=CARGO_PKG_VERSION_PRE
          cargo:rerun-if-env-changed=CARGO_MANIFEST_LINKS
          cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
          cargo:rerun-if-env-changed=OUT_DIR
          cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ARCH
          cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
          cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ENV
          cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ENDIAN
          OPT_LEVEL = Some(0)
          OUT_DIR =
Some(E:\Projects\School\SrednjeveskiArhivi\target\debug\build\ring-2f9bf6e1f47e27e4\out)
          TARGET = Some(x86_64-pc-windows-gnu)
          HOST = Some(x86_64-pc-windows-gnu)
          cargo:rerun-if-env-changed=CC_x86_64-pc-windows-gnu
          CC_x86_64-pc-windows-gnu = None
          cargo:rerun-if-env-changed=CC_x86_64_pc_windows_gnu
          CC_x86_64_pc_windows_gnu = None
          cargo:rerun-if-env-changed=HOST_CC
          HOST_CC = None
          cargo:rerun-if-env-changed=CC
          CC = None
          cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
          RUSTC_WRAPPER = None
          cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
          CRATE_CC_NO_DEFAULTS = None
          DEBUG = Some(true)
          CARGO_CFG_TARGET_FEATURE =
Some(adx,aes,avx,avx2,bmi1,bmi2,cmpxchg16b,f16c,fma,fxsr,lzcnt,movbe,pclmulqdq,popcnt,rdrand,rdseed,sha,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave,xsavec,xsaveopt,xsaves)
          cargo:rerun-if-env-changed=CFLAGS
          CFLAGS = Some(-march=native)
          cargo:rerun-if-env-changed=CC_SHELL_ESCAPED_FLAGS
          CC_SHELL_ESCAPED_FLAGS = None
          cargo:rerun-if-env-changed=HOST_CFLAGS
          HOST_CFLAGS = None
          cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_gnu
          CFLAGS_x86_64_pc_windows_gnu = None
          cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-gnu
          CFLAGS_x86_64-pc-windows-gnu = None
          CARGO_ENCODED_RUSTFLAGS = Some(-Ctarget-cpu=native)
          cargo:warning=during RTL pass: expand
          cargo:warning=In file included from
E:\Cache\rust\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ring-0.17.14\crypto/curve25519/internal.h:20,
          cargo:warning=                 from
E:\Cache\rust\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ring-0.17.14\crypto/curve25519/curve25519.c:24:
         
cargo:warning=E:/Cache/rust/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/crypto/internal.h:
In function 'constant_time_conditional_memxor':
         
cargo:warning=E:/Cache/rust/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/crypto/internal.h:260:20:
internal compiler error: in expand_one_stack_var_1, at cfgexpand.cc:1738
          cargo:warning=  260 | static inline void
constant_time_conditional_memxor(void *dst, const void *src,
          cargo:warning=      |                   
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          cargo:warning=Please submit a full bug report, with preprocessed
source (by using -freport-bug).
          cargo:warning=See <https://github.com/niXman/mingw-builds> for
instructions.

          --- stderr


          error occurred in cc-rs: command did not execute successfully (status
code exit code: 1): "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections"
"-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I"
"E:\\Cache\\rust\\cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\ring-0.17.14\\include"
"-I" "E:\\Cac
       
he\\rust\\cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\ring-0.17.14\\pregenerated"
"-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align"
"-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers"
"-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "
        -Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef"
"-Wuninitialized" "-g3" "-DNDEBUG" "-march=native" "-o"
"E:\\Projects\\School\\SrednjeveskiArhivi\\target\\debug\\build\\ring-2f9bf6e1f47e27e4\\out\\73090ba2100ad232-curve25519.o"
"-c"
"E:\\Cache\\rust\\cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\ring-0.17.14\\crypto/curve25519/curve25519.c"


        warning: build failed, waiting for other jobs to finish...


Running GCC directly also fails:

        ❯ "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2"
"-fno-omit-frame-pointer" "-m64" "-I"
"E:\\Cache\\rust\\cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\ring-0.17.14\\include"
"-I"
"E:\\Cache\\rust\\cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\ring-0.17.14\\pregenerated"
"-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align"
"-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers"
"-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow"
"-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef"
"-Wuninitialized" "-g3" "-DNDEBUG" "-march=native" "-o"
"E:\\Projects\\School\\SrednjeveskiArhivi\\target\\debug\\build\\ring-2f9bf6e1f47e27e4\\out\\73090ba2100ad232-curve25519.o"
"-c"
"E:\\Cache\\rust\\cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\ring-0.17.14\\crypto/curve25519/curve25519.c"
"-freport-bug"           
        during RTL pass: expand
        In file included from
E:\Cache\rust\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ring-0.17.14\crypto/curve25519/internal.h:20,
                         from
E:\Cache\rust\cargo\registry\src\index.crates.io-1949cf8c6b5b557f\ring-0.17.14\crypto/curve25519/curve25519.c:24:
       
E:/Cache/rust/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/crypto/internal.h:
In function 'constant_time_conditional_memxor':
       
E:/Cache/rust/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/crypto/internal.h:260:20:
internal compiler error: in expand_one_stack_var_1, at cfgexpand.cc:1738
          260 | static inline void constant_time_conditional_memxor(void *dst,
const void *src,
              |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Please submit a full bug report, with preprocessed source.
        See <https://github.com/niXman/mingw-builds> for instructions.
        gcc.exe: fatal error: cannot execute 'C:/Program
Files/MinGW/bin/../libexec/gcc/x86_64-w64-mingw32/15.1.0/cc1.exe': open
temporary output file
        compilation terminated.


I am using GCC from MinGW Builds (https://github.com/niXman/mingw-builds)
project on Windows 11. This is my GCC version:

        ❯ gcc --version      
        gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-Builds project) 15.1.0
        Copyright (C) 2025 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions.  There is
NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


I've already reported this bug to the MinGW Builds project
(https://github.com/niXman/mingw-builds/issues/706), but they recommended
reporting it here.

Reply via email to