[LLVMbugs] [Bug 4449] New: CppBackend writes incorrect C strings if input file name contains a backslash

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jun 25 13:07:38 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=4449

           Summary: CppBackend writes incorrect C strings if input file name
                    contains a backslash
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: abbeyj at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3121)
 --> (http://llvm.org/bugs/attachment.cgi?id=3121)
Escape mName when printing

The CppBackend will produce incorrect C strings for the module identifier if
the input file name contains a backslash.  This is more easily shown on Windows
where backslash is the path separator.  Patch attached.


Steps to reproduce:

C:\Temp>cat temp.ll
@x = common global i32 0

C:\Temp>llvm-as temp.ll

C:\Temp>llc -march=cpp .\temp.bc -o temp.cpp

C:\Temp>llc -march=cpp -cppgen=contents .\temp.bc -o temp-contents.cpp


Actual Results:
Note that the generated strings contain a tab character (\t).

C:\Temp>grep "temp.bc" temp.cpp
  Module* mod = new Module(".\temp.bc");

C:\Temp>grep "temp.bc" temp-contents.cpp
mod->setModuleIdentifier(".\temp.bc");


Expected Results:
The backslash should be escaped.

C:\Temp>grep "temp.bc" temp.cpp
  Module* mod = new Module(".\x5Ctemp.bc");

C:\Temp>grep "temp.bc" temp-contents.cpp
mod->setModuleIdentifier(".\x5Ctemp.bc");


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list