Various 32-bit targets show failures in gcc.dg/analyzer/data-model-1.c with tests of the form: __analyzer_eval (q[-2].x == 107024); /* { dg-warning "TRUE" } */ __analyzer_eval (q[-2].y == 107025); /* { dg-warning "TRUE" } */ where they emit UNKNOWN instead. The root cause is that gimple has a byte-based twos-complement offset of -16 expressed like this: _55 = q_92 + 4294967280; (32-bit) or: _55 = q_92 + 18446744073709551600; (64-bit) Within region_model::convert_byte_offset_to_array_index that unsigned offset was being divided by the element size to get an offset within an array. This happened to work on 64-bit target and host, but not elsewhere; the offset needs to be converted to a signed type before the division is meaningful. This patch does so, fixing the failures. gcc/analyzer/ChangeLog: PR analyzer/93281 * region-model.cc (region_model::convert_byte_offset_to_array_index): Convert to ssizetype before dividing by byte_size. Use fold_binary rather than fold_build2 to avoid needlessly constructing a tree for the non-const case.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
ChangeLog | Loading commit data... | |
analysis-plan.cc | Loading commit data... | |
analysis-plan.h | Loading commit data... | |
analyzer-logging.cc | Loading commit data... | |
analyzer-logging.h | Loading commit data... | |
analyzer-pass.cc | Loading commit data... | |
analyzer-selftests.cc | Loading commit data... | |
analyzer-selftests.h | Loading commit data... | |
analyzer.cc | Loading commit data... | |
analyzer.h | Loading commit data... | |
analyzer.opt | Loading commit data... | |
call-string.cc | Loading commit data... | |
call-string.h | Loading commit data... | |
checker-path.cc | Loading commit data... | |
checker-path.h | Loading commit data... | |
constraint-manager.cc | Loading commit data... | |
constraint-manager.h | Loading commit data... | |
diagnostic-manager.cc | Loading commit data... | |
diagnostic-manager.h | Loading commit data... | |
engine.cc | Loading commit data... | |
engine.h | Loading commit data... | |
exploded-graph.h | Loading commit data... | |
function-set.cc | Loading commit data... | |
function-set.h | Loading commit data... | |
pending-diagnostic.cc | Loading commit data... | |
pending-diagnostic.h | Loading commit data... | |
program-point.cc | Loading commit data... | |
program-point.h | Loading commit data... | |
program-state.cc | Loading commit data... | |
program-state.h | Loading commit data... | |
region-model.cc | Loading commit data... | |
region-model.h | Loading commit data... | |
sm-file.cc | Loading commit data... | |
sm-malloc.cc | Loading commit data... | |
sm-malloc.dot | Loading commit data... | |
sm-pattern-test.cc | Loading commit data... | |
sm-sensitive.cc | Loading commit data... | |
sm-signal.cc | Loading commit data... | |
sm-taint.cc | Loading commit data... | |
sm.cc | Loading commit data... | |
sm.h | Loading commit data... | |
state-purge.cc | Loading commit data... | |
state-purge.h | Loading commit data... | |
supergraph.cc | Loading commit data... | |
supergraph.h | Loading commit data... |