codes-org / codes

The Co-Design of Exascale Storage Architectures (CODES) simulation framework builds upon the ROSS parallel discrete event simulation engine to provide high-performance simulation utilities and models for building scalable distributed systems simulations
Other
40 stars 16 forks source link

Tiny fix that shows up only when running an experiment with the `-O3` compilation flag #238

Open helq opened 5 months ago

helq commented 5 months ago

This tiny fix should be merged into "master". It does not alter the behavior of CODES. It is a fix to a bug that appeared.

The bug in question is:

Improper use of variable declaration inside a scope provokes segfault on optimized code -O3

A variable was declared and defined under a scope that was disregarded. Later on, outside of the scope a reference to the variable was used again causing a segfault.

This expression was never executed (optimized out):

oc_params.nprocs = num_traces_of_job[lid.job];

because oc_params.nprocs was never used within the scope of oc_params.

Later on, a pointer to oc_params tries to access nprocs but this contains only garbage, and this triggers a segfault down the line.