HP C/aC++ for PA-RISC Software manual +check=truncateexplicitimplicit, +check=uninit

Models: C/aC++ for PA-RISC Software

1 230
Download 230 pages 50.97 Kb
Page 81
Image 81

Different threads non-concurrently wait on the same condition variable, but with different associated mutexes.

The threads terminate execution without unlocking the associated mutexes or read-write locks.

The thread waits on a condition variable for which the associated mutex is not locked.

The thread terminates execution, and the resources associated with the terminated thread continue to exist in the application because the thread has not been joined or detached.

The thread uses more than the specified percentage of the stack allocated to the thread.

The +check=thread option should only be used with multithreaded programs. It is not enabled by +check=all.

Users can change the behavior of the +check=thread option by providing their own rtcconfig file. The user specified rtcconfig file can be in the current directory or in a directory specified by the GDBRTC_CONFIG environment variable. The default configuration used by the +check=thread option is:

thread-check=1;recursive-relock=1;unlock-not-own=1; mix-sched-policy=1;cv-multiple-mxs=1;cv-wait-no-mx=1; thread-exit-own-mutex=1;thread-exit-no-join-detach=1;stack-util=80; num-waiters=0;frame_count=4;output_dir=.;

If any thread error condition is detected during the application run, the error log is output to a file in the current working directory. The output file will have the following naming convention:

<executable_name>.<pid>.threads

where <pid> is the process id.

+check=truncate[:explicit:implicit]

The +check=truncate[:explicit:implicit] option enables runtime checks to detect data loss in assignment when integral values are truncated. Data loss occurs if the truncated bits are not all the same as the left most non-truncated bit for signed type, or not all zero for unsigned type.

Programs might contain intentional truncation at runtime, such as when obtaining a hash value from a pointer or integer. To avoid runtime failures on these truncations, you can explicitly mask off the value:

ch = (int_val & 0xff);

Note that the +check=all option does not imply +check=truncate. To enable +check=truncate, you must explicitly specify it.

+check=truncate:explicit

This option turns on runtime checks for truncation on explicit user casts of integral values, such as (char)int_val.

+check=truncate:implicit

This option turns on runtime checks for truncation on compiler-generated implicit type conversions, such as ch = int_val;.

+check=truncate

This option turns on runtime checks for both explicit cast and implicit conversion truncation.

+check=uninit

The +check=uninit option checks for a use of a stack variable before it is defined. If such a use is detected, an error message is emitted and the program is aborted. The check is done by adding an internal flag variable to track the definition and use of user variables.

Runtime Checking Options

81

Page 81
Image 81
HP C/aC++ for PA-RISC Software +check=truncateexplicitimplicit, +check=uninit, Ch = intval & 0xff +check=truncateexplicit