Skip to content

Commit

Permalink
Fixes for bug reported under MSVC Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Aug 26, 2024
1 parent 2ed1057 commit 588ca2e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 77 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/windows-msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,49 +165,9 @@ jobs:
shell: C:\shells\msys2bash.cmd {0}
run: |
cd tests
sed -i '/AT_SETUP(\[MF FIGURATIVE to NUMERIC\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at
sed -i '/AT_SETUP(\[Default file external name\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_file.at
sed -i '/AT_SETUP(\[EXTFH: SEQUENTIAL files\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_file.at
sed -i '/AT_SETUP(\[System routine CBL_GC_HOSTED\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_extensions.at
sed -i '/AT_SETUP(\[MOVE to edited item (4)\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_fundamental.at
sed -i '/AT_SETUP(\[MOVE to item with simple and floating insertion\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_fundamental.at
sed -i '/AT_SETUP(\[Numeric operations (1)\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_fundamental.at
sed -i '/AT_SETUP(\[Numeric operations (3) PACKED-DECIMAL\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_fundamental.at
sed -i '/AT_SETUP(\[DISPLAY with P fields\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_fundamental.at
sed -i '/AT_SETUP(\[MOVE with de-editting to COMP-3\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_fundamental.at
sed -i '/AT_SETUP(\[MOVE between USAGEs\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_fundamental.at
sed -i '/AT_SETUP(\[Computing of different USAGEs w\/- decimal point\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at
sed -i '/AT_SETUP(\[C-API (param based)\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at
sed -i '/AT_SETUP(\[C-API (field based)\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at
sed -i '/AT_SETUP(\[Default Arithmetic Test (2)\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at
sed -i '/AT_SETUP(\[OSVS Arithmetic Test (2)\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at
sed -i '/AT_SETUP(\[FUNCTION ACOS\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_functions.at
sed -i '/AT_SETUP(\[FUNCTION ASIN\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_functions.at
sed -i '/AT_SETUP(\[FUNCTION RANDOM\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_functions.at
sed -i '/AT_SETUP(\[MOVE of non-integer to alphanumeric\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_extensions.at
sed -i '/AT_SETUP(\[XML GENERATE trimming\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_ml.at
sed -i '/AT_SETUP(\[JSON GENERATE trimming\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_ml.at
sed -i '/AT_SETUP(\[MOVE PACKED-DECIMAL to BINARY\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_binary.at
sed -i '/AT_SETUP(\[PACKED-DECIMAL dump\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[PACKED-DECIMAL used with MOVE\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[MOVE PACKED-DECIMAL to PACKED-DECIMAL\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[MOVE PACKED-DECIMAL to DISPLAY\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[MOVE DISPLAY to PACKED-DECIMAL\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[PACKED-DECIMAL comparison\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[COMP-6 comparison\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[COMP-3 vs. COMP-6 - BCD comparison\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[PPP COMP-3\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[PPP COMP-6\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[MOVE between several BCD fields\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[BCD ADD and SUBTRACT w\/o SIZE ERROR\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[BCD ADD and SUBTRACT, DEFAULT ROUNDING MODE\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[BCD ADD and SUBTRACT, all ROUNDED MODEs\])/a AT_SKIP_IF(\[true\])' testsuite.src/data_packed.at
sed -i '/AT_SETUP(\[CURRENCY SIGN WITH PICTURE SYMBOL\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at
# The tests in sed commands above randomly hang (under debug configurations)

