This is the mail archive of the gcc-help@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]

Re: execution order


Hi Kövesdi,

> How the inter-dependency is determined?

Outside of my knowledge.  I presume by variable usage analysis.

GCC uses the SSA optimization technique as well, which has helped perform
some impressive optimizations.  I'm not sure if SSA is relevant here.

> How can I tell the compiler not to do re-ordering?

Use -O0 - that will tell the compiler not to optimize, which will prevent
re-ordering.

> Is it possible to make such a dependency between them?

If the destructor is not inline, and also is not provided in that same
translation unit (so it isn't "known" at compile time for that translation
unit), and also the global variable being returned is not static (so it has
external access outside of the translation unit), then the compiler cannot
presume that there is no dependency.  (Holistic analysis optimizers like
LLVM can still reorder.  But, currently, GCC isn't a holistic optimizer - so
that's not a concern.)

HTH,
--Eljay


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