This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Haifa scheduler access uninitialized memory


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]