GSA evaluates `((0)+1)==((b[0][0][1])+1)` to be FALSE with the fact that `0 == b[0][0][1]`
Closed this issue · 3 comments
Geoffrey1014 commented
date: 2023-1-10
commit:
args: --analyze -Xclang -analyzer-stats -Xclang -analyzer-checker=core,debug.ExprInspection
test:
#include <stdbool.h>
void clang_analyzer_eval();
#include "csmith.h"
void a() {
int32_t *b[2][2][2] = {};
if (0 == b[0][0][1]) {
clang_analyzer_eval((0 == b[0][0][1])==true);
clang_analyzer_eval(((0)!=(b[0][0][1]))==false);
clang_analyzer_eval(((0)+0)==((b[0][0][1])+0));
clang_analyzer_eval(((0)+0)<((b[0][0][1])+1));
clang_analyzer_eval(((0)+1)==((b[0][0][1])+1));
clang_analyzer_eval(((0)+0)<((b[0][0][1])+2));
clang_analyzer_eval(((0)+1)<((b[0][0][1])+2));
clang_analyzer_eval(((0)+2)==((b[0][0][1])+2));
clang_analyzer_eval(((0)-0)==((b[0][0][1])-0));
clang_analyzer_eval(true);
}
}
report:
fix:
original:
Geoffrey1014 commented
CSA:https://godbolt.org/z/5c9dWE9n1
GSA:https://godbolt.org/z/WqhKa5Mrs does a better job
Deleted user commented
See it live: https://godbolt.org/z/9YoMePYEK.
Geoffrey1014 commented
duplicate of #30