Re: segmentation fault occurs when testing strings if one string has a _FillValue assigned but the other doesn't

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 19 2009 - 08:34:59 MDT

Jonathan,

This is certainly a problem.

At current, you may try to switch the order of your if statement,
instead of "if(stringA .ne. stringB) then",
try "if(stringB. ne. stringA) then", which will probably bypass your
current problem.

Thanks,

Wei Huang
huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Oct 17, 2009, at 11:01 PM, Jonathan Vigh wrote:

> Greetings,
> I'm getting an odd segmentation fault when I compare two strings
> if one string has a _FillValue assigned and the other one doesn't:
>
> stringA = "this"
> stringA@_FillValue
>
> stringB = "that"
>
> if (stringA .ne. stringB) then
> ... do stuff ...
> end if
>
> The segmentation fault occurs at the point of the test.
>
> Should I expect this behavior?
> I've attached a simple script that you can run to reproduce this.
>
> Jonathan
> begin
>
> stringA = (/"this"/)
> stringB = (/"that"/)
>
> print(stringA)
> print(stringB)
>
> if (stringA .ne. stringB) then
> print("first test: the strings differ")
> end if
>
> stringB@other_att = "this"
> stringB@_FillValue = "missing"
>
> print(stringA)
> print(stringB)
>
> if (stringA .ne. stringB) then
> print("second test: the strings differ")
> end if
>
> end
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 19 09:00:07 2009

This archive was generated by hypermail 2.1.8 : Fri Oct 23 2009 - 11:36:30 MDT