[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-18 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Jason Merrill  ---
(In reply to Jakub Jelinek from comment #7)
> Maybe.  But how?  Would it push a pair of next_token, input_location ?
> I think it isn't easy to recompute input_location after the rollback
> otherwise.
> And, I'm a little bit worried that such a change could be at this point
> quite dangerous, while the above patch affects one spot that has changed, we
> have lots of rollbacks in various places.

Fair; doing it in saved_token_sentinel seemed like a reasonable compromise.

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:2aa184458a11a7ec8c1b451b8eeff458a24632bb

commit r12-6703-g2aa184458a11a7ec8c1b451b8eeff458a24632bb
Author: Jason Merrill 
Date:   Mon Jan 17 17:16:38 2022 -0500

c++: input_location and lookahead [PR104025]

Debug information was getting confused because input_location was different
depending on whether we had looked ahead to see if the next tokens look
like
a template argument list.

I tried resetting input_location in cp_lexer_rollback_tokens itself, but
that caused regressions, so let's just do it here for now.

PR c++/104025

gcc/cp/ChangeLog:

* parser.cc (saved_token_sentinel::rollback): Call
cp_lexer_set_source_position.
(~saved_token_sentinel): Call rollback.

gcc/testsuite/ChangeLog:

* g++.dg/warn/pr104025.C: New test.

Co-authored-by: Jakub Jelinek  

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

--- Comment #7 from Jakub Jelinek  ---
Maybe.  But how?  Would it push a pair of next_token, input_location ?
I think it isn't easy to recompute input_location after the rollback otherwise.
And, I'm a little bit worried that such a change could be at this point quite
dangerous, while the above patch affects one spot that has changed, we have
lots of rollbacks in various places.

Anyway, patch passed bootstrap/regtest.

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-17 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

--- Comment #6 from Jason Merrill  ---
(In reply to Jakub Jelinek from comment #5)
> Created attachment 52213 [details]
> gcc12-pr104025.patch
> 
> Untested fix.  I think the old input_location is the right one.

I think the bug is that cp_lexer_rollback_tokens isn't properly updating
input_location.

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
Created attachment 52213
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52213=edit
gcc12-pr104025.patch

Untested fix.  I think the old input_location is the right one.

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
Yeah, the reason that -fcompare-debug fails isn't that -g vs. -g0 would emit
different line number, but that -fcompare-debug uses -w for one of the
compilations so that warnings aren't emitted multiple times and so one
compilation is with -Wmissing-template-keyword and one without.

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

--- Comment #3 from Andrew Pinski  ---
Obviously removing "&& warn_missing_template_keyword" will fix the
fcompare-debug but the question is which location is the more correct one?

[Bug c++/104025] [12 Regression] '-fcompare-debug' failure with enabled warnings since r12-6563-gb8ffa71e4271ae56

2022-01-14 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104025

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2022-01-14
 Ever confirmed|0   |1
 CC||anthonysharp15 at gmail dot 
com,
   ||marxin at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
Summary|[12 Regression] |[12 Regression]
   |'-fcompare-debug' failure   |'-fcompare-debug' failure
   |with enabled warnings   |with enabled warnings since
   ||r12-6563-gb8ffa71e4271ae56

--- Comment #2 from Martin Liška  ---
Started with r12-6563-gb8ffa71e4271ae56.