forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Weird warning messages when compiling for .NET

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Thu Dec 27, 2007 12:09 am    Post subject: Weird warning messages when compiling for .NET Reply with quote

I have some codes that compile with no problem for Win32 but when I try compiling them for .NET I get warning messages like the following.

WARNING Variable _Alternate_address_of_XF_ has been declared but not used

What could this message mean? I have a variable called xf (actually a structure) but there is no variable called _Alternate_address_of_XF_.

Later there is another warning,

WARNING Variable _Alternate_address_of_XF_ has been used without being given an initial value

…and then an error.

ERROR Internal compiler error

What on earth can these messages mean? I’ve tried compiling for SDK 1.1 and 2.0 but it makes no difference.

Keith
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Thu Dec 27, 2007 10:02 am    Post subject: Reply with quote

This message amounts to a compiler bug.

The variable has been added as a temporary by the compiler so it ought not to complain that it has not been used!

Please post a sample of code that illustrates this message when compiled so that we can fix the bug.
Back to top
View user's profile Send private message AIM Address
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Fri Dec 28, 2007 11:41 am    Post subject: Reply with quote

Paul

Here is the code stripped down to the minimum that still demonstrates the warning message. The original code had more module dependencies and generates a series of such warning messages and compilation eventually fails with the aforementioned error message.

Keith


[code:1:e7186f593d]! ----------------------------------------------------------------------
! FILE BG_DOC.F90
!
! ----------------------------------------------------------------

MODULE WX_Document

USE WX_Buff, ONLY: buffer_t, &
Buff_toStr

IMPLICIT NONE
SAVE

PRIVATE

INTEGER(KIND=SELECTED_INT_KIND(9)), &
PARAMETER :: long = SELECTED_INT_KIND(9)


INTEGER(KIND=long), PARAMETER :: XML_ERRMESS_LEN = 100

CHARACTER(LEN=2), PARAMETER :: EndOfLine = ACHAR(13) // ACHAR(10)

TYPE :: XmlError_t
INTEGER(KIND=long) :: id = 0 ! Message integer identifier
CHARACTER(LEN=XML_ERRMESS_LEN) :: str = '' ! Message character string
END TYPE

TYPE :: XmlDoc_t
PRIVATE
LOGICAL :: documentIsOpen = .FALSE.
LOGICAL :: error = .FALSE.

TYPE(XmlError_t) :: errMess = XmlError_t(0, '')
TYPE(buffer_t) :: buffer

END TYPE

INTERFACE Xml_Close
MODULE PROCEDURE Xml_CloseToChan, &
Xml_CloseToChar
END INTERFACE

CONTAINS

!----------------------------------------------------------------
SUBROUTINE Xml_CloseToChan (xf, lunit, error)
TYPE(xmlDoc_t), INTENT(INOUT) :: xf
INTEGER(KIND=long), INTENT(IN) :: lunit
LOGICAL, OPTIONAL, INTENT(OUT) :: error

INTEGER(KIND=long) :: ios
CHARACTER(LEN=XML_ERRMESS_LEN + 10) :: errorString

IF (xf%error) THEN
errorString = '0222, Some message goes here'
WRITE(lunit, '(A)', IOSTAT=ios) Buff_toStr(xf%buffer) // EndOfLine &
// TRIM(errorString)
ELSE
WRITE(lunit, '(A)', IOSTAT=ios) Buff_toStr(xf%buffer)
ENDIF

IF (ios /= 0) xf%error = .TRUE.

IF (PRESENT(error)) error = xf%error

xf%documentIsOpen = .FALSE.

END SUBROUTINE

! --------------------------------------------
SUBROUTINE Xml_CloseToChar (xf, sOut, error)
TYPE(xmlDoc_t), INTENT(INOUT) :: xf
CHARACTER(LEN=*), INTENT(INOUT) :: sOut
LOGICAL, OPTIONAL, INTENT(OUT) :: error

CHARACTER(LEN=XML_ERRMESS_LEN + 10) :: errorString

IF (xf%error) THEN
errorString = '0333, Some message goes here'
sOut = Buff_toStr(xf%buffer) // EndOfLine &
// TRIM(errorString)
ELSE
sOut = Buff_toStr(xf%buffer)
ENDIF

IF (PRESENT(error)) error = xf%error

xf%documentIsOpen = .FALSE.

END SUBROUTINE

!-------------------------------------------------------------------


END MODULE

! ==================================================================

! ----------------------------------------------------------------------
! FILE BG_BUFF.F90
!
!
! ----------------------------------------------------------------

MODULE WX_Buff

IMPLICIT NONE
PRIVATE

INTEGER(KIND=SELECTED_INT_KIND(9)), &
PARAMETER :: long = SELECTED_INT_KIND(9)

INTEGER(KIND=long), PARAMETER :: MAX_BUFF_SIZE = 1048576

