[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] Re: possibly bug: Compare: numeric (USAGE COMP .
From: |
Keisuke Nishida |
Subject: |
Re: [open-cobol-list] Re: possibly bug: Compare: numeric (USAGE COMP ...) with alphanumeric |
Date: |
Tue May 18 06:49:02 2004 |
User-agent: |
Wanderlust/2.10.0 (Venus) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (UnebigoryĆmae) APEL/10.3 Emacs/21.3 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) |
At Mon, 17 May 2004 16:33:42 +0200,
Thomas Biehler wrote:
>
> But i believe that allowing the "critical compare":
> "NON - USAGE DISPLAY" numeric and alphanumeric
> is NOT ANSI 1985 or ISO 2002 conform!
Oh, you are right. We need another config option here..
> So far i unterstand the compiler-source, the error reporting here is not
> trivial to implement.
Actually this is trivial. Try this patch:
--- typeck.c.~1.84.~ 2004-05-15 19:11:02.000000000 +0900
+++ typeck.c 2004-05-18 22:28:08.000000000 +0900
@@ -1235,6 +1235,18 @@
}
else
{
+ if ((CB_TREE_CLASS (p->x) == CB_CLASS_NUMERIC
+ && CB_REFERENCE_P (p->x)
+ && CB_FIELD (cb_ref (p->x))->usage != CB_USAGE_DISPLAY
+ && (CB_TREE_CLASS (p->y) == CB_CLASS_ALPHABETIC
+ || CB_TREE_CLASS (p->y) == CB_CLASS_ALPHANUMERIC))
+ || (CB_TREE_CLASS (p->y) == CB_CLASS_NUMERIC
+ && CB_REFERENCE_P (p->y)
+ && CB_FIELD (cb_ref (p->y))->usage != CB_USAGE_DISPLAY
+ && (CB_TREE_CLASS (p->x) == CB_CLASS_ALPHABETIC
+ || CB_TREE_CLASS (p->x) == CB_CLASS_ALPHANUMERIC)))
+ cb_error_x (p->x, "nonnumeric item cannot be compared with "
+ "numeric item of usage non-DISPLAY");
if (cb_flag_runtime_inlining)
{
if (CB_LITERAL_P (p->y))
Currently there is no error check for comparison.
I'll implement better checks and test suite later.
Keisuke