This is the mail archive of the gcc@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: Hack in gcc/c-decl.c?


Mike Stump <mrs@apple.com> writes:

| On Dec 29, 2005, at 11:32 AM, Gabriel Dos Reis wrote:
| > I believe, but I'm not sure, that GCC is using type puning not
| > guaranteed to work (except "common sense" from "obvious model".)
| 
| I think the C family of language standards should think about the
| issue and clarify their exact intent...

I completely agree.

|  I know C at least was kinda
| inadequate from my perspective.
| 
| > I guess we just have to wait till GCC is miscompiled (probably by
| > itself) to see whether the Middle End would cite chapter and verse :-)

I suspect that humor does not travel well through emails :-)  Sorry.

| Or, we can talk about it first.  I'd prefer that we talk though the
| corner cases instead of just assuming and putting them in.  I'd argue
| that we should enhance the manual with the corner cases so as to
| guide the language standard into making the `right' decision.
| 
| In this area, I don't think we do anything unfriendly.  What was your
| concern?
| 
| I see we make use of
| 
| struct S { int first; } s;
| 
| &s == &s.first,

this is guaranteed to work.

| and we upcast and down cast via pointer arithmetic,

It is also defined to upcast and downcast to the first fields.  

I was under the impression that we got some core language issues with
pointer arithmetic that will poke at the middle of the structure,
where reasonable people (well respected regular GCC contributors)
disagreed about whether it is well-defined.  

| and we assume we can change type when a pointer has the right value,
| none of these run afoul of what gcc does afaik.

Indeed.

-- Gaby


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