Skip to content

Commit ee00a36

Browse files
committed
Fix get_size of size_t
1 parent 8568519 commit ee00a36

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

gcc/jit/jit-recording.cc

+28-1
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,34 @@ recording::memento_of_get_type::get_size ()
25822582
size = LONG_DOUBLE_TYPE_SIZE;
25832583
break;
25842584
case GCC_JIT_TYPE_SIZE_T:
2585-
size = MAX_BITS_PER_WORD;
2585+
/* Compare with tree.cc's build_common_tree_nodes. */
2586+
if (strcmp (SIZE_TYPE, "unsigned int") == 0)
2587+
size = INT_TYPE_SIZE;
2588+
else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
2589+
size = LONG_TYPE_SIZE;
2590+
else if (strcmp (SIZE_TYPE, "long long unsigned int") == 0)
2591+
size = LONG_LONG_TYPE_SIZE;
2592+
else if (strcmp (SIZE_TYPE, "short unsigned int") == 0)
2593+
size = SHORT_TYPE_SIZE;
2594+
else
2595+
{
2596+
int i;
2597+
2598+
for (i = 0; i < NUM_INT_N_ENTS; i++)
2599+
if (int_n_enabled_p[i])
2600+
{
2601+
fprintf (stderr, "%d\n", i);
2602+
char name[50], altname[50];
2603+
sprintf (name, "__int%d unsigned", int_n_data[i].bitsize);
2604+
sprintf (altname, "__int%d__ unsigned", int_n_data[i].bitsize);
2605+
2606+
if (strcmp (name, SIZE_TYPE) == 0 || strcmp (altname, SIZE_TYPE) == 0)
2607+
{
2608+
return int_n_data[i].bitsize / BITS_PER_UNIT;
2609+
}
2610+
}
2611+
gcc_unreachable ();
2612+
}
25862613
break;
25872614
default:
25882615
/* As this function is called by

0 commit comments

Comments
 (0)