Question regarding the values of labels

Ian Lance Taylor iant@google.com
Wed Nov 2 00:56:00 GMT 2011


Matthew Plant <rookie.mp@gmail.com> writes:

> So my final question is this: what determines the addresses of labels?
> Can this problem be fixed with at least semi-readable code?

Speaking very roughly, gcc separates the code into basic blocks and
builds a control flow graph.  The blocks in the control flow graph are
sorted based on the predicted results of branches.  The blocks are then
output in the order.

Nothing like what you want to do is possible with gcc.  You are assuming
that there is a natural correspondence between your source code and
gcc's internal representation; that is a natural thing assumption, but
in actual fact no such correspondence exists.

Ian



More information about the Gcc-help mailing list