------- Comment #3 from manu at gcc dot gnu dot org  2007-11-21 13:06 -------
(In reply to comment #2)
> 
> And this doesn't really make that much sense unless you know what's going on.
> I'd say that following the principle of least surprise, this optimization is
> unfortunate at the very least.

Users would be surprised if optimized programs perform suboptimal operations
when better code is possible. Please, take into account that.

Now, what is unfortunate is that the hardware watchpoint triggers there.
Perhaps the debug information could tell GDB to ignore the read, or perhaps GDB
could figure it out by itself since the data read is never used. I personally
don't see a satisfactory way to solve all the issues here. And this bug report
is not the proper place. If you think there is a way to satisfy all issues, you
can discuss your proposal with the GDB hackers (http://sourceware.org/ml/gdb/).
Nonetheless, it seems to me that if a read occurs and the user sets a read
watchpoint, then the user should be informed of it. As Richard said, if you
don't want the read to occur at all, you can use "packed".

Also, you must take into account that debugging when optimisation is enabled is
always going to be problematic. We aim to produce the most accurate debug
information possible in that case, but disabling optimizations would be a
contradiction since you could always debug with optimisations disabled if you
wish.

I hope this answer satisfies you.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34161

Reply via email to