problems with writing a new pass

2005-10-03 Thread worm book

Hi,

I wrote a new pass following the examples listed in the wiki 
pages. However, when I "../gcc/configure; make bootstrap", I got 
error messages like:


/xgcc -B./ -B/usr/local/i686-pc-linux-gnu/bin/ -isystem 
/usr/local/i686-pc-linux-gnu/include -isystem 
/usr/local/i686-pc-linux-gnu/sys-include -L/backup/home/jianglx/softs/researchTools/parsetree/v2/gcc/gcccvs/gccbuild/gcc/../ld 
-O2 -O2 -g -O2  -DIN_GCC-W -Wall -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wold-style-definition  -isystem 
/include  -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include 
-I../../gcc/gcc/../libcpp/include   -g0 -finhibit-size-directive  
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss 
-fno-unit-at-a-time  -fno-omit-frame-pointer \

 -c ../../gcc/gcc/crtstuff.c -DCRT_BEGIN \
 -o crtbegin.o
In file included from /usr/include/stdio.h:831,
from ../../gcc/gcc/tsystem.h:90,
from ../../gcc/gcc/crtstuff.c:62:
/usr/include/bits/stdio.h: In function 'vprintf':
/usr/include/bits/stdio.h:37: internal compiler error: 
Segmentation fault


The pass just iterates all statements using FOR_EACH_BB and 
bsi_start/bsi_next and counts the numbers of different kinds of 
statements. I only added a new file containing the code for 
counting and didn't touch other files except for tree-pass.h, 
timevar.def, passes.c, Makefile.in which are mentioned in the 
examples. There is a hash table structure written by myself in the 
new file, using some library functions, such as xmalloc, assert 
and strcmp. I have no clue what the error message implies. Can 
anybody shed some light on it?



By the way, when I tried to build GCC using the code from the CVS 
repository, the bootstrap failed on my machine, showing error 
message like:


config.status: error: cannot find input file: 
native/jawt/Makefile.in
configure: error: /bin/sh 
'../../../../gcc/libjava/classpath/configure' failed for classpath

make[1]: *** [configure-target-libjava] Error 1
make[1]: Leaving directory `/backup/gcc/gcccvs/gccbuild'
make: *** [bootstrap] Error 2

However, if I disable Java support by 
"../gcc/configure --enable-language=c,c++,fortran,objc", bootstrap 
succeeds. Does it mean that certain configuration for Java is 
wrong?


Thanks a lot.

Skyhover


Re: problems with writing a new pass

2005-10-04 Thread worm book
- Original Message - 
Sent: Monday, October 03, 2005 3:02 AM

Subject: Re: problems with writing a new pass



In file included from /usr/include/stdio.h:831,
from ../../gcc/gcc/tsystem.h:90,
from ../../gcc/gcc/crtstuff.c:62:
/usr/include/bits/stdio.h: In function 'vprintf':
/usr/include/bits/stdio.h:37: internal compiler error: 
Segmentation fault


You are getting an error *compiling* vprintf, not *using* it.

Paolo



Thanks for the remind. After debugging for a while, I think it is 
an error caused by using *and* compiling: I put  my pass as the 
first pass using NEXT_PASS in passes.c and use FOR_EACH_BB and 
etc, which are constructed after the pass of building CFGs. Then, 
during stage2 and 3, the new compiler will incorrectly *use* 
uninitialized data structures to *compile* vprintf and cause 
segfault.


Then my question is: can the pass manager automatically rearrange
the order of passes based on required and provided properties of
all passes? It can help avoid certain misuses, like the one I 
made.


Skyhover