Silverfrost Forums

Welcome to our forums

Access violation with Character assignment

23 Apr 2021 8:58 #27608

The following code example provides an access viloation error on execution when compiled with [color=red:052a04c8a7]ftn95 /64 /check[/color:052a04c8a7] and linked with [color=red:052a04c8a7]slink64[/color:052a04c8a7] With [color=red:052a04c8a7]/-check[/color:052a04c8a7] it works well. With [color=red:052a04c8a7]/-64[/color:052a04c8a7] and [color=red:052a04c8a7]slink[/color:052a04c8a7] it's also ok.

Program WTPD12
Implicit None

Character (LEN=16), External :: WTPB03
Character (LEN=16)           :: BEZE(20)
Integer                      :: ANZE, MSTAT

ANZE       = 1
MSTAT      = 1234
BEZE(ANZE) = WTPB03(MSTAT)

END

Character *16 Function WTPB03 (MSTAT)
Implicit None
Integer :: MSTAT
if (mstat > 0) then
   WTPB03 = 'x'
else
   WTPB03 = 'y'
endif
END

The code example is a simplification of a complex program system. Further simplification to

Program WTPD11
Implicit None

Character (LEN=16), External :: WTPB03
Character (LEN=16)           :: BEZE(20)
Integer                      :: ANZE

ANZE       = 1
BEZE(ANZE) = WTPB03()

END

Character *16 Function WTPB03()
Implicit None
WTPB03 = 'x'
END

leads to a 'internal compiler error', when [color=red:052a04c8a7]/64[/color:052a04c8a7] is used and which not occurs with [color=red:052a04c8a7]/-64[/color:052a04c8a7].

I'm using ftn95 version 8.71.0.0.

23 Apr 2021 9:21 #27609

Thomas

Thank you for the feedback. I have made a note to check this out.

23 Apr 2021 5:40 #27619

The '-' overrules the default or the individual settings in the configuration.

With
[color=red:3628ab42fd]ftn95 /config[/color:3628ab42fd] you can define your individual FTN95 global configuration.

Regardless of these settings you can switch individual setting on [color=red:3628ab42fd]/option[/color:3628ab42fd] or off [color=red:3628ab42fd]/-option[/color:3628ab42fd].

I made use of this to clearly indicate which options were used during my compilation.

The 'FTN95' in the Windows start menu gives the following advice:

ftn95 /config[/color:3628ab42fd] you can define your individual FTN95 global configuration.

Regardless of these settings you can switch individual setting on [color=red:3628ab42fd]/option[/color:3628ab42fd] or off [color=red:3628ab42fd]/-option[/color:3628ab42fd].

I made use of this to clearly indicate which options were used during my compilation.

The 'FTN95' in the Windows start menu gives the following advice: [quote:3628ab42fd]Many of the options have a corresponding opposite. For example /-INTL is the opposite of /INTL. If the default setting is changed by using the /CONFIG dialog, then there are occasions when you may wish to use the opposite option in order to temporarily restore the original default. The dialog indicates which options can be configured and hence have an opposite.

26 Apr 2021 8:06 #27627

John-Silver,

concerning the docu with respect to the - sign in a ftn95 option: you may use command

ftn95 /?

in a DOS command window to see the following information at the end of the online help displayed:

   To reset a configured option, precede the option name with '-', e.g.
       ftn95 file.f90 /-iso
   This will switch off the /ISO option, if it was currently switched
   on with one of the configuration methods.

Unfortunately I could **not **find this information in the online help window, section 'Compiler Options' (using e.g. command ftn95 --help 😦.

Regards, Dietmar

26 Apr 2021 8:16 #27628

You can find the hint in the last paragraph at [color=blue:661a53c73f]Compiler options on a command line[/color:661a53c73f] as sub-section of [color=blue:661a53c73f]Compiler options[/color:661a53c73f] in the Help for FTN95 menu item for FTN95 in Windows.

28 Apr 2021 1:10 #27651

This failure has now been fixed for the next release of FTN95.

Please login to reply.