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