When I walk through the Basic Blocks, I have the following statement
------------------------------------
//this piece of code causes errors
if (TREE_CODE (stmt) == CALL_EXPR){
    if ( (TREE_CODE (TREE_OPERAND (TREE_OPERAND (stmt, 0), 0)))
==FUNCTION_DECL)
                fprintf(stderr,"Here\n");
}
----------------------------------------
it gives me the following errors: 

....
/bin/sh ../../gcc-4.1.1/gcc/../move-if-change tmp-macro_list macro_list
macro_list is unchanged
echo timestamp > s-macro_list
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/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-4.1.1/gcc/crtstuff.c -DCRT_BEGIN \
  -o crtbegin.o
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/include  -g0 -finhibit-size-directive
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss
-fno-unit-at-a-time  -fno-omit-frame-pointer -fPIC \
  -c ../../gcc-4.1.1/gcc/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
  -o crtbeginS.o
here
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/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-4.1.1/gcc/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
  -o crtbeginT.o
here
here
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/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-4.1.1/gcc/crtstuff.c -DCRT_END \
  -o crtend.o
../../gcc-4.1.1/gcc/crtstuff.c: In function ‘__do_global_ctors_aux’:
../../gcc-4.1.1/gcc/crtstuff.c:515: 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.
make[2]: *** [crtend.o] Error 1
make[2]: Leaving directory
`/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory
`/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95'
make: *** [all] Error 2

However, if I simply do, no error is reported:
------------------------------------
//this code is a good piece of code
if (TREE_CODE (stmt) == CALL_EXPR){
    (TREE_CODE (TREE_OPERAND (TREE_OPERAND (stmt, 0), 0))) ==FUNCTION_DECL;
}
----------------------------------------





Similarly, if I have this piece of code,
------------------------------------
//this piece of code causes errors
if (TREE_CODE (stmt) == CALL_EXPR){
    fprintf(stderr, "true=%d\n", ((TREE_CODE (TREE_OPERAND (TREE_OPERAND (stmt,
0), 0))) == FUNCTION_DECL));
}
----------------------------------------
I got the following errors,

.....
echo timestamp > s-macro_list
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/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-4.1.1/gcc/crtstuff.c -DCRT_BEGIN \
  -o crtbegin.o
true=0
true=0
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/include  -g0 -finhibit-size-directive
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss
-fno-unit-at-a-time  -fno-omit-frame-pointer -fPIC \
  -c ../../gcc-4.1.1/gcc/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
  -o crtbeginS.o
true=1
true=0
true=0
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/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-4.1.1/gcc/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
  -o crtbeginT.o
true=0
true=1
true=1
true=0
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/xgcc
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/./gcc/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/bin/
-B/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/lib/
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/include
-isystem
/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/i686-pc-linux-gnu/sys-include
-O2 -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include
-I/export/home/a/yang22/obj-gmp4.2.1/include
-I/export/home/a/yang22/obj-mpfr2.2.0/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-4.1.1/gcc/crtstuff.c -DCRT_END \
  -o crtend.o
../../gcc-4.1.1/gcc/crtstuff.c: In function ‘__do_global_ctors_aux’:
../../gcc-4.1.1/gcc/crtstuff.c:515: 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.
make[2]: *** [crtend.o] Error 1
make[2]: Leaving directory
`/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory
`/export/home/a/yang22/modifiedgcc411/objgcc4.1.1_withf95'
make: *** [all] Error 2


-- 
           Summary: TREE_CODE usage error
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: seanatpurdue at hotmail dot com
  GCC host triplet: May this be a bug of TREE_CODE macro?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28180

Reply via email to