This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/12285] Add sizeof_function functionality


------- Additional Comments From mkgnu at gmx dot net  2004-01-01 19:16 -------
Reopened bug.

Again, I will have to disagree and ask that this bug is assigned the minimum
priority and remain open.

By your same argument, there is no need for the "&" C operator. You should be
using asm to get the memory address of the beginning of a function, or variable
location. Having this feature will allow C programs to self-discover the size of
 their functions. They can become introspective.

It _IS_ possible to use a function attribute that will generate an end_label at
the end of each function so that one can compute the size of a function during
compile-time. You can emit the following asm using this C program:

int func()
{
printf("The size of this function is 0x%lx\n", size_of_function(func));
}



func:
...
push func_end_label-func
call printf
...
func_end_label:

GCC itself can emit this, with no modifications needed to as or ld. The fact
that the workaround I use so far is a macro, proves that.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]