Bug 43080 - ICE with anonymous union and -flto
Summary: ICE with anonymous union and -flto
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.1
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code, lto, monitored
Depends on:
Blocks:
 
Reported: 2010-02-15 14:25 UTC by Volker Reichelt
Modified: 2010-05-19 13:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.5.0
Last reconfirmed: 2010-04-23 16:22:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2010-02-15 14:25:36 UTC
The following valid code snippet triggers an ICE on trunk when compiled with
"-flto -g":

=======================================
inline int foo()
{
  static union { int i; };
  return i;
}

void bar()
{
  foo();
}
=======================================

bug.cc: In function 'foo()':
bug.cc:5:1: internal compiler error: in gimple_decl_printable_name, at gimple.c:4610
Please submit a full bug report, [etc.]
Comment 1 Richard Biener 2010-02-15 15:03:07 UTC
We remove anonymous names to not break cross-TU merging.  Looks like we need
to resurrect them or mark them as anonymous for merging instead of throwing
them away.
Comment 2 Richard Biener 2010-04-23 16:22:45 UTC
I have a fix.
Comment 3 Richard Biener 2010-04-26 09:19:54 UTC
Subject: Bug 43080

Author: rguenth
Date: Mon Apr 26 09:19:24 2010
New Revision: 158723

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158723
Log:
2010-04-26  Richard Guenther  <rguenther@suse.de>

	PR lto/43080
	* gimple.c (gimple_decl_printable_name): Deal gracefully
	with a NULL DECL_NAME.

	* g++.dg/lto/20100423-3_0.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/lto/20100423-3_0.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Richard Biener 2010-04-26 09:25:01 UTC
Fixed.
Comment 5 Richard Biener 2010-05-19 13:16:34 UTC
Subject: Bug 43080

Author: rguenth
Date: Wed May 19 13:14:37 2010
New Revision: 159564

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159564
Log:
2010-05-19  Richard Guenther  <rguenther@suse.de>

        Backport from mainline:
        2010-04-26  Richard Guenther  <rguenther@suse.de>

	PR lto/43455
	* tree-inline.c (tree_can_inline_p): Also check compatibility
	of return types.

	* gcc.dg/lto/20100423-1_0.c: New testcase.
	* gcc.dg/lto/20100423-1_1.c: Likewise.

        2010-04-23  Richard Guenther  <rguenther@suse.de>

	PR lto/42653
	* tree.c (free_lang_data_in_decl): Do not reset DECL_CONTEXT
	of FUNCTION_DECLs.

	* g++.dg/lto/20100423-1_0.C: New testcase.

        2010-04-26  Richard Guenther  <rguenther@suse.de>

	PR lto/42425
	* tree.c (free_lang_data_in_type): Do not free TYPE_CONTEXT
	if emitting debug information and it is either a function
	or a namespace decl.

	* g++.dg/lto/20100423-2_0.C: New testcase.

        2010-04-26  Richard Guenther  <rguenther@suse.de>

	PR lto/43080
	* gimple.c (gimple_decl_printable_name): Deal gracefully
	with a NULL DECL_NAME.

	* g++.dg/lto/20100423-3_0.C: New testcase.

        2010-04-30  Richard Guenther  <rguenther@suse.de>

	PR lto/43946
	* passes.c (init_optimization_passes): Move pass_ipa_free_lang_data
	first after all lowering passes.

	* gcc.dg/lto/20100430-1_0.c: New testcase.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/lto/20100423-1_0.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/lto/20100423-2_0.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/lto/20100423-3_0.C
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/lto/20100423-1_0.c
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/lto/20100423-1_1.c
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/lto/20100430-1_0.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/gimple.c
    branches/gcc-4_5-branch/gcc/passes.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/tree-inline.c
    branches/gcc-4_5-branch/gcc/tree.c