don't assume that the argument passed to fprintf("%s" is a string. This
authorChris Lattner <sabre@nondot.org>
Mon, 21 Apr 2008 03:18:33 +0000 (03:18 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Apr 2008 03:18:33 +0000 (03:18 +0000)
fixes a crash in opt on 433.milc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50023 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/SimplifyLibCalls.cpp

index 6e4ac5ae4aee25f8e7ab612a4daab4ff6cf09fe9..10393bc3c6d9c901a0b02ed53448b7f00a49471b 100644 (file)
@@ -1390,7 +1390,7 @@ public:
       
       // If the result of the fprintf call is used, we can't do this.
       // TODO: we should insert a strlen call.
-      if (!CI->use_empty())
+      if (!CI->use_empty() || !isa<PointerType>(CI->getOperand(3)->getType()))
         return false;
       
       // fprintf(file,"%s",str) -> fputs(str,file)