This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Builtin functions?
- From: "Daniel Berlin" <dberlin at dberlin dot org>
- To: "Paulo J. Matos" <pocm at soton dot ac dot uk>
- Cc: gcc at gcc dot gnu dot org, "Jan Hubicka" <jh at suse dot cz>
- Date: Mon, 16 Apr 2007 09:35:26 -0700
- Subject: Re: Builtin functions?
- References: <11b141710704160904l28c17508v70c64255288293c8@mail.gmail.com>
On 4/16/07, Paulo J. Matos <pocm@soton.ac.uk> wrote:
Hello all,
I'm going through the bodies of all user-defined functions. I'm using
as user-defined function as one that:
DECL_BUILT_IN(node) == 0.
Problem is that for a function (derived from a C++ file) whose output
from my pass is (output is self-explanatory, I think):
Registering cgraph node:
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
[operator<<]... SUCCESSFUL
Declared on /home/pmatos/gsvt-bin/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/ostream.tcc,
line 735
Decl Node Code is function_decl
Registering output void ...SUCCESSFUL
Arguments: __out : reference_type, __s : pointer_type
Well, this is definitely builtin but DECL_BUILT_IN == 0, which means
that when I do FOR_EACH_BB_FN, I'm getting a segmentation fault
First, it's not built in, because it's defined in a source file.
Builtin functions are those defined by the compiler.
Second, we should make FOR_EACH_BB_FN never crash on empty tree functions.
It seems really rude to do otherwise.
Just because we don't have a body for a function doesn't mean we
should crash. Users shouldn't have to be checking random things like
DECL_SAVED_TREE to determine if FOR_EACH_BB_FN will work (this is not
to say that they should be able to pass any random crap to it, but it
should be detecting if the function has a body)