Bug 24811 – Cant compile C code

Status
NEW
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-10-13T20:29:38Z
Last change time
2024-12-13T19:38:05Z
Keywords
ImportC
Assigned to
No Owner
Creator
barbosso
Moved to GitHub: dmd#20532 →

Attachments

IDFilenameSummaryContent-TypeSize
1919lib.clib.ctext/x-csrc121

Comments

Comment #0 by my-ijet — 2024-10-13T20:29:38Z
Created attachment 1919 lib.c How to reproduce //lib.c typedef float _Float32; typedef double _Float64; typedef double _Float32x; typedef long double _Float64x; // clang -c lib.c # compile OK dmd -c lib.c # compile ERRORS lib.c(1): Error: illegal combination of type specifiers lib.c(2): Error: illegal combination of type specifiers lib.c(3): Error: illegal combination of type specifiers lib.c(4): Error: illegal combination of type specifiers lib.c(4): Error: illegal type combination
Comment #1 by my-ijet — 2024-10-15T10:07:05Z
I found possible solution This error occure with inclusion of "/usr/include/bits/floatn-common.h" system lib to prevent error you can define __GNUC__ to be greater than 7 (for example - comment definition) //lib.c #define __GNUC__ 8 #include <bits/floatn-common.h> // clang -c lib.c # compile OK dmd -c lib.c # compile OK with WARNING lib.c:1:9: warning: '__GNUC__' macro redefined [-Wmacro-redefined] 1 | #define __GNUC__ 8 | ^ <built-in>:7:9: note: previous definition is here 7 | #define __GNUC__ 4 | ^
Comment #2 by my-ijet — 2024-10-16T08:17:57Z
SDL3 with callbacks also cant compile How to reproduce //SDL3.c #define __GNUC__ 8 #define SDL_MAIN_USE_CALLBACKS 1 /* use the callbacks instead of main$ #include <SDL3/SDL.h> #include <SDL3/SDL_main.h> // clang -c SDL3.c # compile OK ldc -c SDL3.c # compile ERRORS /usr/include/SDL3/SDL_stdinc.h(4294): Error: undefined identifier `__builtin_mul_overflow` /usr/include/SDL3/SDL_stdinc.h(4332): Error: undefined identifier `__builtin_add_overflow` /usr/include/SDL3/SDL_bits.h(79): Error: undefined identifier `__builtin_clz`
Comment #3 by robert.schadek — 2024-12-13T19:38:05Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20532 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB