Skip to content

dmd testsuite fails on compilable/stdcheaders.c with gcc-15 due to default switch to -std=gnu23 #21311

@the-horo

Description

@the-horo

The compileable/stdcheaders.c is failing with gcc-15 on x64 linux:

# REQUIRED_ARGS='-cpp=cpp-15' ./generated/run -f compilable/stdcheaders.c
 ... compilable/stdcheaders.c       -cpp=cpp-15 -fPIC ()
==============================
Test 'compilable/stdcheaders.c' failed. The logged output:
/root/d/dmd/generated/linux/release/64/dmd -conf= -m64 -Icompilable -cpp=cpp-15 -fPIC  -od/root/d/dmd/compiler/test/test_results/compilable/c -of/root/d/dmd/compiler/test/test_results/compilable/c/stdcheaders_0.o  -c compilable/stdcheaders.c
/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/stddef.h(465): Error: undefined identifier `nullptr`, did you mean alias `nullptr_t`?
  typedef typeof(nullptr) nullptr_t;
                 ^

==============================
Test 'compilable/stdcheaders.c' failed: Expected rc == 0, but exited with rc == 1

>>> TARGET FAILED: compilable/stdcheaders.c
FAILED targets:
- compilable/stdcheaders.c

The specific line making it fail is

#include <stddef.h>

One can trigger this error with older gccs as well, by passing the right -std:

  • gcc-14
# REQUIRED_ARGS='-cpp=cpp-14 -P-std=gnu23' ./generated/run -f compilable/stdcheaders.c
 ... compilable/stdcheaders.c       -cpp=cpp-14 -P-std=gnu23 -fPIC ()
==============================
Test 'compilable/stdcheaders.c' failed. The logged output:
/root/d/dmd/generated/linux/release/64/dmd -conf= -m64 -Icompilable -cpp=cpp-14 -P-std=gnu23 -fPIC  -od/root/d/dmd/compiler/test/test_results/compilable/c -of/root/d/dmd/compiler/test/test_results/compilable/c/stdcheaders_0.o  -c compilable/stdcheaders.c
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/stddef.h(450): Error: undefined identifier `nullptr`, did you mean alias `nullptr_t`?
  typedef typeof(nullptr) nullptr_t;
                 ^

==============================
Test 'compilable/stdcheaders.c' failed: Expected rc == 0, but exited with rc == 1

>>> TARGET FAILED: compilable/stdcheaders.c
FAILED targets:
- compilable/stdcheaders.c
  • gcc-13
# REQUIRED_ARGS='-cpp=cpp-13 -P-std=gnu2x' ./generated/run -f compilable/stdcheaders.c
 ... compilable/stdcheaders.c       -cpp=cpp-13 -P-std=gnu2x -fPIC ()
==============================
Test 'compilable/stdcheaders.c' failed. The logged output:
/root/d/dmd/generated/linux/release/64/dmd -conf= -m64 -Icompilable -cpp=cpp-13 -P-std=gnu2x -fPIC  -od/root/d/dmd/compiler/test/test_results/compilable/c -of/root/d/dmd/compiler/test/test_results/compilable/c/stdcheaders_0.o  -c compilable/stdcheaders.c
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/stddef.h(450): Error: undefined identifier `nullptr`, did you mean alias `nullptr_t`?
  typedef typeof(nullptr) nullptr_t;
                 ^

==============================
Test 'compilable/stdcheaders.c' failed: Expected rc == 0, but exited with rc == 1

>>> TARGET FAILED: compilable/stdcheaders.c
FAILED targets:
- compilable/stdcheaders.c

Rather then removing that line with the c23 std would it be a better idea to always pass -std=c11 or -std=gnu11 to the preprocessor, given that this is what importC supports?

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