TYPE :
Back to top
View user's profile Send private message
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Fri Dec 28, 2007 11:52 am    Post subject: Reply with quote

Drat – it hasn’t posted properly. It looked ok in Preview! Let's try separate modules.

Code:
! ----------------------------------------------------------------------
! FILE BG_DOC.F90
!
! ----------------------------------------------------------------

MODULE WX_Document

  USE WX_Buff,       ONLY: buffer_t,       &
                           Buff_toStr

  IMPLICIT NONE
  SAVE

  PRIVATE

  INTEGER(KIND=SELECTED_INT_KIND(9)), &
                      PARAMETER :: long   = SELECTED_INT_KIND(9)


  INTEGER(KIND=long), PARAMETER :: XML_ERRMESS_LEN = 100

  CHARACTER(LEN=2),   PARAMETER :: EndOfLine = ACHAR(13) // ACHAR(10)

  TYPE :: XmlError_t
    INTEGER(KIND=long)             :: id  = 0       ! Message integer identifier
    CHARACTER(LEN=XML_ERRMESS_LEN) :: str = ''      ! Message character string
  END TYPE

  TYPE :: XmlDoc_t
    PRIVATE
    LOGICAL                    :: documentIsOpen       = .FALSE.
    LOGICAL                    :: error                = .FALSE.

    TYPE(XmlError_t)           :: errMess              = XmlError_t(0, '')
    TYPE(buffer_t)             :: buffer

  END TYPE

  INTERFACE Xml_Close
    MODULE PROCEDURE Xml_CloseToChan, &
                     Xml_CloseToChar
  END INTERFACE

CONTAINS

!----------------------------------------------------------------
  SUBROUTINE Xml_CloseToChan (xf, lunit, error)
    TYPE(xmlDoc_t),     INTENT(INOUT) :: xf
    INTEGER(KIND=long), INTENT(IN)    :: lunit
    LOGICAL, OPTIONAL,  INTENT(OUT)   :: error

    INTEGER(KIND=long)                  :: ios
    CHARACTER(LEN=XML_ERRMESS_LEN + 10) :: errorString

    IF (xf%error) THEN
      errorString = '0222, Some message goes here'
      WRITE(lunit, '(A)', IOSTAT=ios) Buff_toStr(xf%buffer) // EndOfLine &
                                                            // TRIM(errorString)
    ELSE
      WRITE(lunit, '(A)', IOSTAT=ios) Buff_toStr(xf%buffer)
    ENDIF

    IF (ios /= 0) xf%error = .TRUE.

    IF (PRESENT(error)) error = xf%error

    xf%documentIsOpen = .FALSE.

  END SUBROUTINE

! --------------------------------------------
  SUBROUTINE Xml_CloseToChar (xf, sOut, error)
    TYPE(xmlDoc_t),    INTENT(INOUT) :: xf
    CHARACTER(LEN=*),  INTENT(INOUT) :: sOut
    LOGICAL, OPTIONAL, INTENT(OUT)   :: error

    CHARACTER(LEN=XML_ERRMESS_LEN + 10) :: errorString

    IF (xf%error) THEN
      errorString = '0333, Some message goes here'
      sOut = Buff_toStr(xf%buffer) // EndOfLine &
                                   // TRIM(errorString)
    ELSE
      sOut = Buff_toStr(xf%buffer)
    ENDIF

    IF (PRESENT(error)) error = xf%error

    xf%documentIsOpen = .FALSE.

  END SUBROUTINE

!-------------------------------------------------------------------


END MODULE

! ==================================================================
Back to top
View user's profile Send private message
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Fri Dec 28, 2007 2:21 pm    Post subject: Reply with quote

(Continue)

Code:
! ----------------------------------------------------------------------
! FILE BG_BUFF.F90
!
!
! ----------------------------------------------------------------

MODULE WX_Buff

  IMPLICIT NONE
  PRIVATE

  INTEGER(KIND=SELECTED_INT_KIND(9)), &
                      PARAMETER :: long   = SELECTED_INT_KIND(9)

  INTEGER(KIND=long), PARAMETER :: MAX_BUFF_SIZE = 1048576

  TYPE :: buffer_t
    PRIVATE
    INTEGER(KIND=long)           :: size = 0
    CHARACTER(LEN=MAX_BUFF_SIZE) :: str  = ''
  END TYPE

  PUBLIC buffer_t,   &
         Buff_toStr


CONTAINS


!----------------------------------------------------------------
! Returns current contents of buffer as a string.
!
  FUNCTION Buff_toStr (buffer) result(str)
    TYPE(buffer_t), INTENT(IN) :: buffer
    CHARACTER(LEN=buffer%size) :: str

    str = buffer%str(1: buffer%size)
  END FUNCTION

!----------------------------------------------------------------


END MODULE

!===================================================================
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group