https://gcc.gnu.org/g:e3bcb08678b2fea0dc346f7dad57188737be959e

commit r17-4675-ge3bcb08678b2fea0dc346f7dad57188737be959e
Author: Oleg Tolmatcev <[email protected]>
Date:   Wed Sep 23 00:57:39 2026 +0200

    codeview: Open source files in binary mode [PR119940]
    
    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.

Diff:
---
 gcc/dwarf2codeview.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index 252059d30144..014c35053a5e 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);

Reply via email to