Bug 41584 - WHOPR doesn't grok empty units
Summary: WHOPR doesn't grok empty units
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, lto
: 43609 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-10-05 12:56 UTC by Richard Biener
Modified: 2010-06-03 14:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-04-08 11:09:52


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2009-10-05 12:56:21 UTC
empty.c
-------
/* This page intentionally left blank.  */


> ./xgcc -B. -o t empty.c -shared -fwhopr
lto1: internal compiler error: vector VEC(cgraph_node_ptr,base) index domain error, in csi_node at cgraph.h:614
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

this is because we try to find a name for the ltrans file (which we'll
end up not needing...) by looking at the first element of the callgraph-set
(which is empty ...).
Comment 1 Richard Biener 2010-04-01 13:53:26 UTC
*** Bug 43609 has been marked as a duplicate of this bug. ***
Comment 2 Ralf Wildenhues 2010-04-01 18:15:04 UTC
Same happens with

cat >a.c <<\EOF
int i = 42;
EOF

or with

cat >a.c <<\EOF
int foo;
int *i = &foo;
EOF
Comment 3 Steven Bosscher 2010-04-08 11:09:52 UTC
Interestingly, LTO actually tries to use the original file name:

      /* Since SET does not need to be processed by LTRANS, use
         the original file name and mark it with a '*' prefix so that
         lto_execute_ltrans knows not to process it.  */
      cgraph_node_set_iterator si = csi_start (set);
      struct cgraph_node *first = csi_node (si);
      fname = prefix_name_with_star (first->local.lto_file_data->file_name);

But it tries to take the file name from the first node in the call graph. And the reason why we try re-use the original file name, is because the call graph is empty. Strange logic...

Maybe WHOPR should give a fatal error if the only set is empty.

Comment 4 Jan Hubicka 2010-04-26 07:55:47 UTC
Well, or just use some default name of the unit ;)
Comment 5 Richard Biener 2010-06-03 14:22:53 UTC
Fixed.
Comment 6 Richard Biener 2010-06-03 14:23:35 UTC
Subject: Bug 41584

Author: rguenth
Date: Thu Jun  3 14:22:46 2010
New Revision: 160223

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

	PR lto/41584
	* gcc.dg/lto/20100603-1_0.c: New testcase.
	* gcc.dg/lto/20100603-2_0.c: Likewise.
	* gcc.dg/lto/20100603-3_0.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/lto/20100603-1_0.c
    trunk/gcc/testsuite/gcc.dg/lto/20100603-2_0.c
    trunk/gcc/testsuite/gcc.dg/lto/20100603-3_0.c
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 7 Richard Biener 2010-06-04 11:00:48 UTC
Subject: Bug 41584

Author: rguenth
Date: Fri Jun  4 11:00:09 2010
New Revision: 160258

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

	PR lto/41584
	* cgraph.h (struct varpool_node): Add lto_file_data field.
	* lto-cgraph.c (input_varpool_node): Initialize it.

	lto/
	* lto.c (lto_1_to_1_map): Use the proper file_data for
	varpool nodes.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.h
    trunk/gcc/lto-cgraph.c
    trunk/gcc/lto/ChangeLog
    trunk/gcc/lto/lto.c