public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* lambda-switch regression
@ 2017-11-15 13:08 Nathan Sidwell
  2017-11-15 17:10 ` David Malcolm
  2017-11-15 17:38 ` Martin Sebor
  0 siblings, 2 replies; 6+ messages in thread
From: Nathan Sidwell @ 2017-11-15 13:08 UTC (permalink / raw)
  To: GCC Patches; +Cc: David Malcolm

g++.dg/lambda/lambda-switch.C Has recently regressed.  It appears the 
location of a warning message has moved.

	  l = []()		// { dg-warning "statement will never be executed" }
	    {
	    case 3:		// { dg-error "case" }
	      break;		// { dg-error "break" }
	    };  <--- warning now here

We seem to be diagnosing the last line of the statement, not the first. 
That seems not a useful.

I've not investigated what patch may have caused this, on the chance 
someone might already know?

nathan
-- 
Nathan Sidwell

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lambda-switch regression
  2017-11-15 13:08 lambda-switch regression Nathan Sidwell
@ 2017-11-15 17:10 ` David Malcolm
  2017-11-15 17:38   ` David Malcolm
  2017-11-15 17:38 ` Martin Sebor
  1 sibling, 1 reply; 6+ messages in thread
From: David Malcolm @ 2017-11-15 17:10 UTC (permalink / raw)
  To: Nathan Sidwell, GCC Patches, polacek

On Wed, 2017-11-15 at 08:03 -0500, Nathan Sidwell wrote:
> g++.dg/lambda/lambda-switch.C Has recently regressed.  

g++.dg/cpp0x/lambda/lambda-switch.C

> It appears the 
> location of a warning message has moved.
> 
> 	  l = []()		// { dg-warning "statement will never
> be executed" }
> 	    {
> 	    case 3:		// { dg-error "case" }
> 	      break;		// { dg-error "break" }
> 	    };  <--- warning now here
> 
> We seem to be diagnosing the last line of the statement, not the
> first. 
> That seems not a useful.
> 
> I've not investigated what patch may have caused this, on the chance 
> someone might already know?
> 
> nathan

The warning was added in r236597 (aka
1398da0f786e120bb0b407e84f412aa9fc6d80ee):

+2016-05-23  Marek Polacek  <polacek@redhat.com>
+
+       PR c/49859
+       * common.opt (Wswitch-unreachable): New option.
+       * doc/invoke.texi: Document -Wswitch-unreachable.
+       * gimplify.c (gimplify_switch_expr): Implement the -Wswitch-unreachable
+       warning.

which had it at there (23:7).

r244705 (aka 3ef7eab185e1463c7dbfa2a8d1af5d0120cf9f76) moved the
warning from 23:7 up to the "[] ()" at 19:6 in:

+2017-01-20  Marek Polacek  <polacek@redhat.com>
+
+       PR c/64279
[...snip...]
+       * g++.dg/cpp0x/lambda/lambda-switch.C: Move dg-warning.

I tried it with some working copies I have to hand:
- works for me with r254387 (2017-11-03)
- fails for me with r254700 (2017-11-13)

so hopefully that helps track it down.

Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lambda-switch regression
  2017-11-15 13:08 lambda-switch regression Nathan Sidwell
  2017-11-15 17:10 ` David Malcolm
@ 2017-11-15 17:38 ` Martin Sebor
  1 sibling, 0 replies; 6+ messages in thread
From: Martin Sebor @ 2017-11-15 17:38 UTC (permalink / raw)
  To: Nathan Sidwell, GCC Patches; +Cc: David Malcolm

On 11/15/2017 06:03 AM, Nathan Sidwell wrote:
> g++.dg/lambda/lambda-switch.C Has recently regressed.  It appears the
> location of a warning message has moved.
>
>       l = []()        // { dg-warning "statement will never be executed" }
>         {
>         case 3:        // { dg-error "case" }
>           break;        // { dg-error "break" }
>         };  <--- warning now here
>
> We seem to be diagnosing the last line of the statement, not the first.
> That seems not a useful.
>
> I've not investigated what patch may have caused this, on the chance
> someone might already know?

Bug 82988 points to my r254630 as the commit that triggered it.
I haven't yet looked into it.  There some small chance that it
was caused by bug 82977 that Jakub just fixed.

Martin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lambda-switch regression
  2017-11-15 17:10 ` David Malcolm
