Bug 22558 – [REG 2.098] Error: function 'core.stdc.stdio.vfprintf' 'pragma(printf)' functions must be 'extern(C) int vfprintf([parameters...], const(char)*, va_list)'

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-12-01T21:36:25Z
Last change time
2021-12-14T23:06:28Z
Keywords
pull
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2021-12-01T21:36:25Z
Reduced test: --- module core.stdc.stdio; struct __va_list_tag { uint gp_offset; uint fp_offset; void* overflow_arg_area; void* reg_save_area; } struct FILE; version (all) { alias __builtin_va_list = __va_list_tag*; alias va_list = __builtin_va_list; } else { alias va_list = __va_list_tag*; } extern(C) { pragma(printf) int vfprintf(FILE* stream, scope const char* format, va_list arg); }
Comment #1 by ibuclaw — 2021-12-01T21:39:06Z
What happens is that in dmd.typesem, it sees the identifier __builtin_va_list, and blindly sets the type to `void*`, rather than using the already defined alias that resolves to the correct type. PR that introduced this behaviour: https://github.com/dlang/dmd/pull/13107
Comment #2 by dlang-bot — 2021-12-13T23:54:23Z
@ibuclaw created dlang/dmd pull request #13424 "fix Issue 22558 - [REG 2.098] Error: function 'core.stdc.stdio.vfprintf' 'pragma(printf)' functions must be 'extern(C) int vfprintf([parameters...], const(char)*, va_list)'" fixing this issue: - fix Issue 22558 - [REG 2.098] Error: function 'core.stdc.stdio.vfprintf' 'pragma(printf)' functions must be 'extern(C) int vfprintf([parameters...], const(char)*, va_list)' https://github.com/dlang/dmd/pull/13424
Comment #3 by dlang-bot — 2021-12-14T23:06:28Z
dlang/dmd pull request #13424 "fix Issue 22558 - [REG 2.098] Error: function 'core.stdc.stdio.vfprintf' 'pragma(printf)' functions must be 'extern(C) int vfprintf([parameters...], const(char)*, va_list)'" was merged into stable: - a59af18214af241f4383c1876029ef7256f70d8b by Iain Buclaw: fix Issue 22558 - [REG 2.098] Error: function 'core.stdc.stdio.vfprintf' 'pragma(printf)' functions must be 'extern(C) int vfprintf([parameters...], const(char)*, va_list)' https://github.com/dlang/dmd/pull/13424