wfjm / w11

PDP-11/70 CPU core and SoC
https://wfjm.github.io/home/w11/
GNU General Public License v3.0
119 stars 18 forks source link

tcl getters accessing a const reference crash with a SIGSEGV #19

Closed wfjm closed 5 years ago

wfjm commented 5 years ago

tcl commands like

  cpu0 get type
  cpu0rka get class
  rlc get timeout

crash with a SIGSEGV. Apparently all getters which internally return a const reference are affected. Observed with gcc 5.4.0. Unclear whether this is a coding bug introduced when boost::bind was replaced by lambdas (in commit 1620ee3) or a compiler issue.

wfjm commented 5 years ago

The culprit was that automatic return type determination for the getter lambdas was used. This fails when the called method returns a reference of an object. The deduced lambda return type will the object, not a reference. Unfortunately this doesn't lead to a compile time error but to a run time error.

Bottom lime is

Fixed with commit 6024dce.