pythontutor-dev / pythontutor

10 stars 4 forks source link

local struct variable duplicated when one is uninitialized #24

Open pgbovine opened 4 years ago

pgbovine commented 4 years ago

Minimized version of this bug report: https://github.com/pgbovine/OnlinePythonTutor/issues/287

See below: http://pythontutor.com/visualize.html#code=//%20minimized%20version%20of%3A%0A//%20https%3A//github.com/pgbovine/OnlinePythonTutor/issues/287%0Astruct%20person_name%7B%0A%20%20int%20first%3B%0A%7D%3B%0A%0Aint%20main%28%29%20%7B%0A%20%20struct%20person_name%20student1,%20student2%3B%20%20%0A%20%20%0A%20%20student1.first%20%3D%2042%3B%0A%20%20//%20both%20student1.first%20and%20student2.first%20are%20set%20to%2042%0A%20%20//%20%28*maybe*%20student2%20has%20been%20OPTIMIZED%20OUT%20by%20the%20compiler%0A%20%20//%20since%20it's%20uninitialied%20and%20never%20used%3F!%3F%29%0A%20%20%0A%20%20//%20if%20you%20uncomment%20the%20line%20below,%20then%20things%20work%20fine!%0A%20%20//student2.first%20%3D%2012345%3B%0A%20%20return%200%3B%0A%7D&cumulative=false&heapPrimitives=nevernest&mode=edit&origin=opt-frontend.js&py=c&rawInputLstJSON=%5B%5D&textReferences=false