From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23223 invoked by alias); 21 Nov 2007 13:06:26 -0000 Received: (qmail 23131 invoked by uid 48); 21 Nov 2007 13:06:06 -0000 Date: Wed, 21 Nov 2007 13:06:00 -0000 Message-ID: <20071121130606.23130.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/34161] -Os produces 32-bit load from 16-bit variable In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg01979.txt.bz2 ------- 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