[gfortran] Fix NULL reference types.

Daniel Berlin dberlin@dberlin.org
Thu Aug 19 20:59:00 GMT 2004


On Aug 19, 2004, at 1:34 PM, Mark Mitchell wrote:

> Richard Kenner wrote:
>
>>    Kenner and I discussed this back in 1998:
>>
>>    http://gcc.gnu.org/ml/gcc-bugs/1998-07/msg00040.html
>>
>> I went back to that message.  You list four properties.  The latter 
>> two aren't
>> relevant for optimizers.
>>
>>  But the second is that it's never modified.
>> My feeling, though, is that REFERENCE_TYPE by itself shouldn't have 
>> that
>> property because we already have a way to represent something that's 
>> never
>> modified.
>>
>> That means that only difference is that REFERENCE_TYPE values cannot 
>> be
>> null while POINTER_TYPE values can be.  Does that seem right?
>>
> To me, yes.
>
> RTH's complaint about Fortran and debugging is interesting.  Although, 
> I don't think Fortran has a notion of "reference type" in the same way 
> that C++ does.  It might be that DWARF 2/3 already provides some way 
> of describing optional arguments that does not rely on their type 
> being REFERENCE_TYPE.  It might also be that we could adjust the 
> debug-generators to generate reference types even for optional 
> arguments.
>
> I suppose that we could provide the same information I wanted to 
> convey with REFERENCE_TYPE to the optimizer in some other way: a bit 
> on VAR_DECLs, PARM_DECLs, FIELD_DECLs, etc. that says "never NULL".
>
> I do think that we should find some way to give this information to 
> the optimizers.
>
When diego's assert_expr (range information) stuff goes in, you can 
always just add ASSERT_EXPRS at the beginning of the function for these 
variables, that says "!= 0"

The fact that the value is never 0 should be communicated to the 
optimizers the same way we will communicate other range information 
about variables.
--Dan
>



More information about the Gcc mailing list