RFD: improved diagnostics when reading module files
Harald Anlauf
anlauf@gmx.de
Sun Apr 15 19:21:00 GMT 2018
Since the deadline for gcc-8 is approaching, I've attached the
patch to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85407
so that it doesn't get lost.
On 04/07/18 18:45, Steve Kargl wrote:
> On Sat, Apr 07, 2018 at 06:15:41PM +0200, Harald Anlauf wrote:
>> Steve,
>>
>> On 04/07/18 01:59, Steve Kargl wrote:
>>> On Fri, Apr 06, 2018 at 11:17:58PM +0200, Harald Anlauf wrote:
>>>> With the change above, I now get:
>>>>
>>>> ../../../../analysis/mo_ir_emis.f90:61:6:
>>>>
>>>> use mo_dec_matrix, only: t_vector ! decomposed vector
>>>> 1
>>>> Error: Mismatch in derived type components of 't_par_grib2' from
>>>> 'mo_grib12_dwd' at (1): 'modnum' != 'shortname'
>>>
>>> Yes, I think it is useful. An assert() gives an ICE, which is
>>> not useful in this situation. A slight better error message
>>> might be
>>>
>>> Error: Mismatch in components of derived type 't_par_grib2' from
>>> module 'mo_grib12_dwd' at (1) (expecting 'modnum', but got 'shortname')
>>>
>>> You may want to let others way.
>
> Whoops. Multitasking at work.
>
> "Let others weigh in."
>
>> I'm not sure what you meant here, but here's an improved version that
>> prints only one error on the first mismatch. It uses gfc_fatal_error
>> instead of gfc_error_now and is probably less confusing:
>>
>
> (patch looks good to me)
>
>> use mod2
>> 1
>> Fatal Error: Mismatch in components of derived type 'x' from 'mod1' at
>> (1): expecting 'z', but got 'q'
>> compilation terminated.
>>
>> which I think is probably good enough.
>
> Agreed. A user should be able to find to problem now.
>
>>
>>> BTW, do you have commit privileges for the subversion repository?
>>
>> No. But if you like, you could commit it e.g. with the following changelog:
>>
>> 2018-04-07 Harald Anlauf <anlauf@gmx.de>,
>> Steven G. Kargl <kargl@gcc.gnu.org>
>>
>> * module.c (read_module): Replace assert by error message on
>> mismatch of components of derived type.
>
> I'll commit it. But, would like the ability to directly commit
> your fixes? (My not so subtle hint that we could use additional
> help. :-)
>
More information about the Fortran
mailing list