[llvm-bugs] [Bug 41215] New: Invalid checksum computation when compiling from preprocessed output
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Mar 24 05:07:14 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41215
Bug ID: 41215
Summary: Invalid checksum computation when compiling from
preprocessed output
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: lambert.clara at yahoo.fr
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Created attachment 21662
--> https://bugs.llvm.org/attachment.cgi?id=21662&action=edit
Fix
When clang-cl compiles an object from preprocessed output, the checksum of the
individual files that were included in it will be incorrect in the generated
debug info, since it will be the checksum of the preprocessed file, instead of
being the one from the files themselves.
This leads to an error when debugging from visual studio, since the files will
be considered different from their source, we get a popup with the message "The
source file is different from when the module was built. Would you like the
debugger to use it anyway?".
This can be reproduced with those steps:
- Create two files, main.cpp and lib.h
- Include lib.h in main.cpp
- Generate the pp output with `clang-cl /c main.cpp /Z7 /P"
- Compile the generated pp output to an obj
- Link and generate an exe and pdb
- Use `cvdump -sf main.pdb`
- Notice that under the main.obj module, each file's MD5 is the same:
** Module: "E:\RD\tests\clang_hash\main.obj"
0 E:\RD\tests\clang_hash\lib.h (MD5: 136293700AE501A1FB76EBD273C8D288)
1 C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\stdio.h
(MD5: 136293700AE501A1FB76EBD273C8D288)
2 E:\RD\tests\clang_hash\main.cpp (MD5: 136293700AE501A1FB76EBD273C8D288)
3 C:\Program Files (x86)\Windows
Kits\10\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h (MD5:
136293700AE501A1FB76EBD273C8D288)
MSVC compiler clears out the checksum field in that instance:
** Module: "E:\RD\tests\clang_hash\main.obj"
0 c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
(None)
1 c:\program files (x86)\windows
kits\10\include\10.0.17763.0\ucrt\corecrt_wstdio.h (None)
2 c:\program files (x86)\windows
kits\10\include\10.0.17763.0\ucrt\corecrt_stdio_config.h (None)
3 c:\program files (x86)\microsoft visual
studio\2017\professional\vc\tools\msvc\14.16.27023\include\vcruntime_new.h
(None)
4 e:\rd\tests\clang_hash\main.cpp (None)
5 e:\rd\tests\clang_hash\lib.h (None)
I've attached a patch for that issue, that makes the behavior of clang match
the one from MSVC.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190324/13f227d6/attachment.html>
More information about the llvm-bugs
mailing list