[patch, Fortran] Fix some string temporaries
Mikael Morin
morin-mikael@orange.fr
Mon Jul 18 20:41:00 GMT 2016
Le 18/07/2016 à 22:20, Thomas Koenig a écrit :
> Am 18.07.2016 um 20:58 schrieb Mikael Morin:
>
>>> Unfortunately not. The original code (before I lifted out the
>>> functionality) sometimes had GFC_DEP_ERROR at the end of the
>>> function, which was then removed by
>>>
>>> return fin_dep == GFC_DEP_OVERLAP;
>>>
>> That is very strange, there is an assert just a few lines before, that
>> fin_dep != GFC_DEP_ERROR.
>
> This is not the only return statement.
>
> For example, look at
>
> @@ -2215,7 +2268,7 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gf
> /* Exactly matching and forward overlapping ranges don't cause a
> dependency. */
> if (fin_dep < GFC_DEP_BACKWARD)
> - return 0;
> + return fin_dep;
>
> A GFC_DEP_ERROR could 'escape' here.
>
Indeed, I missed that one.
Then handle the GFC_DEP_ERROR here. Or initialize fin_dep with
GFC_DEP_NODEP at the beginning, as you prefer.
OK with either (and the unreachable assertions).
Having an invalid enum value equals to zero helps diagnosing
uninitialized values, so I prefer keeping the GFC_DEP_ERROR value
separate from GFC_DEP_NODEP, GFC_DEP_NODEPFOUND, or any other case.
More information about the Fortran
mailing list