On Mar 6, 2012, at 6:34 PM, Joseph S. Myers wrote:

> On Tue, 6 Mar 2012, Tristan Gingold wrote:
>> The patch is simple: the C front-end will now calls c_build_pointer_type 
>> (instead of build_pointer_type), which in turn calls 
>> build_pointer_type_for_mode using the right mode.
> There seem to be quite a lot of build_pointer_type calls in the C front 
> end (and in c-common.c) that you haven't changed.  Could you explain the 
> rule for when a call should or should not be changed, and how it applies 
> to all these calls?

The global approach is to have the same effect as a default 
__attribute__((mode(SI/DImode))) on pointers declared by users so that layouts 
match.  That's why only grokdeclarator is changed.

There might be bugs with this approach (e.g. it looks like 
c-common.c:handle_noreturn_attribute doesn't preserve the mode of the pointer 
to function), but my understanding is that they also correspond to bugs of 
__attribute__((mode ())) applied to pointer.  The later one isn't well tested 
and one advantage of the VMS port is that it will test it much more (as there 
are many pragma pointer_size in VMS headers).

I haven't tried to exactly follow the DEC-C rules, because:
- they aren't formally written
- the current behavior of the front and middle end is already correct

I agree that it is possible to concoct tests (e.g. using sizeof) that will 
return different results between gcc and DEC-C, but my purpose is to be 
reasonable compatible, not fully compatible.  There are some features (such as 
supporting VAX float) that I don't plan to implement :-)


Reply via email to