<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54784>54784</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Safe Stack instrumentation pass failed with an assertion in ScalarEvolution
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          gulfemsavrun
      </td>
    </tr>
</table>

<pre>
    Here's the reproducer, and I attached `vfprintf-258ca6.c`.
`
"../../../../llvm-install-single-stage/bin/clang" "-cc1" "-triple" "x86_64-unknown-fuchsia" "-emit-obj" "-massembler-fatal-warnings" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "vfprintf.c" "-mrelocation-model" "pic" "-pic-level" "2" "-fhalf-no-semantic-interposition" "-mframe-pointer=all" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64-v2" "-mllvm" "-x86-branches-within-32B-boundaries" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debug-info-kind=constructor" "-dwarf-version=5" "-debugger-tuning=gdb" "-mllvm" "-crash-diagnostics-dir=clang-crashreports" "-ffunction-sections" "-fdata-sections" "-fprofile-instrument=clang" "-fcoverage-mapping" "-fcoverage-compilation-dir=." "-sys-header-deps" "-D" "WITH_FRAME_POINTERS=1" "-D" "_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1" "-D" "ZX_ASSERT_LEVEL=2" "-D" "_ALL_SOURCE" "-D" "_XOPEN_SOURCE=700" "-O2" "-Wall" "-Wextra" "-Wconversion" "-Wextra-semi" "-Wimplicit-fallthrough" "-Wnewline-eof" "-Wstrict-prototypes" "-Wwrite-strings" "-Wno-sign-conversion" "-Wno-unused-parameter" "-Wnonportable-system-include-path" "-Wthread-safety" "-Werror" "-Wno-error=deprecated-declarations" "-Wno-conversion" "-Wno-sign-compare" "-Wno-implicit-fallthrough" "-Werror=incompatible-pointer-types" "-std=c11" "-fconst-strings" "-fdebug-compilation-dir=." "-ferror-limit" "19" "-fsanitize=safe-stack"  "-ftrivial-auto-var-init=pattern" "-fgnuc-version=4.2.1" "-fsized-deallocation" "-fcolor-diagnostics" "-vectorize-loops" "-vectorize-slp" "-debug-info-kind=constructor" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c" "vfprintf-258ca6.c"
`

It runs into the following assertion failure while running Safe Stack instrumentation pass
`
clang: llvm/lib/Analysis/ScalarEvolution.cpp:3770: const llvm::SCEV *llvm::ScalarEvolution::getMinMaxExpr(llvm::SCEVTypes, SmallVectorImpl<const llvm::SCEV *> &): Assertion `Ops[0]->getType()->isPointerTy() == Ops[i]->getType()->isPointerTy() && "min/max should be consistently pointerish"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ../../../../llvm-install-single-stage/bin/clang -cc1 -triple x86_64-unknown-fuchsia -emit-obj -massembler-fatal-warnings --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name vfprintf.c -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64-v2 -mllvm -x86-branches-within-32B-boundaries -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -mllvm -crash-diagnostics-dir=clang-crashreports -ffunction-sections -fdata-sections -fprofile-instrument=clang -fcoverage-mapping -fcoverage-compilation-dir=. -sys-header-deps -D WITH_FRAME_POINTERS=1 -D _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D ZX_ASSERT_LEVEL=2 -D _ALL_SOURCE -D _XOPEN_SOURCE=700 -O2 -Wall -Wextra -Wconversion -Wextra-semi -Wimplicit-fallthrough -Wnewline-eof -Wstrict-prototypes -Wwrite-strings -Wno-sign-conversion -Wno-unused-parameter -Wnonportable-system-include-path -Wthread-safety -Werror -Wno-error=deprecated-declarations -Wno-conversion -Wno-sign-compare -Wno-implicit-fallthrough -Werror=incompatible-pointer-types -std=c11 -fconst-strings -fdebug-compilation-dir=. -ferror-limit 19 -fsanitize=safe-stack -ftrivial-auto-var-init=pattern -fgnuc-version=4.2.1 -fsized-deallocation -fcolor-diagnostics -vectorize-loops -vectorize-slp -debug-info-kind=constructor -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c vfprintf-258ca6.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'vfprintf-258ca6.c'.
4.      Running pass 'Safe Stack instrumentation pass' on function '@fmt_fp'
[safe-stack-instrumentation-pass-assertion-error.zip](https://github.com/llvm/llvm-project/files/8430584/safe-stack-instrumentation-pass-assertion-error.zip)

#0 0x000000000368bc1d (../../../../llvm-install-single-stage/bin/clang+0x368bc1d)
Aborted
`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylmNly47gOhp_GuUHRJUvxkgtfOF5OpypbxT6dOefGRUuUzWlZUpGU48zTz09t3pSlZ1KOWyJBAAQB8OuskuB9-EMo0XL7msxGkBKpSoLMF6rljonHAd0RN4b7GxFQq-fswlTJ2ITM7Q583mv7GGu3nEnLGeGpfHDddrvlzs6-omi3ZTLWhkcR0zJeR4LhZQ3js5WM8e1HPF5jNeGX-X6nejRKppEo3_aD3rJ3zbL4V5y8xSzM_I2WvBIVW2lYsvqzet9yrcV2FQnFQg7L7I2rGLZ1JcC2SkR8z_Cd-NzIJK6nAqk5VrJQCVF7FQmuGNeGrUSYKMFW3P8l4uBgT8IniVUx31arqqAhWpXYwRzbJoGIyolU1iJ4ZJHY1VNuNRFueBSyOGHYGI8NxKBbqDTR0uqrTYQKHrA0yWdb3gRhr1WEKfOT2CjuG8w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