- name: Build testsuite
shell: C:\shells\msys2bash.cmd {0}
run: |
Expand Down
71 changes: 36 additions & 35 deletions cobc/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2940,14 +2940,14 @@ find_floating_insertion_str (const cob_pic_symbol *str,

/* Number of character types in picture strings */
/*
The 25 character types are:
B , . + + + CR cs cs Z Z + + cs cs 9 A L S V P P 1 N E
The 26 character types are:
B , . + + + CR cs cs Z Z + + cs cs 9 A L S V P P 1 U N E
0 - - DB * * - - X
/
Duplicates indicate floating/non-floating insertion symbols and/or left/right
of decimal point positon.
*/
#define CB_PIC_CHAR_TYPES 25
#define CB_PIC_CHAR_TYPES 26
#define CB_FIRST_NON_P_DIGIT_CHAR_TYPE 9
#define CB_LAST_NON_P_DIGIT_CHAR_TYPE 15
#define CB_PIC_S_CHAR_TYPE 18
Expand Down Expand Up @@ -3043,13 +3043,13 @@ char_to_precedence_idx (const cob_pic_symbol *str,
case '1':
return 22;

case 'N':
case 'U':
return 23;

case 'E':
case 'N':
return 24;

case 'U':
case 'E':
return 25;

default:
Expand Down Expand Up @@ -3140,11 +3140,11 @@ get_char_type_description (const int idx)
case 22:
return "1";
case 23:
return "N";
return "U";
case 24:
return "E";
return "N";
case 25:
return "U";
return "E";
default:
return NULL;
}
Expand Down Expand Up @@ -3180,35 +3180,36 @@ valid_char_order (const cob_pic_symbol *str, const int s_char_seen, const unsign
manual.
*/
/*
B , . + + + CR cs cs Z Z + + cs cs 9 A L S V P P 1 N E
B , . + + + CR cs cs Z Z + + cs cs 9 A L S V P P 1 U N E
0 - - DB * * - - X
/
*/
{ 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0 },
{ 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 },
{ 1, 1, 1, 0, 0, 0,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0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 },
{ 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 },
{ 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};
int error_emitted[CB_PIC_CHAR_TYPES][CB_PIC_CHAR_TYPES] = {{ 0 }};
int chars_seen[CB_PIC_CHAR_TYPES] = { 0 };
Expand Down
4 changes: 4 additions & 0 deletions libcob/intrinsic.c
Original file line number Diff line number Diff line change
Expand Up @@ -5464,8 +5464,12 @@ cob_intr_random (const int params, ...)
double val;
#ifdef DISABLE_GMP_RANDOM
unsigned int seed = 0;
#else
#ifdef _WIN32
unsigned long long seed = 0;
#else
unsigned long seed = 0;
#endif
#endif
cob_field_attr attr;
cob_field field;
Expand Down
4 changes: 2 additions & 2 deletions libcob/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ cob_move_display_to_packed (cob_field *f1, cob_field *f2)

while ((p < p_end) && (q <= q_end))
{
*q = (unsigned char) (*p << 4) /* -> dropping the higher bits = no use in COB_D2I */
*q = (unsigned char) ((*p << 4) & 0xF0) /* -> dropping the higher bits = no use in COB_D2I */
+ COB_D2I (*(p + 1));
p = p + 2;
q++;
Expand All @@ -644,7 +644,7 @@ cob_move_display_to_packed (cob_field *f1, cob_field *f2)

if ((p == p_end) && (q <= q_end))
{
*q = (unsigned char) (*p << 4) & 0xF0;
*q = (unsigned char) ((*p << 4) & 0xF0);
}

COB_PUT_SIGN_ADJUSTED (f1, sign);
Expand Down
2 changes: 2 additions & 0 deletions tests/testsuite.src/run_misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -11877,6 +11877,7 @@ CAPI (void *p1, ...)

nargs = cob_get_num_params();
printf ("CAPI called with %d parameters\n",nargs);
fflush(stdout);
for (k=1; k <= nargs; k++) {
type = cob_get_param_type (k);
digits = cob_get_param_digits (k);
Expand Down Expand Up @@ -12112,6 +12113,7 @@ CAPI (void *p1, ...)

nargs = cob_get_num_params();
printf ("CAPI called with %d parameters\n",nargs);
fflush(stdout);
for (k=1; k <= nargs; k++) {
cob_field *fld = cob_get_param_field (k, "CAPI");
type = cob_get_field_type (fld);
Expand Down

0 comments on commit 588ca2e

Please sign in to comment.