Open Quuxplusone opened 16 years ago
This FP manifests because we are not (yet) tracking constraints between
symbolic pointer values. This FP can be suppressed simply by recording a !=
relationship between s1 and end1 (and s2 and end2) because of s1 < end1.
More generally, after the call to strlen(s1), we should have the constraints:
s1 + strlen(s1) < MAX_POINTER_VALUE
strlen(s1) >= 0
This is because we cannot have an integer overflow here because strlen would
segfault. This means that end1 >= s1 (but it would not be possible that end1 <
s1).
instcombine does this transform, which seems legal to me:
IC: ConstFold to: i8 undef from: %tmp194 = trunc i64 undef to i8
; <i8> [#uses=1]
IC: ConstFold to: i1 undef from: %toBool17 = icmp eq i8 undef, 0
; <i1> [#uses=1]
I guess it is not an instcombine bug, but instcombine exposes a bug introduced
by an earlier transform.
Attached func2.bc
(49368 bytes, application/octet-stream): original function as compiled by -O4
Attached func.bc
(49332 bytes, application/octet-stream): as func2.bc, but after running some optimizations on it by bugpoint
(In reply to comment #4)
> instcombine does this transform, which seems legal to me:
> IC: ConstFold to: i8 undef from: %tmp194 = trunc i64 undef to i8
> ; <i8> [#uses=1]
> IC: ConstFold to: i1 undef from: %toBool17 = icmp eq i8 undef, 0
> ; <i1> [#uses=1]
>
> I guess it is not an instcombine bug, but instcombine exposes a bug introduced
> by an earlier transform.
>
Sorry, these were meant for PR4313.
that's still in a issue. ccc-analyzer has moved to clang/tools/scan-build/libexec/ccc-analyzer
func2.bc
(49368 bytes, application/octet-stream)func.bc
(49332 bytes, application/octet-stream)