Slight correction : it is not a mangling of variable that is a problem (local variables don't have any mangling) but mangling of the function itself (it naively uses variable name for mangled name generation). Should use something like unique id instead.