@ 2017-11-15 17:38   ` David Malcolm
  2017-11-15 17:51     ` David Malcolm
  0 siblings, 1 reply; 6+ messages in thread
From: David Malcolm @ 2017-11-15 17:38 UTC (permalink / raw)
  To: Nathan Sidwell, GCC Patches, polacek

On Wed, 2017-11-15 at 12:06 -0500, David Malcolm wrote:
> On Wed, 2017-11-15 at 08:03 -0500, Nathan Sidwell wrote:
> > g++.dg/lambda/lambda-switch.C Has recently regressed.  
> 
> g++.dg/cpp0x/lambda/lambda-switch.C
> 
> > It appears the 
> > location of a warning message has moved.
> > 
> > 	  l = []()		// { dg-warning "statement will never
> > be executed" }
> > 	    {
> > 	    case 3:		// { dg-error "case" }
> > 	      break;		// { dg-error "break" }
> > 	    };  <--- warning now here
> > 
> > We seem to be diagnosing the last line of the statement, not the
> > first. 
> > That seems not a useful.
> > 
> > I've not investigated what patch may have caused this, on the
> > chance 
> > someone might already know?
> > 
> > nathan
> 
> The warning was added in r236597 (aka
> 1398da0f786e120bb0b407e84f412aa9fc6d80ee):
> 
> +2016-05-23  Marek Polacek  <polacek@redhat.com>
> +
> +       PR c/49859
> +       * common.opt (Wswitch-unreachable): New option.
> +       * doc/invoke.texi: Document -Wswitch-unreachable.
> +       * gimplify.c (gimplify_switch_expr): Implement the -Wswitch-
> unreachable
> +       warning.
> 
> which had it at there (23:7).
> 
> r244705 (aka 3ef7eab185e1463c7dbfa2a8d1af5d0120cf9f76) moved the
> warning from 23:7 up to the "[] ()" at 19:6 in:
> 
> +2017-01-20  Marek Polacek  <polacek@redhat.com>
> +
> +       PR c/64279
> [...snip...]
> +       * g++.dg/cpp0x/lambda/lambda-switch.C: Move dg-warning.
> 
> I tried it with some working copies I have to hand:
> - works for me with r254387 (2017-11-03)
> - fails for me with r254700 (2017-11-13)
> 
> so hopefully that helps track it down.
> 
> Dave

Searching in the November archives of the gcc-regression ML for
"lambda-switch.c":

https://gcc.gnu.org/cgi-bin/search.cgi?wm=wrd&form=extended&m=all&s=D&q=lambda-switch.c&ul=%2Fml%2Fgcc-regression%2F2017-11%2F%25

showed e.g.:
  https://gcc.gnu.org/ml/gcc-regression/2017-11/msg00173.html
   "Regressions on trunk at revision 254648 vs revision 254623"

which says this is a new failure somewhere in that range; so it
presumably happened sometime on 2017-11-10 after r254623 and up to
(maybe ==) r254648.

Looking at:
   svn log -r r254623:r254648 |less
nothing jumps out at me as being related.

