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

Thomas Koenig tkoenig@netcologne.de
Sat Jun 9 12:13:00 GMT 2018


Hi Janus,

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.

OK with that change.

Thanks for the patch!

	Thomas



More information about the Gcc-patches mailing list