Re: Address of labels and -fprofile-arcs

To: kent at erlang dot ericsson dot se

Subject: Re: Address of labels and -fprofile-arcs

From: Jim Wilson <wilson at cygnus dot com>

Date: Mon, 09 Mar 1998 17:16:13 -0800

cc: egcs-bugs at cygnus dot com

This is a known problem. The -fprofile-arcs code works by instrumenting
the control flow graph (CFG), but it does not yet have code for constructing
a correct CFG when computed gotos are present. We are planning on fixing this
by modifying profile.c to use the existing CFG code in flow.c, but this
will take a while as it requires many changes. Meanwhile, we can at least
print a friendly error instead of aborting. I added the following patch
to the development sources, so that now we get
tmp.c: In function `main':
tmp.c:13: -fprofile-arcs does not support computed gotos
Mon Mar 9 17:01:32 1998 Jim Wilson <wilson@cygnus.com>
* profile.c (branch_prob): If see computed goto, call fatal instead of
abort.
Index: profile.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/profile.c,v
retrieving revision 1.13
diff -p -r1.13 profile.c
*** profile.c 1998/02/13 05:40:27 1.13
--- profile.c 1998/03/10 01:01:27
*************** branch_prob (f, dump_file)
*** 759,767 ****
{
rtx label_ref;
! /* Must be an IF_THEN_ELSE branch. */
if (GET_CODE (tem) != IF_THEN_ELSE)
! abort ();
if (XEXP (tem, 1) != pc_rtx)
label_ref = XEXP (tem, 1);
else
--- 759,768 ----
{
rtx label_ref;
! /* Must be an IF_THEN_ELSE branch. If it isn't, assume it
! is a computed goto, which aren't supported yet. */
if (GET_CODE (tem) != IF_THEN_ELSE)
! fatal ("-fprofile-arcs does not support computed gotos");
if (XEXP (tem, 1) != pc_rtx)
label_ref = XEXP (tem, 1);
else