Hope this is helpful
Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lambda-switch regression
  2017-11-15 17:38   ` David Malcolm
@ 2017-11-15 17:51     ` David Malcolm
  2017-11-15 21:31       ` Martin Sebor
  0 siblings, 1 reply; 6+ messages in thread
From: David Malcolm @ 2017-11-15 17:51 UTC (permalink / raw)
  To: Nathan Sidwell, GCC Patches, polacek; +Cc: msebor

On Wed, 2017-11-15 at 12:25 -0500, David Malcolm wrote:
> On Wed, 2017-11-15 at 12:06 -0500, David Malcolm wrote:
> > On Wed, 2017-11-15 at 08:03 -0500, Nathan Sidwell wrote:
> > > g++.dg/lambda/lambda-switch.C Has recently regressed.  
> > 
> > g++.dg/cpp0x/lambda/lambda-switch.C
> > 
> > > It appears the 
> > > location of a warning message has moved.
> > > 
> > > 	  l = []()		// { dg-warning "statement will never
> > > be executed" }
> > > 	    {
> > > 	    case 3:		// { dg-error "case" }
> > > 	      break;		// { dg-error "break" }
> > > 	    };  <--- warning now here
> > > 
> > > We seem to be diagnosing the last line of the statement, not the
> > > first. 
> > > That seems not a useful.
> > > 
> > > I've not investigated what patch may have caused this, on the
> > > chance 
> > > someone might already know?
> > > 
> > > nathan
> > 
> > The warning was added in r236597 (aka
> > 1398da0f786e120bb0b407e84f412aa9fc6d80ee):
> > 
> > +2016-05-23  Marek Polacek  <polacek@redhat.com>
> > +
> > +       PR c/49859
> > +       * common.opt (Wswitch-unreachable): New option.
> > +       * doc/invoke.texi: Document -Wswitch-unreachable.
> > +       * gimplify.c (gimplify_switch_expr): Implement the
> > -Wswitch-
> > unreachable
> > +       warning.
> > 
> > which had it at there (23:7).
> > 
> > r244705 (aka 3ef7eab185e1463c7dbfa2a8d1af5d0120cf9f76) moved the
> > warning from 23:7 up to the "[] ()" at 19:6 in:
> > 
> > +2017-01-20  Marek Polacek  <polacek@redhat.com>
> > +
> > +       PR c/64279
> > [...snip...]
> > +       * g++.dg/cpp0x/lambda/lambda-switch.C: Move dg-warning.
> > 
> > I tried it with some working copies I have to hand:
> > - works for me with r254387 (2017-11-03)
> > - fails for me with r254700 (2017-11-13)
> > 
> > so hopefully that helps track it down.
> > 
> > Dave
> 
> Searching in the November archives of the gcc-regression ML for
> "lambda-switch.c":
> 
> https://gcc.gnu.org/cgi-bin/search.cgi?wm=wrd&form=extended&m=all&s=D
> &q=lambda-switch.c&ul=%2Fml%2Fgcc-regression%2F2017-11%2F%25
> 
> showed e.g.:
>   https://gcc.gnu.org/ml/gcc-regression/2017-11/msg00173.html
>    "Regressions on trunk at revision 254648 vs revision 254623"
> 
> which says this is a new failure somewhere in that range; so it
> presumably happened sometime on 2017-11-10 after r254623 and up to
> (maybe ==) r254648.
> 
> Looking at:
>    svn log -r r254623:r254648 |less
> nothing jumps out at me as being related.
> 
> Hope this is helpful
> Dave

Actually, https://gcc.gnu.org/ml/gcc-regression/2017-11/msg00157.html
has a tighter range: r254628 vs r254635.

Looking at:
  svn log -r r254628:r254635 |less
I see msebor's r254630 ("PR c/81117 - Improve buffer overflow checking
in strncpy") has:

        * gimple.c (gimple_build_call_from_tree): Set call location.

with:
+  gimple_set_location (call, EXPR_LOCATION (t));

Maybe that's it?  (nothing else in that commit range seems to affect
locations).

Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lambda-switch regression
  2017-11-15 17:51     ` David Malcolm
