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: [Patch] tree-parloops.c (eliminate_local_variables): Add braces to suppress warnings


On 04/13/2012 04:44 PM, Jakub Jelinek wrote:
> On Fri, Apr 13, 2012 at 04:33:17PM +0200, Bernd Schmidt wrote:
>> On 04/13/2012 04:20 PM, Mike Stump wrote:
>>> On Apr 13, 2012, at 5:30 AM, NightStrike wrote:
>>>>> no warning from trunk.  Which GCC version emits this warning?
>>>
>>>> Looks like cygwin gcc 3.4.4
>>>
>>> 3.4.4 is a little old now..  We'd encourage an upgrade to a fine new compiler...  :-)
>>
>> The thing is, the else really is ambiguous, so it looks like we have a
>> warning regression.
> 
> To the compiler?  There is for in between, no need to put extra braces IMHO.
> I believe it has been intentionally fixed for 4.0, but my bisect tree only
> goes back to r90000.

Well, to the compiler even
if ()
  if ()
    x
  else
    y

has an unambiguous meaning. The problem is that a human might be
confused, for example due to bad indentation. Whether there's a for in
between doesn't matter for this purpose, the following is most likely a bug:

if ()
  for (..)
    if ()
      x
else
  y


Bernd


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