This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Prevent GCC from folding inline test functions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]