diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 97dbe6bfdf2821228fdd8ee7fa4f7cc2a648a947..258225aa5c15f96c9f9b5be2ab245b78cdc6297e 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -5907,7 +5907,7 @@ num_value:      scalar
                   location_set(@1);
                   $$ = new cbl_refer_t( new_tempnumeric() );
                   auto r1 = $val;
-                  if( ! dialect_ibm() ) {
+                  if( dialect_gcc() ) {
                     yyerrorv("LENGTH OF %s requires '-dialect ibm' option",
                              $val->field->name);
                   }
@@ -6096,7 +6096,7 @@ signed_literal:     num_literal
                   location_set(@1);
                   $$ = new_tempnumeric();
                   auto r1 = $val;
-                  if( ! dialect_ibm() ) {
+                  if( dialect_gcc() ) {
                     yyerrorv("LENGTH OF %s requires '-dialect ibm' option",
                              $val->field->name);
                   }
@@ -6477,7 +6477,7 @@ varg1:          scalar
                   location_set(@1);
                   $$ = new cbl_refer_t( new_tempnumeric_float() );
                   auto r1 = $val;
-                  if( ! dialect_ibm() ) {
+                  if( dialect_gcc() ) {
                     yyerrorv("LENGTH OF %s requires '-dialect ibm' option",
                              $val->field->name);
                   }