Bug 28734 - gather stats vs PCH
Summary: gather stats vs PCH
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-15 15:35 UTC by Vladislav Mikhailikov
Modified: 2011-01-20 03:58 UTC (History)
3 users (show)

See Also:
Host: pentium4-east-linux
Target: pentium4-east-linux
Build: pentium4-east-linux
Known to work:
Known to fail:
Last reconfirmed: 2006-08-16 16:53:59


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladislav Mikhailikov 2006-08-15 15:35:10 UTC
When trying to compile wxWidgets-2.7.0 (or wxWidgets-2.6.3 stable branch) got
this error in garbage collector code.

root@cat:[/usr/src/rpm/BUILD/wxWidgets-2.7.0-1]# make
./bk-deps g++ -c -owx basedll_appbase.o -I.pch/wxprec_basedll -D__WXX11__ -D__WXUNIVERSAL__        -I./src/odbc -I./src/regex  -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -fPIC -DPIC -DWX_PRECOMP -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_IODBC_ -Ilib/wx/include/x11univ-unicode-release-2.7 -I./include -I/usr/X11R7/include -pthread -Wall -Wundef -Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/X11R7/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/X11R7/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O2 -march=pentium4 -mtune=pentium4 -fomit-frame-pointer -fstack-protector-all ./src/common/appbase.cpp
In file included from ./src/common/appbase.cpp:36:
./include/wx/cmdline.h:180: internal compiler error: in ggc_record_overhead, at ggc-common.c:877
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [basedll_appbase.o] Error 1
Comment 1 Andrew Pinski 2006-08-15 15:43:43 UTC
The only time this function can be called if GCC was compiled with gather stats on , which should not be done for a production compiler.
Comment 2 Vladislav Mikhailikov 2006-08-15 18:01:50 UTC
It works! Just have used --disable-gather-detailed-mem-stats in configure. Though some additional patches that could be found in Manfriva CVS and linuxfromscratch.org makes the compilator much more robust and quick. Thank you very much for suggestion,

Tanuki
Comment 3 Andrew Pinski 2006-08-15 18:04:28 UTC
Can you attach the preprocessed testcase as this is most likely this is a bug still?
Comment 4 Vladislav Mikhailikov 2006-08-15 18:09:20 UTC
Indeed I have alredy recompile the whole suite. And bug has gone. Though if you have gcc-4.1.1 with -enable-gather-detailed-mem-stats  -- just download wxWidgets-2.7.0 or wxWidgets-2.6.3 from http://www.wxwidgets.org and try to compile with something like ./configure --enable-gui --enable-universal (the simplest pack) and you will see the bugs in ggc.h
Comment 5 Vladislav Mikhailikov 2006-08-15 18:17:12 UTC
It's 23:16 and I have to go home. I will try to reproduce the bug tomorrow morning and post the preprocessed fragment of the code here or will send it to you directly by mail (in case it will be too heavy for the post). Any way if I can help you I do.

With best regards,

Tanuki
Comment 6 Martin Michlmayr 2006-08-16 16:41:48 UTC
Here's what I came up with:

(sid)518:tbm@chico: ~/tmp] cat appbase.cpp
#include "foo.h"

int bar(int x);

(sid)519:tbm@chico: ~/tmp] rm -rf .pch/
(sid)520:tbm@chico: ~/tmp] mkdir -p .pch/
(sid)521:tbm@chico: ~/tmp] touch empty.h
(sid)522:tbm@chico: ~/tmp] /usr/local/bin/g++ -fPIC -O -o .pch/foo.h.gch empty.h
(sid)523:tbm@chico: ~/tmp] /usr/local/bin/g++ -c -I.pch -DwxUSE_BASE=1 -fPIC -O1 appbase.cpp
appbase.cpp:3: internal compiler error: in ggc_record_overhead, at ggc-common.c:877
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
(sid)524:tbm@chico: ~/tmp]

And when you slightly change the file you get a segfault:

(sid)526:tbm@chico: ~/tmp] cat test2.cpp
#include "foo.h"

int bar(void);

(sid)527:tbm@chico: ~/tmp] /usr/local/bin/g++ -c -I.pch -DwxUSE_BASE=1 -fPIC -O1 test2.cpp
test2.cpp:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 7 Martin Michlmayr 2006-08-16 16:45:07 UTC
(sid)542:tbm@chico: ~/tmp] /usr/local/bin/g++ -c -I.pch -Dw -fPIC -O1 appbase.cpp
appbase.cpp:3: internal compiler error: in ggc_record_overhead, at ggc-common.c:877
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
(sid)543:tbm@chico: ~/tmp] /usr/local/bin/g++ -c -I.pch -Dx -fPIC -O1 appbase.cpp
appbase.cpp:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
(sid)544:tbm@chico: ~/tmp]
Comment 8 Vladislav Mikhailikov 2006-08-17 18:51:37 UTC
It seems that gcc-4.2 has the same problem. At least all .pch tests fail with that option set
Comment 9 Rob 2009-01-22 01:51:50 UTC
Confirmed, trunk, i386-pc-solaris2.11 - the gcc.log is:

/usr/share/src/gcc_trunk/gcc/testsuite/gcc.dg/pch/common-1.c:3: internal compiler error: in ggc_record_overhead, at ggc-common.c:873

/usr/share/src/gcc_trunk/gcc/testsuite/gcc.dg/pch/counter-1.c:7: internal compiler error: in ggc_record_overhead, at ggc-common.c:873


