On Windows, opening a source file in text mode translates CRLF to LF.
md5_stream therefore records a checksum that does not match the file
contents.  Open source files in binary mode before calculating CodeView
checksums.

gcc/ChangeLog:

        PR debug/119940
        * dwarf2codeview.cc (codeview_start_source_file): Open the source file
        in binary mode.
---
 gcc/dwarf2codeview.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index ada04079fd..67e3799104 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -1746,7 +1746,7 @@ codeview_start_source_file (const char *filename)
   sf->string_offset = string_offset;
   sf->filename = xstrdup (filename);
 
-  f = fopen (filename, "r");
+  f = fopen (filename, "rb");
   if (!f)
     internal_error ("could not open %s for reading", filename);
 
-- 
2.55.0.windows.5

Reply via email to