Bug 39301 - ICE in register_overhead, at bitmap.c:115
Summary: ICE in register_overhead, at bitmap.c:115
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Ben Elliston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 14:03 UTC by lucier
Modified: 2009-05-17 01:09 UTC (History)
1 user (show)

See Also:
Host: powerpc64-unknown-linux-gnu
Target: powerpc64-unknown-linux-gnu
Build: powerpc64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2009-03-23 04:59:39


Attachments
patch to use HOST_WIDEST_INT for bitmap statistics (900 bytes, patch)
2009-05-15 21:55 UTC, lucier
Details | Diff
memory and time report for compiler.i test case (24.72 KB, text/plain)
2009-05-15 21:57 UTC, lucier
Details
The regression test results (4.05 KB, text/plain)
2009-05-16 01:21 UTC, lucier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lucier 2009-02-25 14:03:07 UTC
With this compiler:

[lucier@descartes gambc-v4_4_1-devel]$ /pkgs/gcc-mainline/bin/gcc -v
Using built-in specs.
Target: powerpc64-unknown-linux-gnu
Configured with: ../../mainline/configure --prefix=/pkgs/gcc-mainline --enable-languages=c --enable-gather-detailed-mem-stats --with-cpu=default64
Thread model: posix
gcc version 4.4.0 20090224 (experimental) [trunk revision 144414] (GCC) 

with compiler.i found at

http://www.math.purdue.edu/~lucier/bugzilla/8

and this command line:

[lucier@descartes gambc-v4_4_1-devel]$ gdb /pkgs/gcc-mainline/libexec/gcc/powerpc64-unknown-linux-gnu/4.4.0/cc1
(gdb) run  -I../include -Wall -W -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common  compiler.i

one gets an ICE 

Starting program: /pkgs/gcc-mainline/libexec/gcc/powerpc64-unknown-linux-gnu/4.4.0/cc1 -I../include -Wall -W -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common  compiler.i
 btowc wctob mbrlen {GC 5504k -> 3345k} {GC 5325k -> 4387k} code_size ___H__20_compiler_2e_o1 {GC 202396k -> 113348k} ___init_proc ____20_compiler_2e_o1
Analyzing compilation unit
 {GC 182571k -> 135708k}Performing interprocedural optimizations
 <visibility> <early_local_cleanups> {GC 237987k -> 236439k} <summary generate> <inline> <static-var> <pure-const>Assembling functions:
 code_size ___init_proc ____20_compiler_2e_o1 ___H__20_compiler_2e_o1 {GC 349654k -> 288661k} {GC 406235k -> 272087k}
compiler.c: In function ‘___H__20_compiler_2e_o1’:
compiler.c:322876: internal compiler error: in register_overhead, at bitmap.c:115

I'm sorry the test case is enormous, but it runs in about a GB of RAM. I also haven't been able to figure out how to use gdb properly in this mixed ppc32/ppc64 environment.
Comment 1 Richard Biener 2009-02-25 14:10:48 UTC
/* Store information about each particular bitmap.  */
struct bitmap_descriptor
{
  const char *function;
  const char *file;
  int line;
  int allocated;
  int created;
  int peak;
  int current;
  int nsearches;
};

I guess we simply overflow current.  Using HOST_WIDEST_INT for the counters
would be appropriate.
Comment 2 Ben Elliston 2009-03-27 04:14:59 UTC
I am unable to reproduce this problem with mainline.  I see:

cc1: out of memory allocating 4064 bytes after a total of 3543465984 bytes
Comment 3 lucier 2009-03-27 15:12:34 UTC
I'm still seeing it with:

[lucier@descartes ~]$ /pkgs/gcc-mainline/bin/gcc -v
Using built-in specs.
Target: powerpc64-unknown-linux-gnu
Configured with: ../../mainline/configure --prefix=/pkgs/gcc-mainline --enable-languages=c --enable-gather-detailed-mem-stats --with-cpu=default64
Thread model: posix
gcc version 4.4.0 20090327 (experimental) [trunk revision 145100] (GCC) 

as

[lucier@descartes compiler.i-test]$ /pkgs/gcc-mainline/libexec/gcc/powerpc64-unknown-linux-gnu/4.4.0/cc1 -I../include -Wall -W -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common compiler.i
 btowc wctob mbrlen {GC 5325k -> 3526k} {GC 5325k -> 4483k} code_size ___H__20_compiler_2e_o1 {GC 201152k -> 113339k} ___init_proc ____20_compiler_2e_o1
Analyzing compilation unit
 {GC 181409k -> 135700k}Performing interprocedural optimizations
 <visibility> <early_local_cleanups> {GC 237979k -> 236431k} <summary generate> <inline> <static-var> <pure-const>Assembling functions:
 code_size ___init_proc ____20_compiler_2e_o1 ___H__20_compiler_2e_o1 {GC 349493k -> 288659k} {GC 406233k -> 272085k}
compiler.c: In function â:
compiler.c:322876: internal compiler error: in register_overhead, at bitmap.c:115
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I have to admit I didn't see it with an x86-64 compiler; perhaps the ppc64 port is more complicated and requires more bitmaps.

I suspect, given the error message, that you built a 32-bit compiler and ran out of memory space before you hit this problem.
Comment 4 Ben Elliston 2009-03-31 05:46:24 UTC
I still cannot reproduce this using the 4.4 branch:

