Haifa scheduler access uninitialized memory
David Capshaw
capshaw@metrowerks.com
Tue May 1 14:11:00 GMT 2001
This report relates to
gcc version 2.95.3 20010315 (release)
My testing was on a Solaris/SPARC 2.5.1 system.
The Haifa scheduler (haifa-sched.c) can access uninitialized
memory resulting in nonderministic intermediate trees. (My
test cases did not lead to different output code.)
This is the scenario I observed in a test case.
During the sched pass, the scheduler logs on instruction 17 its
dependence on instruction 5.
The subsequent cse pass deletes instruction 5 (but leaves the log
record on instruction 17.)
In the sched2 pass, the insn_orig_block array is initialized
based on instructions that are present (e.g. 17) but the code
accesses the array also for log records (e.g. 5) and these
entries have not been initialized fro deleted instructions.
(see schedule_insn)
My workaround to ensure determinism is to zero the entire
insn_orig_block array when created. (see schedule_insn)
Perhaps there is a way to remove log records when instructions
are deleted in cse to prevent the scheduler from attempting to
reference them.
More information about the Gcc-bugs
mailing list