Bug 53574 - ICE with -fstack-usage
Summary: ICE with -fstack-usage
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2012-06-04 13:32 UTC by Jakub Jelinek
Modified: 2017-10-16 09:31 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-06-19 00:00:00


Attachments
rh828003.ii (2.03 KB, text/plain)
2012-06-04 13:34 UTC, Jakub Jelinek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2012-06-04 13:32:46 UTC
The following testcase ICEs with -std=c++11 -fstack-usage, works fine without
the latter.
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The problem is when -fstack-usage uses lang_hooks.decl_printable_name (current_function_decl, 2) late, not sure if it is because free_lang_data frees something that the C++ FE needs for it and toplevel.c shouldn't be calling that langhook so late, or if it is a C++ FE bug.
Comment 1 Jakub Jelinek 2012-06-04 13:34:26 UTC
Created attachment 27554 [details]
rh828003.ii
Comment 2 Eric Botcazou 2012-06-19 08:20:04 UTC
This also crashes debug_tree on the decl from within the debugger. It seems that lang_decl_name can do a fair amount of processing if v >= 2.  Additionally passing TFF_NO_FUNCTION_ARGUMENTS from there fixes the crash (and would be sufficient for -fstack-usage), but this breaks __PRETTY_FUNCTION__ for example.

A possible solution would be to set TFF_NO_FUNCTION_ARGUMENTS if v == 2 and use level 3 internally (in error.c and in pt.c for __PRETTY_FUNCTION__).

FWIW the Ada front-end doesn't print the arguments if v == 2.
Comment 3 Paolo Carlini 2017-10-15 22:06:34 UTC
Jakub, is this still an issue?
Comment 4 Jakub Jelinek 2017-10-16 08:06:41 UTC
No, it went away likely with r189298.  Let me check in the testcase and close the PR.
Comment 5 Jakub Jelinek 2017-10-16 08:36:37 UTC
Author: jakub
Date: Mon Oct 16 08:36:06 2017
New Revision: 253778

URL: https://gcc.gnu.org/viewcvs?rev=253778&root=gcc&view=rev
Log:
	PR c++/53574
	* g++.dg/other/pr53574.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/other/pr53574.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 6 Jakub Jelinek 2017-10-16 09:31:14 UTC
Fixed.