Bug 84197 - [7/8 Regression] Segmentation fault when setting -g
Summary: [7/8 Regression] Segmentation fault when setting -g
Status: RESOLVED DUPLICATE of bug 71569
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.3.0
: P2 normal
Target Milestone: 7.4
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code
Depends on:
Reported: 2018-02-04 09:29 UTC by fiesh
Modified: 2018-03-14 19:54 UTC (History)
5 users (show)

See Also:
Known to work:
Known to fail: 7.3.1, 8.0
Last reconfirmed: 2018-02-12 00:00:00

Reduced file leading to segfault with "g++ -c -std=c++17 -g" (1.13 KB, text/plain)
2018-02-04 09:29 UTC, fiesh

Note You need to log in before you can comment on or make changes to this bug.
Description fiesh 2018-02-04 09:29:56 UTC
Created attachment 43335 [details]
Reduced file leading to segfault with "g++ -c -std=c++17 -g"

Attached you find the creduced file for triggering the following behavior with g++-7.3.0:

% g++ -c -std=gnu++17 c.ii
<warning omitted>

works, while

% g++ -c -std=gnu++17 -g c.ii
<warning omitted>                                                                                                                                           c.ii: In member function ‘auto y< <template-parameter-1-1> >::operator()() [with <template-parameter-1-1> = int]’:                                     c.ii:123:17: internal compiler error: Segmentation fault                                                                                                g::g() { f<ce>; }

Comment 1 Richard Biener 2018-02-05 11:27:25 UTC
Comment 2 Marek Polacek 2018-02-05 12:53:32 UTC
Seems to have started with r243873.
Comment 3 Jonathan Wakely 2018-02-12 12:44:07 UTC
(In reply to Marek Polacek from comment #2)
> Seems to have started with r243873.

CCing jakub, although I don't know if his patch caused it or the ICE was already latent.
Comment 4 Jakub Jelinek 2018-02-12 13:06:46 UTC
I don't see how my change could be related, neither of the two functions I've touched is ever called on the testcase.
The ICE goes away with -fno-new-ttp-matching, so I think it is much more likely this is caused by r243871.

The ICE is because dwarf2out is invoked on a RECORD_TYPE that is not instantiated, at least its FIELD_DECL has been created by:
23578		      /* Remove constructors and such from TYPE, now that we
23579			 know it is an anonymous aggregate.  */
23580		      fixup_anonymous_aggr (type);
23581		      /* And make the corresponding data member.  */
23582		      decl = build_decl (decl_spec_token_start->location,
23583					 FIELD_DECL, NULL_TREE, type);
23584		      /* Add it to the class.  */
23585		      finish_member_declaration (decl);
in parser.c.
Comment 5 Jason Merrill 2018-03-14 19:54:05 UTC
Fixed by patch for bug 71569.

*** This bug has been marked as a duplicate of bug 71569 ***