[Patch, Fortran] PR 85088: improve diagnostic for bad INTENT declaration

Janus Weil janus@gcc.gnu.org
Sun Jun 10 07:03:00 GMT 2018


Hi Thomas,

> I like what the patch does. However, I have one concern.
>
>>      * decl.c (match_attr_spec): Synchronize the DECL_* enum values with
>> the
>>      INTENT_* values from the enum 'sym_intent'.
>
>
> This part
>
> +  { GFC_DECL_BEGIN = 0, DECL_ALLOCATABLE = GFC_DECL_BEGIN,
> +    DECL_IN = INTENT_IN, DECL_OUT = INTENT_OUT, DECL_INOUT = INTENT_INOUT,
> +    DECL_DIMENSION, DECL_EXTERNAL,
> +    DECL_INTRINSIC, DECL_OPTIONAL,
>
> brings a dependency of the values of sym_intent into this enum.
>
> I know that the order of sym_intent is not likely to change, but I would
> still prefer if you could add a comment to the sym_intent definition in
> gfortran.h noting that INTENT_IN cannot be zero, and add a
>
> gcc_assert (INTENT_IN > 0);
>
> somewhere (which will be optimized away) with an explanatory comment.

good point. I have added the assert and some comments. Updated patch attached.


> OK with that change.

Thanks. I'm doing another regtest now and will commit if that goes well ...

Cheers,
Janus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr85088_v2.diff
Type: text/x-patch
Size: 2203 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180610/34b6b709/attachment.bin>


More information about the Gcc-patches mailing list