-qinfo

Category

Error checking and debugging

@PROCESS

None.

Purpose

Produces or suppresses groups of informational messages.

The messages are written to standard output and, optionally, to the listing file if one is generated.

Syntax

Read syntax diagramSkip visual syntax diagram
Option syntax

>>- -q--+-noinfo---------------------------------+-------------><
        '-info--+------------------------------+-'   
                |    .-:---------------------. |     
                |    V                       | |     
                '-=----+-all---------------+-+-'     
                       +-noall-------------+         
                       +-HOSTASSOCiation---+         
                       +-NOHOSTASSOCiation-+         
                       +-mt----------------+         
                       +-nomt--------------+         
                       +-stp---------------+         
                       +-nostp-------------+         
                       +-unset-------------+         
                       '-nounset-----------'         

@PROCESS:

@PROCESS INFO[(suboptions)] | NOINFO

Defaults

-qnoinfo

Parameters

all
Enables diagnostic messages for all groups except mt.
noall (option only)
Disables all diagnostic messages for all groups.
mt | nomt

Reports potential synchronization issues in parallel code. This suboption detects the Global Thread Flag pattern where one thread uses a shared volatile flag variable to notify other threads that it has completed a computation and stored its result to memory. Other threads check the flag variable in a loop that does not change the flag variable. When the value of the flag variable changes, the waiting threads access the computation result from memory. The PowerPC® storage model requires synchronization before the flag variable is set in the first thread, and after the flag variable is checked in the waiting threads. Synchronization can be done by the LIGHT_SYNC or ISYNC directive.

The type of synchronization directives you need to use depends on your code. Usually, it is enough to use the LIGHT_SYNC directive, as it preserves the storage access order to system memory. However, if the loops in the waiting threads are written in such a way that might cause instruction prefetching to start executing code that accesses the computation result before the flag variable is updated, you need to use the ISYNC directive to preserve order. Such patterns are typically as follows:
10 CALL sleep_(value)   
   IF (.NOT. flag) GOTO 10   
   ! The SYNC directive is needed here.   
   x = shared_computation_result

Some patterns that do not require synchronization are similar to the patterns described above. The messages generated by this suboption are only suggestions about potential synchronization issues.

To use the -qinfo=mt suboption, you must enable the -qthreaded option and specify at least one of the following options:
  • -O3
  • -O4
  • -O5
  • -qipa
  • -qhot
  • -qsmp

The default option is -qinfo=nomt.

HOSTASSOCiation | NOHOSTASSOCiation
Issues an information message for an entity that is accessed by host association for the first time. However, if the entity is accessed by an IMPORT statement, no information message is issued.
You can use -qinfo=all / noall to control whether to enable the -qinfo=HOSTASSOCiation option. The default option is -qinfo=NOHOSTASSOCiation.
stp | nostp
Issues warnings for procedures that are not protected against stack corruption. -qinfo=stp has no effects unless the -qstackprotect option is also enabled. Like other -qinfo options, -qinfo=stp is enabled or disabled through -qinfo=all / noall. -qinfo=nostp is the default option.
unset | nounset
Detects automatic variables that are used before they are set, and flags them with informational messages at compile time.

-qinfo=unset uses program information, such as control flow information, available during optimization. As a result, detection accuracy improves with the optimization level. For example, some uses of unset variables that are not flagged at -O0 are flagged at -O2. Aggressive optimization levels, such as -O4 and -O5, can cause the line numbers in the informational messages to become inaccurate. In very rare cases, these optimization levels reorder the program sufficiently to cause false positive messages from static analysis. You can get the best results with the -O2 optimization level.

The -qinitauto option initializes automatic variables. As a result, the -qinitauto option hides variables that are used before they are set from the -qinfo=unset option.

The -qsave option changes the storage class of automatic variables to STATIC. As a result, the -qsave option hides variables that are used before they are set from the -qinfo=unset option.

Usage

Specifying -qinfo with no suboptions is equivalent to -qinfo=all.

Specifying -qnoinfo is equivalent to -qinfo=noall.