@ 2017-11-15 21:31       ` Martin Sebor
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Sebor @ 2017-11-15 21:31 UTC (permalink / raw)
  To: David Malcolm, Nathan Sidwell, GCC Patches, polacek; +Cc: msebor

On 11/15/2017 10:38 AM, David Malcolm wrote:
> On Wed, 2017-11-15 at 12:25 -0500, David Malcolm wrote:
>> On Wed, 2017-11-15 at 12:06 -0500, David Malcolm wrote:
>>> On Wed, 2017-11-15 at 08:03 -0500, Nathan Sidwell wrote:
>>>> g++.dg/lambda/lambda-switch.C Has recently regressed.
>>>
>>> g++.dg/cpp0x/lambda/lambda-switch.C
>>>
>>>> It appears the
>>>> location of a warning message has moved.
>>>>
>>>> 	  l = []()		// { dg-warning "statement will never
>>>> be executed" }
>>>> 	    {
>>>> 	    case 3:		// { dg-error "case" }
>>>> 	      break;		// { dg-error "break" }
>>>> 	    };  <--- warning now here
>>>>
>>>> We seem to be diagnosing the last line of the statement, not the
>>>> first.
>>>> That seems not a useful.
>>>>
>>>> I've not investigated what patch may have caused this, on the
>>>> chance
>>>> someone might already know?
>>>>
>>>> nathan
>>>
>>> The warning was added in r236597 (aka
>>> 1398da0f786e120bb0b407e84f412aa9fc6d80ee):
>>>
>>> +2016-05-23  Marek Polacek  <polacek@redhat.com>
>>> +
>>> +       PR c/49859
>>> +       * common.opt (Wswitch-unreachable): New option.
>>> +       * doc/invoke.texi: Document -Wswitch-unreachable.
>>> +       * gimplify.c (gimplify_switch_expr): Implement the
>>> -Wswitch-
>>> unreachable
>>> +       warning.
>>>
>>> which had it at there (23:7).
>>>
>>> r244705 (aka 3ef7eab185e1463c7dbfa2a8d1af5d0120cf9f76) moved the
>>> warning from 23:7 up to the "[] ()" at 19:6 in:
>>>
>>> +2017-01-20  Marek Polacek  <polacek@redhat.com>
>>> +
>>> +       PR c/64279
>>> [...snip...]
>>> +       * g++.dg/cpp0x/lambda/lambda-switch.C: Move dg-warning.
>>>
>>> I tried it with some working copies I have to hand:
>>> - works for me with r254387 (2017-11-03)
>>> - fails for me with r254700 (2017-11-13)
>>>
>>> so hopefully that helps track it down.
>>>
>>> Dave
>>
>> Searching in the November archives of the gcc-regression ML for
>> "lambda-switch.c":
>>
>> https://gcc.gnu.org/cgi-bin/search.cgi?wm=wrd&form=extended&m=all&s=D
>> &q=lambda-switch.c&ul=%2Fml%2Fgcc-regression%2F2017-11%2F%25
>>
>> showed e.g.:
>>   https://gcc.gnu.org/ml/gcc-regression/2017-11/msg00173.html
>>    "Regressions on trunk at revision 254648 vs revision 254623"
>>
>> which says this is a new failure somewhere in that range; so it
>> presumably happened sometime on 2017-11-10 after r254623 and up to
>> (maybe ==) r254648.
>>
>> Looking at:
>>    svn log -r r254623:r254648 |less
>> nothing jumps out at me as being related.
>>
>> Hope this is helpful
>> Dave
>
> Actually, https://gcc.gnu.org/ml/gcc-regression/2017-11/msg00157.html
> has a tighter range: r254628 vs r254635.
>
> Looking at:
>   svn log -r r254628:r254635 |less
> I see msebor's r254630 ("PR c/81117 - Improve buffer overflow checking
> in strncpy") has:
>
>         * gimple.c (gimple_build_call_from_tree): Set call location.
>
> with:
> +  gimple_set_location (call, EXPR_LOCATION (t));
>
> Maybe that's it?  (nothing else in that commit range seems to affect
> locations).

Yes, that's it.  Before the change there would be no location
associated with a GIMPLE call seen in gimple-fold.  The location
would only get added later, after folding.

The purpose of the lambda-switch.C test is to verify GCC doesn't
ICE on the ill-formed code.  The warning is incidental to the test
case so I've adjusted it to filter it out.

Martin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-15 20:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15 13:08 lambda-switch regression Nathan Sidwell
2017-11-15 17:10 ` David Malcolm
2017-11-15 17:38   ` David Malcolm
2017-11-15 17:51     ` David Malcolm
2017-11-15 21:31       ` Martin Sebor
2017-11-15 17:38 ` Martin Sebor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).