Skip to content

PDB shows wrong calling convention when compiling static functions on Windows x86 #144301

@momo5502

Description

@momo5502

Compiling the following sample for Windows x86 with -O3 shows that static_func will have fastcc applied to it:

static __declspec(noinline) int static_func(int arg1){
	
	return arg1 * 2;
}

int main(int argc, char* argv[]) {
	return static_func(argc);
}

https://godbolt.org/z/Pcroj66c4

The PDB however shows NearC, so cdecl, instead of FastCall.

The reason this happens is because GlobalOpt updates the CC, but not the debug info:

F.setCallingConv(CallingConv::Fast);

I feel like the DISubroutineType should be updated to DW_CC_BORLAND_msfastcall for Windows x86. So that the PDB depicts the correct CC.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions