Re: [PATCH] C undefined behavior fix

mike stump
2002-01-07T19:20:29Z

> From: dewar@gnat.com
> To: dewar@gnat.com, guerby@acm.org, mrs@windriver.com
> Date: Sun, 6 Jan 2002 14:32:01 -0500 (EST)

> Ah ha! But then look again at my 16-bit example, an expert assembly
> langauge programmer will use a 32 bit load if efficiency is not an
> issue (and it does not matter if there are extra bits around), but a
> 16-bit load if the hardware for some reason requires it. How is the
> poort C compiler to distinguish these cases automatically?

When you give the compiler as much information to it as your expert
apparently has, then it will produce the same code, until then,
imagine you told you expert that you want to do a 16 bit fetch for
something that might care if it were not a 16 bit access... If you so
tie your experts hands, as you tie gcc hands, then should produce
similar code.

Now, if you want to invent gcc extensions so that it can know as much
as a domain expert, start proposing those language extensions...