[Bug fortran/50360] New: [cleanup] use an ENUM for the return values of gfc_dep_compare_expr
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 11 20:43:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50360
Bug #: 50360
Summary: [cleanup] use an ENUM for the return values of
gfc_dep_compare_expr
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: janus@gcc.gnu.org
CC: burnus@gcc.gnu.org, tkoenig@gcc.gnu.org
gfc_dep_compare_expr currently has five possible return values:
* +1 if e1 > e2
* 0 if e1 == e2
* -1 if e1 < e2
* -2 if the relationship could not be determined
* -3 if e1 /= e2, but we cannot tell which one is larger.
Tobias notes in http://gcc.gnu.org/ml/fortran/2011-08/msg00159.html:
"Besides that issue, I am wondering whether we shouldn't start to use an ENUM
for those. I think for "<" vs. "==" vs. ">" one can use a number (-1, 0, 1) and
then compare the result against 0 (>0, == 0 etc.).
However, for 5 values, I think it makes sense to do something else otherwise,
someone write "... < 0" which not only matches -1 but also -2 or -3."
Thomas adds in http://gcc.gnu.org/ml/fortran/2011-08/msg00167.html:
"If we really wanted to do this The Right Way, there would be seven
cases to be considered, best expressed as three flags. I'll call them
CAN_BE_LESS, CAN_BE_EQUAL and CAN_BE_MORE ..."
More information about the Gcc-bugs
mailing list