S
Steve McLellan
Hi,
Sorry for the long post, it's a bit epic (and sums up the last 10 hours of
my life, apart from my car's gearbox melting).
We've got a mixed C++ assembly that's exhibiting odd behaviour when the
/OPT:REF (remove unreferenced data) linker option is set. We first noticed
the problem after removing the /DEBUG option (which silently alters the
defaults for the /OPT option) and assumed that was the cause for a few hours
until I read the documentation (ahem).
Having done some more checks, it definitely appears /OPT:REF is the cause
(eliminating COMDATs has does not cause the strange behaviour). The
application crashes with an access violation that's always in the same place
for a particular codebase, but changing something (like changing a
function's argument from taking a const reference to taking a copy) alters
the location of the crash slightly.
The only symptom we have is a boost::shared_ptr which appears not to be
valid in a piece of code that executes perfectly without /OPT:REF and falls
over with it. However, the debugger is behaving less than reliably in the
area of the crash even when /OPT:REF is not set, so I'm not sure that the
shared_ptr is damaged at all.
So, to recap:
/OPT:REF causes the program to exhibit the symptoms (although we've no way
to check if this is a problem with /OPT:REF, or simply a knock on effect of
this linker flag). We don't know what's causing it, and the only suspicious
thing we can find is what happens in the function outlined above.
Has anyone had any experience with problems like this? And does anyone have
any clues as to where we should go? We're loath just to turn off /OPT:REF
since I think it's going to pop up and bite us at some point. I will have a
crack at getting a repro case but I may not succeed.
TIA, and again, sorry for the length of the post,
Steve
Sorry for the long post, it's a bit epic (and sums up the last 10 hours of
my life, apart from my car's gearbox melting).
We've got a mixed C++ assembly that's exhibiting odd behaviour when the
/OPT:REF (remove unreferenced data) linker option is set. We first noticed
the problem after removing the /DEBUG option (which silently alters the
defaults for the /OPT option) and assumed that was the cause for a few hours
until I read the documentation (ahem).
Having done some more checks, it definitely appears /OPT:REF is the cause
(eliminating COMDATs has does not cause the strange behaviour). The
application crashes with an access violation that's always in the same place
for a particular codebase, but changing something (like changing a
function's argument from taking a const reference to taking a copy) alters
the location of the crash slightly.
The only symptom we have is a boost::shared_ptr which appears not to be
valid in a piece of code that executes perfectly without /OPT:REF and falls
over with it. However, the debugger is behaving less than reliably in the
area of the crash even when /OPT:REF is not set, so I'm not sure that the
shared_ptr is damaged at all.
So, to recap:
/OPT:REF causes the program to exhibit the symptoms (although we've no way
to check if this is a problem with /OPT:REF, or simply a knock on effect of
this linker flag). We don't know what's causing it, and the only suspicious
thing we can find is what happens in the function outlined above.
Has anyone had any experience with problems like this? And does anyone have
any clues as to where we should go? We're loath just to turn off /OPT:REF
since I think it's going to pop up and bite us at some point. I will have a
crack at getting a repro case but I may not succeed.
TIA, and again, sorry for the length of the post,
Steve