More info:
Results for 4.4.0 20090121 (experimental) [trunk revision 143538] (GCC) testsuite on i386-pc-solaris2.11
http://gcc.gnu.org/ml/gcc-testresults/2009-01/msg02197.html

Rob
Comment 10 Rob 2011-01-19 04:36:37 UTC
(In reply to comment #3)
> Can you attach the preprocessed testcase as this is most likely this is a bug
> still?
The source in the Testsuite Directory contains an error (misnamed file) which when corrected will allow gcc to compile correctly. It is the "File Not Found" error that causes the ICE and NOT an "error in the Testsuite source" itself.
If you alter the Source to correct it then the ICE goes away.


This message suggests that this Bug still occurs on the Trunk and purports a Fix: http://readlist.com/lists/gcc.gnu.org/gcc/8/41545.html


I get this Bug on a preRelease SVN version:

# /usr/local/gcc-4_5-branch_build/gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4_5-branch_build/gcc/xgcc
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4_5-branch/configure --enable-multiarch --enable-nls --with-tls --enable-static --enable-shared --enable-plugin --enable-lto --enable-linker-build-id --with-system-zlib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-stage1-checking=release --enable-checking=release --enable-gather-detailed-mem-stats --enable-libssp --enable-libmudflap --enable-libgomp --enable-decimal-float --enable-languages=c,c++,ada
Thread model: posix
gcc version 4.5.3 20110117 (prerelease) [gcc-4_5-branch revision 168886] (GCC) 


# uname -a
Linux debian 2.6.32-5-amd64 #1 SMP Wed Jan 12 05:14:59 UTC 2011 x86_64 GNU/Linux


# cat /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c
#include "common-1.h"
int foo2 = 3;
int zz = 2;

# cat /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.hs 
static int foo1 = 9;
int foo2;
extern int zz;


If I edit a copy of common-1.c and include "common-1.hs" (instead of "common-1.h") then the ICE does not occur (so no preprocessed source included).



Here is a small portion of gcc.log:

PASS: gcc.dg/noncompile/voidparam-1.c  -O2 -fwhopr  (test for excess errors)
testcase /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/noncompile/noncompile.exp completed in 54 seconds
Running /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/pch.exp ...
Executing on host: /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ ./common-1.h   -O0 -g   -m32 -o common-1.h.gch    (timeout = 300)
spawn /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ ./common-1.h -O0 -g -m32 -o common-1.h.gch

PASS: ./common-1.h  -O0 -g (test for excess errors)
Executing on host: /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c   -O0 -g -I.  -S  -m32 -o common-1.s    (timeout = 300)
spawn /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c -O0 -g -I. -S -m32 -o common-1.s

/usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c:3:1: internal compiler error: in ggc_record_overhead, at ggc-common.c:939

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

compiler exited with status 1
output is:
/usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c:3:1: internal compiler error: in ggc_record_overhead, at ggc-common.c:939

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.


FAIL: gcc.dg/pch/common-1.c  -O0 -g -I. (internal compiler error)
FAIL: gcc.dg/pch/common-1.c  -O0 -g -I. (test for excess errors)
Excess errors:
/usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c:3:1: internal compiler error: in ggc_record_overhead, at ggc-common.c:939

assembly file 'common-1.s' missing
FAIL: gcc.dg/pch/common-1.c -O0 -g assembly comparison
Executing on host: /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ ./common-1.h    -O0    -m32 -o common-1.h.gch    (timeout = 300)
spawn /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ ./common-1.h -O0 -m32 -o common-1.h.gch

PASS: ./common-1.h   -O0  (test for excess errors)
Executing on host: /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c    -O0  -I.  -S  -m32 -o common-1.s    (timeout = 300)
spawn /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c -O0 -I. -S -m32 -o common-1.s

/usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c:3:1: internal compiler error: in ggc_record_overhead, at ggc-common.c:939

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

compiler exited with status 1
output is:
/usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c:3:1: internal compiler error: in ggc_record_overhead, at ggc-common.c:939

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.


FAIL: gcc.dg/pch/common-1.c   -O0  -I. (internal compiler error)
FAIL: gcc.dg/pch/common-1.c   -O0  -I. (test for excess errors)
Excess errors:
/usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c:3:1: internal compiler error: in ggc_record_overhead, at ggc-common.c:939

assembly file 'common-1.s' missing
FAIL: gcc.dg/pch/common-1.c  -O0  assembly comparison
Executing on host: /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ ./common-1.h    -O1    -m32 -o common-1.h.gch    (timeout = 300)
spawn /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ ./common-1.h -O1 -m32 -o common-1.h.gch

PASS: ./common-1.h   -O1  (test for excess errors)
...
-----

Perhaps more troubling is that if I run this by hand from the command line (instead of letting the Testsuite run it) then I get a "normal error" and no ICE.

So we have:

* Testsuite's gcc.log shows different output than using the command line.
* In the common-1.c File the "#include" references a file we do not have _OR_ we create the File to be included with a name differing from what the Source expects.


# /usr/local/gcc-4_5-branch_build/gcc/xgcc -B/usr/local/gcc-4_5-branch_build/gcc/ /usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c   -O0 -g -I.  -S  -m32 -o common-1.s
/usr/local/gcc-4_5-branch/gcc/testsuite/gcc.dg/pch/common-1.c:1:22: fatal error: common-1.h: No such file or directory
compilation terminated.


Thanks,
Rob