http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47590
Alexandre Oliva <aoliva at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|aoliva at gcc dot gnu.org |unassigned at gcc dot | |gnu.org Summary|var tracking produces wrong |pragma optimize doesn't |debug in code where |recompute derived options |optimization is turned off |(was: var tracking produces |using pragma |wrong debug in code where | |optimization is turned off | |using pragma) --- Comment #9 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-03-25 11:22:19 UTC --- Sorry, closing e bug was a mistake. The only thing I fixed was the ability to override -fvar-tracking with #pragma optimize, so that the change is taken into acount on all targets. We don't seem to have infrastructure to recompute flags whose defaults are implied from others after #pragma optimize, and I haven't even tried to implement that. I just made sure that, if that is ever implemented, the recomputed values will be used on all targets. Meanwhile, add “, "-fno-var-tracking", "-fno-var-tracking-assignments"” to the #pragma line, and you'll get the intended behavior. Incidentally, the inability to recompute implied flags, check inconsistencies, etc, requires both options to be provided, and if any function compiled with VTA enabled is inlined into one with these overriders, gcc will crash because the VTA note will survive all the way to final. There is code that forces flag_var_tracking into a special clean-up mode when VTA is enabled when var-tracking isn't, but that code doesn't get a chance to run after #pragma optimize. I'm unassigning this bug, in the hope that someone can take over from here.