<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - snprintf wrapper crash in dfsan during compilation"
   href="https://llvm.org/bugs/show_bug.cgi?id=28907">28907</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>snprintf wrapper crash in dfsan during compilation
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martin_rataj@hotmail.cz
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16913" name="attach_16913" title="preprocessed source">attachment 16913</a> <a href="attachment.cgi?id=16913&action=edit" title="preprocessed source">[details]</a></span>
preprocessed source

Compilation of a redis, hiredis, with dfsan crashes on the snprintf wrapper
with the following message:

Wrong types for attribute: byval inalloca nest noalias nocapture nonnull
readnone readonly sret dereferenceable(1) dereferenceable_or_null(1)
call i32 (i8*, i64, i8*, i16, i16, i16, i16*, i16*, ...) @__dfsw_snprintf(i8*
%32, i64 128, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0,
i64 0), i16 nonnull 0, i16 0, i16 0, i16* %35, i16* %labelreturn, i8*
getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0)) #7, !dbg
!259
fatal error: error in backend: Broken function found, compilation aborted!

The run script:
# Crash reproducer for clang version 3.9.0 (trunk 271217)
# Driver args: "-std=c99" "-pedantic" "-c" "-O3" "-fPIC" "-fsanitize=dataflow"
"-O2" "-g" "-Wall" "-W" "-pedantic" "-Wall" "-W" "-Wstrict-prototypes"
"-Wwrite-strings" "-g" "-ggdb" "net.c"
# Original command:  "$(LLVM_DIR)/build/bin/clang-3.9" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-disable-free" "-main-file-name"
"net.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix"
"-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables"
"-fuse-init-array" "-target-cpu" "x86-64" "-momit-leaf-frame-pointer"
"-dwarf-column-info" "-debug-info-kind=limited" "-dwarf-version=4"
"-debugger-tuning=gdb" "-coverage-file" "$(REDIS_DIR)/deps/hiredis/net.c"
"-resource-dir" "$(LLVM_DIR)/build/bin/../lib/clang/3.9.0" "-internal-isystem"
"/usr/local/include" "-internal-isystem"
"$(LLVM_DIR)/build/bin/../lib/clang/3.9.0/include" "-internal-externc-isystem"
"/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include"
"-internal-externc-isystem" "/usr/include" "-O2" "-Wall" "-W" "-Wall" "-W"
"-Wstrict-prototypes" "-Wwrite-strings" "-pedantic" "-std=c99"
"-fconst-strings" "-fdebug-compilation-dir" "$(REDIS_DIR)/deps/hiredis"
"-ferror-limit" "19" "-fmessage-length" "110" "-fsanitize=dataflow"
"-fsanitize-blacklist=$(LLVM_DIR)/build/bin/../lib/clang/3.9.0/dfsan_abilist.txt"
"-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics"
"-vectorize-loops" "-vectorize-slp" "-o" "net.o" "-x" "c" "net.c"
 "$(LLVM_DIR)/build/bin/clang-3.9" "-cc1" "-triple" "x86_64-unknown-linux-gnu"
"-emit-obj" "-disable-free" "-main-file-name" "net.c" "-mrelocation-model"
"pic" "-pic-level" "2" "-mthread-model" "posix" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu"
"x86-64" "-momit-leaf-frame-pointer" "-dwarf-column-info"
"-debug-info-kind=limited" "-dwarf-version=4" "-debugger-tuning=gdb" "-O2"
"-Wall" "-W" "-Wall" "-W" "-Wstrict-prototypes" "-Wwrite-strings" "-pedantic"
"-std=c99" "-fconst-strings" "-ferror-limit" "19" "-fmessage-length" "110"
"-fsanitize=dataflow"
"-fsanitize-blacklist=$(LLVM_DIR)/build/bin/../lib/clang/3.9.0/dfsan_abilist.txt"
"-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics"
"-vectorize-loops" "-vectorize-slp" "-x" "c" "net-a4fdf1.c"</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>