Re: C PATCH for -Wshift-negative-value (PR c/66066)

2015-05-11 Thread Joseph Myers
On Mon, 11 May 2015, Marek Polacek wrote: > The problem here isn't in the -Wshift-negative-value warning itself; the > problem is with marking -1 << 0 as a non-constant: later on, we warn in > a context where a constant expression is needed ("initializer element is > not a constant expression"), a

Re: C PATCH for -Wshift-negative-value (PR c/66066)

2015-05-11 Thread Jeff Law
On 05/11/2015 12:14 PM, Manuel López-Ibáñez wrote: On 11 May 2015 at 17:54, Marek Polacek wrote: I'm sorry to sound so "pedantic" but we have faced this same issue in the past (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19976#c7) and the solution was to delay folding (https://gcc.gnu.org/ml/g

Re: C PATCH for -Wshift-negative-value (PR c/66066)

2015-05-11 Thread Manuel López-Ibáñez
On 11 May 2015 at 17:54, Marek Polacek wrote: > The problem here isn't in the -Wshift-negative-value warning itself; the > problem is with marking -1 << 0 as a non-constant: later on, we warn in > a context where a constant expression is needed ("initializer element is > not a constant expression"

Re: C PATCH for -Wshift-negative-value (PR c/66066)

2015-05-11 Thread Markus Trippelsdorf
On 2015.05.11 at 17:54 +0200, Marek Polacek wrote: > On Mon, May 11, 2015 at 05:09:26PM +0200, Manuel López-Ibáñez wrote: > > On 11/05/15 16:21, Marek Polacek wrote: > > >The -Wshift-negative-value patch caused grief since it breaks building > > >some programs. The following patch should alleviate

Re: C PATCH for -Wshift-negative-value (PR c/66066)

2015-05-11 Thread Marek Polacek
On Mon, May 11, 2015 at 05:09:26PM +0200, Manuel López-Ibáñez wrote: > On 11/05/15 16:21, Marek Polacek wrote: > >The -Wshift-negative-value patch caused grief since it breaks building > >some programs. The following patch should alleviate the pain a bit: mark > >a left shift of a negative value a

Re: C PATCH for -Wshift-negative-value (PR c/66066)

2015-05-11 Thread Manuel López-Ibáñez
On 11/05/15 16:21, Marek Polacek wrote: The -Wshift-negative-value patch caused grief since it breaks building some programs. The following patch should alleviate the pain a bit: mark a left shift of a negative value as non-const only if pedantic. Either this is not correct according to the gu

C PATCH for -Wshift-negative-value (PR c/66066)

2015-05-11 Thread Marek Polacek
The -Wshift-negative-value patch caused grief since it breaks building some programs. The following patch should alleviate the pain a bit: mark a left shift of a negative value as non-const only if pedantic. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-05-11 Marek Polacek