00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifdef _KEEP_RCS_ID
00052
00053 #endif
00054
00055
00056
00057
00058
00059 #include "config_debug.h"
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 static DEBUG_FLAGS Default_DEBUG = {
00076 NULL,
00077
00078
00079 FALSE, FALSE,
00080 FALSE, FALSE,
00081 DIV_ZERO_CHECK, FALSE,
00082 FALSE, FALSE,
00083 NULL, FALSE,
00084 FALSE, FALSE,
00085 FALSE, FALSE,
00086 FALSE, FALSE,
00087 FALSE, FALSE,
00088 FALSE, FALSE,
00089 FALSE, FALSE,
00090 FALSE, FALSE,
00091 TRUE, FALSE,
00092 NULL, FALSE,
00093 FALSE, FALSE,
00094 FALSE, FALSE,
00095 FALSE, FALSE,
00096 FALSE, FALSE,
00097 FALSE, FALSE,
00098 FALSE, FALSE,
00099 FALSE, FALSE,
00100 TRUE, FALSE,
00101 TRUE, FALSE,
00102 FALSE, FALSE,
00103 NULL, FALSE,
00104 NULL, FALSE,
00105 TRUE,
00106 ALIGN_NORMAL,
00107 TRUE,
00108 FALSE, FALSE,
00109
00110 { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }
00111 };
00112
00113 DEBUG_FLAGS Initial_DEBUG = {
00114 NULL,
00115
00116
00117 FALSE, FALSE,
00118 FALSE, FALSE,
00119 DIV_ZERO_CHECK, FALSE,
00120 FALSE, FALSE,
00121 NULL, FALSE,
00122 FALSE, FALSE,
00123 FALSE, FALSE,
00124 FALSE, FALSE,
00125 FALSE, FALSE,
00126 FALSE, FALSE,
00127 FALSE, FALSE,
00128 FALSE, FALSE,
00129 TRUE, FALSE,
00130 NULL, FALSE,
00131 FALSE, FALSE,
00132 FALSE, FALSE,
00133 FALSE, FALSE,
00134 FALSE, FALSE,
00135 FALSE, FALSE,
00136 FALSE, FALSE,
00137 FALSE, FALSE,
00138 TRUE, FALSE,
00139 TRUE, FALSE,
00140 FALSE, FALSE,
00141 NULL, FALSE,
00142 NULL, FALSE,
00143 TRUE,
00144 ALIGN_NORMAL,
00145 TRUE,
00146 FALSE, FALSE,
00147
00148 { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }
00149 };
00150
00151 static char *Debug_Alignment_Name= NULL;
00152
00153 DEBUG_FLAGS *Current_DEBUG = &Initial_DEBUG;
00154
00155
00156
00157
00158
00159
00160 #define ID Initial_DEBUG
00161
00162 static OPTION_DESC Options_DEBUG[] = {
00163
00164 { OVK_BOOL, OV_INTERNAL, TRUE, "const_mod_warning", "",
00165 0, 0, 0, &ID.cmod_warn, &ID.cmod_warn_set,
00166 "Warn about attempts to store into a constant" },
00167
00168 { OVK_BOOL, OV_INTERNAL, TRUE, "cray_port", "",
00169 0, 0, 0, &ID.cray_port, &ID.cray_port_set,
00170 "Turn on all Cray porting options" },
00171
00172 { OVK_INT32, OV_VISIBLE, TRUE, "div_check", "",
00173 DEFAULT_DIV_CHECK, 0, 3, &ID.div_check, &ID.div_check_set,
00174 "Check for divide by zero and/or division overflow" },
00175
00176 { OVK_BOOL, OV_INTERNAL, TRUE, "equiv_warning", "",
00177 0, 0, 0, &ID.equiv_warn, &ID.equiv_warn_set,
00178 "Warn about EQUIVALENCE affected by 32- vs. 64-bit compilation" },
00179
00180 { OVK_LIST, OV_VISIBLE, TRUE, "error", "",
00181 0, 0, 0, &ID.error, &ID.error_set,
00182 "Convert given warning messages to errors" },
00183
00184 { OVK_BOOL, OV_VISIBLE, TRUE, "fullwarn", "",
00185 0, 0, 0, &ID.fullwarn, &ID.fullwarn_set,
00186 "Turn on all warning messages" },
00187
00188 { OVK_BOOL, OV_SHY, TRUE, "full_interface_check", "",
00189 0, 0, 0, &ID.full_iface_check, &ID.full_iface_check_set,
00190 "Check all subprogram call interfaces" },
00191
00192 { OVK_BOOL, OV_INTERNAL, TRUE, "int32_overflow_check", "",
00193 0, 0, 0, &ID.i32_oflow_check, &ID.i32_oflow_check_set,
00194 "Check 32-bit integer code for overflow" },
00195
00196 { OVK_BOOL, OV_INTERNAL, TRUE, "int_overflow_check", "",
00197 0, 0, 0, &ID.int_oflow_check, &ID.int_oflow_check_set,
00198 "Check all integer code for overflow" },
00199
00200 { OVK_BOOL, OV_INTERNAL, TRUE, "optimize_space", "",
00201 0, 0, 0, &ID.optimize_space, &ID.optimize_space_set,
00202 "Optimize debug space" },
00203
00204 { OVK_BOOL, OV_INTERNAL, TRUE, "parameter_alias_check", "",
00205 0, 0, 0, &ID.parm_alias_check, &ID.parm_alias_check_set,
00206 "Check Fortran subprogram parameters for aliasing" },
00207
00208 { OVK_BOOL, OV_INTERNAL, TRUE, "pointer_increment_warning", "",
00209 0, 0, 0, &ID.ptr_incr_warn, &ID.ptr_incr_warn_set,
00210 "Check increments of Fortran pointers against pointee size" },
00211
00212 { OVK_BOOL, OV_INTERNAL, TRUE, "printf_warning", "",
00213 0, 0, 0, &ID.printf_warn, &ID.printf_warn_set,
00214 "Check literal printf format strings against parameter types" },
00215
00216 { OVK_LIST, OV_VISIBLE, TRUE, "remark", "",
00217 0, 0, 0, &ID.remark, &ID.remark_set,
00218 "Convert given warning messages to remarks" },
00219
00220 { OVK_BOOL, OV_INTERNAL, TRUE, "shift_check", "",
00221 0, 0, 0, &ID.shift_check, &ID.shift_check_set,
00222 "Check for variable shift counts larger than object" },
00223
00224 { OVK_BOOL, OV_INTERNAL, TRUE, "shift_warning", "",
00225 0, 0, 0, &ID.shift_warn, &ID.shift_warn_set,
00226 "Warn about constant shift counts larger than object" },
00227
00228 { OVK_BOOL, OV_VISIBLE, TRUE, "subscript_check", "",
00229 0, 0, 0, &ID.subscript_check, &ID.subscript_check_set,
00230 "Check for subscripts out of range" },
00231
00232 { OVK_LIST, OV_VISIBLE, TRUE, "suppress", "",
00233 0, 0, 0, &ID.woff, &ID.woff_set,
00234 "Suppress given warning messages" },
00235
00236 { OVK_BOOL, OV_VISIBLE, TRUE, "trap_uninitialized", "",
00237 0, 0, 0, &ID.trap_uv, &ID.trap_uv_set,
00238 "Trap references to uninitialized variables" },
00239
00240 { OVK_BOOL, OV_INTERNAL, TRUE, "trapuv_right_justify", "",
00241 0, 0, 0, &ID.trap_uv_rjustify, &ID.trap_uv_rjustify_set,
00242 "" },
00243
00244 { OVK_BOOL, OV_INTERNAL, TRUE, "trunc_check", "",
00245 0, 0, 0, &ID.trunc_check, &ID.trunc_check_set,
00246 "Check 64- to 32-bit assignments for truncation" },
00247
00248 { OVK_BOOL, OV_INTERNAL, TRUE, "trunc_warning", "",
00249 0, 0, 0, &ID.trunc_warn, &ID.trunc_warn_set,
00250 "Warn about truncation on 64- to 32-bit assignments" },
00251
00252 { OVK_BOOL, OV_VISIBLE, TRUE, "varargs_interface_check", "",
00253 0, 0, 0, &ID.varargs_iface_check,&ID.varargs_iface_check_set,
00254 "Check interfaces on calls to varargs routines" },
00255
00256 { OVK_BOOL, OV_VISIBLE, TRUE, "varargs_prototypes", "",
00257 0, 0, 0, &ID.varargs_prototypes, &ID.varargs_prototypes_set,
00258 "Assume ANSI guarantee that varargs routines are prototyped" },
00259
00260 { OVK_BOOL, OV_VISIBLE, TRUE, "verbose_runtime", "",
00261 0, 0, 0, &ID.verbose_runtime, &ID.verbose_runtime_set,
00262 "Generate verbose messages for runtime errors" },
00263
00264 { OVK_LIST, OV_VISIBLE, TRUE, "warning", "",
00265 0, 0, 0, &ID.warning, &ID.warning_set,
00266 "Convert given messages to warnings" },
00267
00268 { OVK_LIST, OV_VISIBLE, TRUE, "woff", "",
00269 0, 0, 0, &ID.woff, &ID.woff_set,
00270 "Suppress given warning messages" },
00271
00272 { OVK_BOOL, OV_VISIBLE, TRUE, "ir_version_check", "",
00273 0, 0, 0, &ID.ir_version_check, NULL,
00274 "Check whether version of IR matches expected version" },
00275
00276 { OVK_NAME, OV_VISIBLE, TRUE, "alignment", "",
00277 0, 0, 0, &Debug_Alignment_Name, NULL,
00278 "Do unaligned load/stores either as normal, compose, or fixade" },
00279
00280 { OVK_BOOL, OV_VISIBLE, TRUE, "ipa_version_check", "",
00281 0, 0, 0, &ID.ipalno_version_check, NULL,
00282 "Check whether version of IPALNO matches expected version" },
00283
00284 { OVK_BOOL, OV_VISIBLE, TRUE, "conform_check", "",
00285 0, 0, 0, &ID.conform_check, &ID.conform_check_set,
00286 "Check for conforming array assignments" },
00287
00288
00289 { OVK_REPLACED, OV_INTERNAL, TRUE, "bounds_check", NULL,
00290 0, 0, 0,
00291 const_cast<char*>("-DEBUG:subscript_check"), NULL,
00292 "Check array subscripts against bounds" },
00293
00294 { OVK_REPLACED, OV_INTERNAL, TRUE, "trapuv", NULL,
00295 0, 0, 0, const_cast<char*>("-DEBUG:trap_uninitialized"), NULL,
00296 "Trap references to uninitialized variables" },
00297
00298 { OVK_COUNT }
00299 };
00300
00301 #undef ID
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314 void
00315 DEBUG_Init_Config ( void )
00316 {
00317 DEBUG_FLAGS *next = Current_DEBUG->next;
00318
00319 *Current_DEBUG = Default_DEBUG;
00320 Current_DEBUG->next = next;
00321 }
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338 void
00339 DEBUG_Push_Config ( BOOL use_default )
00340 {
00341 DEBUG_FLAGS *new_flags =
00342 (DEBUG_FLAGS *) malloc ( sizeof(DEBUG_FLAGS) );
00343
00344 if ( new_flags == NULL ) {
00345 ErrMsg ( EC_No_Mem, "DEBUG_Push" );
00346 }
00347
00348 *new_flags = use_default ? Default_DEBUG : *Current_DEBUG;
00349 new_flags->next = Current_DEBUG;
00350 Current_DEBUG = new_flags;
00351 }
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370 BOOL
00371 DEBUG_Pop_Config ( void )
00372 {
00373 if ( Current_DEBUG->next == NULL ) {
00374
00375 return FALSE;
00376 } else {
00377
00378 DEBUG_FLAGS *new_flags = Current_DEBUG->next;
00379 free ( Current_DEBUG );
00380 Current_DEBUG = new_flags;
00381 return TRUE;
00382 }
00383 }
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403 static void DEBUG_Configure_Alignment(char *val)
00404 {
00405 if (val)
00406 {
00407 INT32 len = strlen(val);
00408
00409 if (ux_strncasecmp(val, "normal", len)==0)
00410 DEBUG_Alignment = ALIGN_NORMAL;
00411 else if (ux_strncasecmp(val, "fixade", len)==0)
00412 DEBUG_Alignment = ALIGN_FIXADE;
00413 else if (ux_strncasecmp(val, "compose", len)==0)
00414 DEBUG_Alignment= ALIGN_COMPOSE;
00415 else
00416 {
00417 ErrMsg ( EC_Inv_OPT, "DEBUG:alignment", val);
00418 }
00419 if (!DEBUG_Alignment_Normal)
00420 DevWarn("-DEBUG:alignment set to %s", val);
00421 }
00422 }
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436 void
00437 DEBUG_Configure ( void )
00438 {
00439 OPTION_LIST *ol = Current_DEBUG->woff;
00440
00441 #ifdef FRONT_F90
00442 extern void add_cray_args ( char * );
00443 extern void Cray_Woff ( char * );
00444 #endif
00445
00446
00447
00448
00449
00450 if ( DEBUG_Trap_Uv_Rjustify ) {
00451 if ( ! DEBUG_Trap_Uv_Set )
00452 DEBUG_Trap_Uv = TRUE;
00453 }
00454
00455
00456
00457
00458 if ( DEBUG_Int_Overflow_Check ) {
00459 if ( ! DEBUG_Int32_Overflow_Check_Set )
00460 DEBUG_Int32_Overflow_Check = TRUE;
00461 if ( ! DEBUG_Div_Check_Set )
00462 DEBUG_Div_Check = DIV_ZERO_CHECK | DIV_OFLOW_CHECK;
00463 }
00464
00465
00466 if ( DEBUG_Cray_Port ) {
00467 if ( ! DEBUG_Equiv_Warning_Set )
00468 DEBUG_Equiv_Warning = TRUE;
00469 if ( ! DEBUG_Full_Interface_Check_Set )
00470 DEBUG_Full_Interface_Check = TRUE;
00471 if ( ! DEBUG_Int32_Overflow_Check_Set )
00472 DEBUG_Int32_Overflow_Check = TRUE;
00473 if ( ! DEBUG_Pointer_Increment_Warning_Set )
00474 DEBUG_Pointer_Increment_Warning = TRUE;
00475 if ( ! DEBUG_Printf_Warning_Set )
00476 DEBUG_Printf_Warning = TRUE;
00477 if ( ! DEBUG_Shift_Check_Set )
00478 DEBUG_Shift_Check = TRUE;
00479 if ( ! DEBUG_Shift_Warning_Set )
00480 DEBUG_Shift_Warning = TRUE;
00481 if ( ! DEBUG_Trunc_Check_Set )
00482 DEBUG_Trunc_Check = TRUE;
00483 if ( ! DEBUG_Trunc_Warning_Set )
00484 DEBUG_Trunc_Warning = TRUE;
00485 }
00486
00487
00488
00489 if (DEBUG_Subscript_Check && !DEBUG_Conform_Check_Set) {
00490 DEBUG_Conform_Check = TRUE;
00491 }
00492
00493
00494 if ( DEBUG_Fullwarn ) {
00495 Min_Error_Severity = ES_ADVISORY;
00496 #ifdef FRONT_END
00497 #ifdef FRONT_F90
00498 add_cray_args ( "-m2" );
00499 #else
00500 #ifdef EDGSRC
00501 error_threshold = es_remark;
00502 #endif
00503 #endif
00504 #endif
00505 }
00506
00507
00508 while ( ol != NULL ) {
00509 char *msg = OLIST_val(ol);
00510
00511 #ifdef FRONT_END
00512 #ifdef FRONT_F90
00513 Cray_Woff ( msg );
00514 #else
00515 #ifdef EDGSRC
00516 process_diag_override_option ( optk_diag_suppress, msg );
00517 #endif
00518 #endif
00519 #endif
00520
00521 Rag_Handle_Woff_Args ( msg );
00522
00523 ol = OLIST_next(ol);
00524 }
00525
00526 #ifdef FRONT_END
00527 #ifndef FRONT_F90
00528 #ifdef EDGSRC
00529
00530 for ( ol = Current_DEBUG->remark; ol != NULL; ol = OLIST_next(ol) ) {
00531 char *msg = OLIST_val(ol);
00532
00533 process_diag_override_option ( optk_diag_remark, msg );
00534 }
00535
00536
00537 for ( ol = Current_DEBUG->warning; ol != NULL; ol = OLIST_next(ol) ) {
00538 char *msg = OLIST_val(ol);
00539
00540 process_diag_override_option ( optk_diag_warning, msg );
00541 }
00542
00543
00544 for ( ol = Current_DEBUG->error; ol != NULL; ol = OLIST_next(ol) ) {
00545 char *msg = OLIST_val(ol);
00546
00547 process_diag_override_option ( optk_diag_error, msg );
00548 }
00549 #endif
00550 #endif
00551 #endif
00552
00553 DEBUG_Configure_Alignment(Debug_Alignment_Name);
00554
00555 }
00556