comparing translations of invalid source

> > Subject: Re: whose 8051 cc overlays static inline stack frames

> > > > From: Pat LaVarre ... > > ... > > An example I use to make the existence of C epilogues > > plain to newbies is to contrast `gcc -c -Wall -W` > > translations of: > > > > int * echo(int * pi) { return pi; } > > int * blech(void) { int i = 0; return echo(&i); } // wrong by epilogue > > > > int fetch(int * pi) { return *pi; } > > int zero(void) { int i = 0; return fetch(&i); } // reasonably legit > > From: CBFalconer ... > ... > How can you compare translations of invalid source?

Thank you for your question, sorry I do not understand it.

Do you agree the echo/ blech example is illegit and the fetch/ zero example is legit? Do you agree the echo/ blech example is illegit only because the implicit epilogue of blech may free the int i before returning?

Can you restate your question less concisely?

Meanwhile, I can try to explain how I may be misunderstanding/ misusing c.a.e. jargon. Above I have quoted myself in full, below I say again less concisely what I meant to say before. In Five points:

a) I'm thinking we can (and should?) educate people new to C language law by studying the effects of source-to-source transformations.

We can compare and contrast the translations of similar or identical sources, provided the translations exist, no matter whether some printed C standard does or does not promise that two compliant compilers whose hypothetical authors have actually already corrected their last bugs will agree what the source means.

b) Translations exist, indeed appear massively distributed, for plainly "invalid" source such as the example above.

c) C compilers translate syntactically invalid source into syntax errors.

d) C compilers translate semantically invalid source into more revealing constructs. Possibly the result I have enjoyed most came from a compiler who calmly produced an executable that called null whenever a code path actually referenced a subroutine not found during link.

e) I don't feel confident I have learned a parliamentary rule fully until after I can teach someone else how to bend it usefully e.g. my appreciation for increased when first I discovered the use of the carefully "invalid" longjmp back to longjmp:

fibers in C across platforms, if abused without asm

formatting link

Pat LaVarre

Reply to
Pat LaVarre
Loading thread data ...

Please try to keep your attributes together. I have patched this up.

Epilogue has no meaning to me. I assume you mean returning the address of automatic storage which is no longer in scope. Nothing is getting freed. That is a beginners mistake.

The above was not the code I specified as invalid, however.

--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
     USE worldnet address!
Reply to
CBFalconer

I soooooooooooooo don't get this.

I do not know what "my attributes" are, nor that they were not "together".

Ouch. I thought "epilogue" was standard compiler jargon. By "prologue" I mean the code that the compiler implicitly emits to be executed as part of every entry to a subroutine. By "epilogue" I mean the code that the compiler implicit emits to be executed as part of every exit from a subroutine. Often compilers targetting microcontrollers give people a way of saying please omit the prologue and epilogue so that the body of a routine (esp. an interrupt handler) can be nothing but inline asm.

Yes.

Seemingly we're also speaking from two different traditions re the verb "to free".

I say automatic storage is "automatic" because it is "allotted" by the implicit prologue and "freed" by the implicit epilogue. What do you say? "Acquired" and "released"?

Not sure what you mean by "that".

I think you mean to say that only beginners frequently forget that the implicit epilogue frees all their automatic storage. I agree. I meant to be discussing the work of educating such beginners.

Ouch now I am completely lost. The view of your post that I saw that said you spoke of this code as invalid was:

---

formatting link

From: CBFalc> ... snip ...

How can you compare translations of invalid source?

--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
     USE worldnet address!
Reply to
Pat LaVarre

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.