This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [C PATCH] Fix C pointer_diff with volatile args (PR c/86093)


On Fri, 15 Jun 2018, Jakub Jelinek wrote:

> Hi!
> 
> The match.pd framework uses op0 == op1 || operand_equal_p (op0, op1, 0)
> style comparisons heavily; the reason why we don't optimize away say
> volatile int i;
> ...
>   int j = i - i;
> into int j = (i, 0);
> is only because both the C and C++ FE convert the volatile arguments to
> non-volatile ones before the arithmetic operation (e.g. c_common_type
> returns a non-qualified type).  Unfortunately, in C FE this doesn't happen
> for POINTER_DIFF_EXPR, where no conversion happens.  The following patch
> makes sure we convert the pointer arguments to some non-qualified pointers
> first.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/8.2?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com


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