Examples

To compile a program to produce informational messages about stack protection, enter the following command:
xlf90 myprogram.f -qinfo=stp -qstackprotect
To compile t.f to produce informational messages about host-associated variables, enter the following command:
xlf2008 t.f -qinfo=HOSTASSOCiation 
Suppose that t.f contains the following code:
PROGRAM p
  IMPLICIT none 

  INTEGER :: var 

  var = 3
  CALL sub()

  CONTAINS
    SUBROUTINE sub()
      PRINT *, var ! The compiler issues an information message when entity 'var' is
                   ! accessed by host association for the first time.

      PRINT *, var ! No message is issued here. 
    END
    
    INTEGER FUNCTION func() 
      func = var   ! Entity 'var' is in a different scope. The compiler issues an
                   ! information message when the entity is accessed by host association
                   ! for the first time in each scope.

    END
END
The compiler issues the following information messages:
"t.f", line 11.20: 1521-004 (I) Entity var is accessed by host association.
"t.f", line 16.18: 1521-004 (I) Entity var is accessed by host association.
To compile sync.f to produce informational messages about potential synchronization issues in parallel code, enter the following command:
xlf95_r -qinfo=mt -O3 sync.f
Suppose that sync.f contains the following code:
MODULE m
  IMPLICIT NONE
  LOGICAL, VOLATILE :: done    ! shared flag
  INTEGER, VOLATILE :: shared_result
CONTAINS 
  SUBROUTINE setter(id)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: id

    CALL sleep_(5)
    shared_result = 7
    ! !ibm* light_sync
    done = .TRUE.              ! line 13
  END SUBROUTINE

  SUBROUTINE waiter(id)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: id

    DO WHILE (.NOT. done)
      CALL sleep_(1)
    END DO                     ! line 22
    ! !ibm* light_sync
    PRINT *, shared_result
  END SUBROUTINE
END MODULE

PROGRAM MAIN
  USE m, ONLY: waiter, setter
  USE f_pthread
  IMPLICIT NONE

  TYPE(f_pthread_t) threads(2)
  TYPE(f_pthread_attr_t) attr
  INTEGER(4) flag, result

  ! Initialization
  result = f_pthread_attr_init(attr)
  IF (result /= 0) ERROR STOP 1
  flag = FLAG_DEFAULT

  ! Create threads
  result = f_pthread_create(threads(1), attr, flag, waiter, 1)
  IF (result /= 0) ERROR STOP 2

  result = f_pthread_create(threads(2), attr, flag, setter, 2)
  IF (result /= 0) ERROR STOP 3

  result = f_pthread_join(threads(1))
  result = f_pthread_join(threads(2))
END PROGRAM
The compiler issues the following informational message:
** m === End of Compilation 1 ===
** main === End of Compilation 2 ===

1586-669 (I) "sync.f", line 22: If this loop is used as a synchronization
point, additional synchronization via a directive or built-in function might
be needed.

1586-670 (I) "sync.f", line 13: If this statement is used as a synchronization
point, additional synchronization via a directive or built-in function might
be needed.

1501-510 Compilation successful for file sync.f.
The following function factorial.f does not initialize temp when n<=1. factorial.f also accesses result before it is set when n>1. With -qinfo=unset at -qnoopt, this issue is not detected. To compile factorial.f to produce informational messages about the uninitialized variables, enter the following command:
xlf95 -qinfo=unset -O factorial.f
factorial.f contains the following code:
module m
contains
  recursive function factorial(n) result(result)
    integer, value :: n
    integer result, temp

    if (n > 1) then
      temp = n * factorial(n - 1)
      print *, result ! line 9
    endif
 
    result = temp ! line 12
  end function
end module
 
use m
integer x
x = factorial(1)
end
The compiler issues the following informational messages:
1500-098 (I) "factorial.f", line 9: "result" is used before it is set.
1500-099 (I) "factorial.f", line 12: "temp" might be used before it is set.
1501-510  Compilation successful for file factorial.f.

Related information