[all-commits] [llvm/llvm-project] 3db678: Check result of emitStrLen before passing it to Cr...
Dimitry Andric via All-commits
all-commits at lists.llvm.org
Wed Nov 13 23:04:59 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 3db6783d8a7da05a5949bb18e6c8809306c9d0de
https://github.com/llvm/llvm-project/commit/3db6783d8a7da05a5949bb18e6c8809306c9d0de
Author: Dimitry Andric <dimitry at andric.com>
Date: 2019-11-14 (Thu, 14 Nov 2019)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
A llvm/test/Transforms/InstCombine/pr43081.ll
Log Message:
-----------
Check result of emitStrLen before passing it to CreateGEP
Summary:
This fixes PR43081, where the transformation of `strchr(p, 0) -> p +
strlen(p)` can cause a segfault, if `-fno-builtin-strlen` is used. In
that case, `emitStrLen` returns nullptr, which CreateGEP is not designed
to handle. Also add the minimized code from the PR as a test case.
Reviewers: xbolva00, spatel, jdoerfert, efriedma
Reviewed By: efriedma
Subscribers: lebedev.ri, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D70143
More information about the All-commits
mailing list