clang-cl 8.0 (x86) - pdb

Hi,

I’ve come across the following issue with Clang 8.0 under Windows 10 (Home - Version 10.0.17134 Build 17134) using clang’s cl driver. I have the following snippet of code that uses double:

#include <stdio.h>

int main (int argc, char **argv)

{
int size = 60;
printf(“size=%d\n”, size);

double d = 1.4;
printf(“double=%f\n”, d);

int ret = (size * d);
printf(“ret=%d\n”, ret);

return ret;
}

If I compile this with the x64 version of Clang while debugging with lldb the variables have the expected value and the console’s output looks good too. Instead, if I use the x86 version, the debug session shows weird numbers for the variables, even though the console’s output is correct (so is the program).

If I directly use cl.exe (x86) to compile the program, the debug session works as expected (and the program keeps working as expected). The same happens if I change “double d = 1.4” by “float d = 1.4”, both the debug session and the program work as expected. Also, if I use the MSVC debugger the output for all the scenarios is the same.

Am I missing something here or is it a bug with the generated PDB file? These are the logs of each scenario:

clang-cl-x64.log: https://gist.github.com/lbrugnara/1c644fc6fbbb1ee44d9848d7f3697a8b
clang-cl-x86.log: https://gist.github.com/lbrugnara/415e89dbe5318b03a73a0d851be0961d
cl-x86.log: https://gist.github.com/lbrugnara/de9b54a896d995f8f5e712a064134d52
clang-cl-x86-float.log: https://gist.github.com/lbrugnara/16fd3fcbf3876e6b829a5dfd0d46973c

Thanks

– Leo

I’m forwarding this from the cfe-users list, thanks in advance.