Silverfrost Forums

Welcome to our forums

Spockian illogicality

16 Jun 2023 3:06 #30391

Here's a little demonstrator:

      PROGRAM TEST
      LOGICAL LABSON, LEGON
      LABSON = .TRUE.
      LEGON  = .TRUE.
      write(*,*) LABSON, LEGON
      write(*,*) LABSON .AND. LEGON
      END

As might be expected, the output is T T on one line, and T on the next.

But, in my 4000+ line program that I wrote over 30 years ago, two consecutive write statements give me T T and then F, with the F thereby failing an IF statement on the next line.

Now, I cannot recall what on earth possessed me to use LOGICAL variables in the first place, as I almost never do (and swear that I'll never do again). Instead I think I'll go back to testing for 0 and 1 in an INTEGER.

Just 32 bit mode, and doesn't need a fix, as I'll never use LOGICAL ever again!

Dan's devilry no doubt.

Eddie

16 Jun 2023 10:30 #30392

I have had irreproducible issues when logicals were in COMMON and EQUIVALENCED. Especially if the logicals defaulted to LOGICAL2 in one context and LOGICAL4 in another context.

It was long ago, and the fix escapes me.

I wish I had documented my situation and posted it here.

17 Jun 2023 5:28 #30393

Eddie

Thanks for the feedback. Some issues can be difficult to track down.

18 Jun 2023 4:21 #30394

Aye, and especially difficult as it works in one place, and not in another!

Please login to reply.