$ ./xgcc -v
Reading specs from ./specs
Target: powerpc64-unknown-linux-gnu
Configured with: /home/bje/source/gcc-clean/configure --enable-languages=c --enable-gather-detailed-mem-stats --with-cpu=default64 --disable-bootstrap --quiet
Thread model: posix
gcc version 4.4.0 20090327 (experimental) [trunk revision 145326] (GCC) 

$ ./cc1 -I../include -Wall -W -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common  compiler.i
 btowc wctob mbrlen code_size ___H__20_compiler_2e_o1 {GC 124407k -> 67811k} ___init_proc ____20_compiler_2e_o1
Analyzing compilation unit
 {GC 107701k -> 81846k}Performing interprocedural optimizations
 <visibility> <early_local_cleanups> {GC 140505k -> 139614k} <summary generate> <inline> <static-var> <pure-const>Assembling functions:
 code_size ___init_proc ____20_compiler_2e_o1 ___H__20_compiler_2e_o1 {GC 188952k -> 155976k} {GC 232824k -> 158800k}
cc1: out of memory allocating 4064 bytes after a total of 3485597696 bytes

Can you see any differences here?
Comment 5 lucier 2009-03-31 12:38:43 UTC
You have --disable-bootstrap, so my guess is that cc1 is a 32-bit binary if that's what your system compiler builds by default.  By bootstrapping you get a 64-bit binary (the first cc1 built in the bootstrap is 32-bit, but the second and third are 64-bit).
Comment 6 lucier 2009-05-08 20:27:58 UTC
Just for more information, I now hit this on x86_64-unknown-linux-gnu with the compiler

pythagoras-32% /pkgs/gcc-mainline/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /tmp/lucier/gcc/mainline/configure --enable-checking=release --prefix=/pkgs/gcc-mainline --enable-languages=c --enable-gather-detailed-mem-stats
Thread model: posix
gcc version 4.5.0 20090508 (experimental) [trunk revision 147288] (GCC) 

on the compiler.i test case with

/pkgs/gcc-mainline/bin/gcc -save-temps -I../include -I.  -Wall -W -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp -frename-registers -fno-move-loop-invariants -fforward-propagate -DHAVE_CONFIG_H -D___PRIMAL -D___LIBRARY -c compiler.i -ftime-report -fmem-report > & rename-no-move-loop-invariants-forward-propagate-report-new

Comment 7 Ben Elliston 2009-05-14 01:31:59 UTC
The test case does not run in a GB of RAM on my x86-64 system.  It sends the system deep into swap until the out-of-memory manager kicks in.
Comment 8 lucier 2009-05-15 21:55:23 UTC
Created attachment 17876 [details]
patch to use HOST_WIDEST_INT for bitmap statistics

Here's a hack to use HOST_WIDEST_INT for bitmap statistics.  I'll attach the report from the compiler.i test case.  If you think the report is useful, perhaps you can use this as a starting point for a real patch and I'll bootstrap and test it.

Brad
Comment 9 lucier 2009-05-15 21:57:05 UTC
Created attachment 17877 [details]
memory and time report for compiler.i test case

Here's the output for the test case.  See if you like it.

I used the following configure command and compiler version:

pythagoras-147% /pkgs/gcc-mainline/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /tmp/lucier/gcc/mainline/configure --enable-checking=release --prefix=/pkgs/gcc-mainline --enable-languages=c --enable-gather-detailed-mem-stats --disable-bootstrap
Thread model: posix
gcc version 4.5.0 20090515 (experimental) [trunk revision 147594] (GCC)
Comment 10 Richard Biener 2009-05-15 22:29:36 UTC
The patch is good enough.
Comment 11 lucier 2009-05-16 01:21:38 UTC
Created attachment 17880 [details]
The regression test results

So it's passed bootstrap and regression tested.

configure flags: --prefix=/pkgs/gcc-mainline --enable-gather-detailed-mem-stats
Results for 4.5.0 20090515 (experimental) [trunk revision 147594] (GCC) testsuite on x86_64-unknown-linux-gnu

I don't have check-in privileges.
Comment 12 Richard Biener 2009-05-16 10:25:55 UTC
Please post it to gcc-patches with an appropriate ChangeLog entry.  Thanks.
Comment 13 lucier 2009-05-16 14:37:06 UTC
Subject: Re:  ICE in register_overhead, at bitmap.c:115


On May 13, 2009, at 9:32 PM, bje at gcc dot gnu dot org wrote:

> The test case does not run in a GB of RAM on my x86-64 system.  It  
> sends the
> system deep into swap until the out-of-memory manager kicks in.

Ah, now that -fforward-propagate has been added to -O1 on mainline it  
takes a bit over 8GB of RAM to run instead of a GB.

Sorry.

Comment 14 hjl@gcc.gnu.org 2009-05-16 22:42:26 UTC
Subject: Bug 39301

Author: hjl
Date: Sat May 16 22:42:15 2009
New Revision: 147624

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147624
Log:
2009-05-16  Brad Lucier  <lucier@math.purdue.edu>

	PR middle-end/39301
	* hwint.h: Add macro HOST_WIDEST_INT_PRINT.
	* bitmap.c (bitmap_descriptor): Make fields HOST_WIDEST_INT.
	(output_info): Make field HOST_WIDEST_INT.
	(print_statistics): Use HOST_WIDEST_INT_PRINT.
	(dump_bitmat_statistics): Same.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/bitmap.c
    trunk/gcc/hwint.h