This is the mail archive of the 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: [PATCH] pointer to integer conversion.

On Sat, Nov 23, 2013 at 4:38 AM, Iain Buclaw <> wrote:
> OK, I've checked that document, and there's also a comment with it.
> Apparently someone spotted this before.
> @c ??? We've always claimed that pointers were unsigned entities.
> @c Shouldn't we therefore be doing zero-extension?  If so, the bug
> @c is in convert_to_integer, where we call type_for_size and request
> @c a signed integral type.  On the other hand, it might be most useful
> @c for the target if we extend according to POINTERS_EXTEND_UNSIGNED.
> So where does this leave languages that say that pointer to integer
> conversions are clearly defined?

The language frontend needs to do the right thing.  In this case it
looks like the right thing is to convert the integer to the language
equivalent of uintptr_t before converting it to a pointer type.

Other than possibly from the frontend function convert, a language
frontend really has no business calling convert_to_integer at all.
The function implements C semantics.  And the whole business of the
middle-end calling the frontend function convert is broken anyhow.


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