Message ID | 1440162341-26343-1-git-send-email-lgustavo@codesourcery.com |
---|---|
State | New |
Headers | show |
On 08/21/2015 02:05 PM, Luis Machado wrote: > The attached patch implements this by adding the new global variable z, set > to 0, that gets added in different ways to marker and inlined_fn. Since it > is 0, it doesn't affect any possible value checks that we may wish to do > in the future (we currently only check for values changed by bar). > > Ok? > OK, though you should probably make z volatile as well. Otherwise, soon enough, gcc with LTO sees that z is always 0: > +int z = 0; and then these compile down to the same again, and get folded: > + x += y - z; > + x += y + z; Thanks, Pedro Alves
diff --git a/gdb/testsuite/gdb.opt/inline-bt.c b/gdb/testsuite/gdb.opt/inline-bt.c index dc2bd45..baa6fd4 100644 --- a/gdb/testsuite/gdb.opt/inline-bt.c +++ b/gdb/testsuite/gdb.opt/inline-bt.c @@ -23,6 +23,7 @@ #endif int x, y; +int z = 0; volatile int result; void bar(void); diff --git a/gdb/testsuite/gdb.opt/inline-cmds.c b/gdb/testsuite/gdb.opt/inline-cmds.c index 9955720..2569289 100644 --- a/gdb/testsuite/gdb.opt/inline-cmds.c +++ b/gdb/testsuite/gdb.opt/inline-cmds.c @@ -23,6 +23,7 @@ #endif int x, y; +int z = 0; volatile int result; void bar(void); diff --git a/gdb/testsuite/gdb.opt/inline-locals.c b/gdb/testsuite/gdb.opt/inline-locals.c index fc018bf..143f7ff 100644 --- a/gdb/testsuite/gdb.opt/inline-locals.c +++ b/gdb/testsuite/gdb.opt/inline-locals.c @@ -23,6 +23,7 @@ #endif int x, y; +int z = 0; volatile int result; volatile int *array_p; diff --git a/gdb/testsuite/gdb.opt/inline-markers.c b/gdb/testsuite/gdb.opt/inline-markers.c index 46c68ae..5d55033 100644 --- a/gdb/testsuite/gdb.opt/inline-markers.c +++ b/gdb/testsuite/gdb.opt/inline-markers.c @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -extern int x, y; +extern int x, y, z; void bar(void) { @@ -22,12 +22,12 @@ void bar(void) void marker(void) { - x += y; /* set breakpoint 2 here */ + x += y - z; /* set breakpoint 2 here */ } inline void inlined_fn(void) { - x += y; + x += y + z; } void noinline(void)