This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix build failure with old Sun compiler
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 7 Feb 2006 19:06:00 +0100
- Subject: Fix build failure with old Sun compiler
The Sun C 5.0 compiler chockes on
static const struct c_test insn_conditions[] = {};
present in gencondmd.c and then on the conditional in
if (*dflow->problem->reset_fun)
(*dflow->problem->reset_fun) (dflow, df->blocks_to_analyze);
present in df-core.c and df-scan.c.
Bootstrapped with GCC 3.4.x and Sun C 5.0, gencondmd.c and insn-conditions.md
visually inspected, applied on mainline as obvious.
2006-02-07 Eric Botcazou <ebotcazou@libertysurf.fr>
* df-core.c (df_set_blocks): Do not dereference function pointers.
(df_finish1): Likewise.
(df_hybrid_search_forward): Likewise.
(df_hybrid_search_backward): Likewise.
(df_iterative_dataflow): Likewise.
(df_analyze_problem): Likewise.
(df_compact_blocks): Likewise.
(df_dump): Likewise.
* df-scan.c (df_rescan_blocks): Likewise.
(df_record_entry_block_defs): Likewise.
* genconditions.c (write_conditions): Guard the definition of
'insn_conditions' with the check on GCC version.
(write_writer): Guard the traversal 'insn_conditions' with
the check on GCC version.
--
Eric Botcazou
Index: genconditions.c
===================================================================
--- genconditions.c (revision 110691)
+++ genconditions.c (working copy)
@@ -160,12 +160,12 @@ struct c_test\n\
vary at run time. It works in 3.0.1 and later; 3.0 only when not\n\
optimizing. */\n\
\n\
-static const struct c_test insn_conditions[] = {\n\
-#if GCC_VERSION >= 3001\n");
+#if GCC_VERSION >= 3001\n\
+static const struct c_test insn_conditions[] = {\n");
traverse_c_tests (write_one_condition, 0);
- puts ("\n#endif /* gcc >= 3.0.1 */\n};\n");
+ puts ("\n};\n#endif /* gcc >= 3.0.1 */\n");
}
/* Emit code which will convert the C-format table to a
@@ -181,6 +181,7 @@ write_writer (void)
" unsigned int i;\n"
" const char *p;\n"
" puts (\"(define_conditions [\");\n"
+ "#if GCC_VERSION >= 3001\n"
" for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n"
" {\n"
" printf (\" (%d \\\"\", insn_conditions[i].value);\n"
@@ -196,6 +197,7 @@ write_writer (void)
" }\n"
" puts (\"\\\")\");\n"
" }\n"
+ "#endif /* gcc >= 3.0.1 */\n"
" puts (\"])\");\n"
" fflush (stdout);\n"
"return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"
Index: df-core.c
===================================================================
--- df-core.c (revision 110691)
+++ df-core.c (working copy)
@@ -369,9 +369,9 @@ df_set_blocks (struct df *df, bitmap blo
for (p = df->num_problems_defined - 1; p >= 0 ;p--)
{
struct dataflow *dflow = df->problems_in_order[p];
- if (*dflow->problem->reset_fun)
- (*dflow->problem->reset_fun) (dflow, df->blocks_to_analyze);
- else if (*dflow->problem->free_bb_fun)
+ if (dflow->problem->reset_fun)
+ dflow->problem->reset_fun (dflow, df->blocks_to_analyze);
+ else if (dflow->problem->free_bb_fun)
{
bitmap_iterator bi;
unsigned int bb_index;
@@ -381,7 +381,7 @@ df_set_blocks (struct df *df, bitmap blo
basic_block bb = BASIC_BLOCK (bb_index);
if (bb)
{
- (*dflow->problem->free_bb_fun)
+ dflow->problem->free_bb_fun
(dflow, bb, df_get_bb_info (dflow, bb_index));
df_set_bb_info (dflow, bb_index, NULL);
}
@@ -403,7 +403,7 @@ df_set_blocks (struct df *df, bitmap blo
for (p = df->num_problems_defined - 1; p >= 0 ;p--)
{
struct dataflow *dflow = df->problems_in_order[p];
- if (*dflow->problem->reset_fun)
+ if (dflow->problem->reset_fun)
{
if (!blocks_to_reset)
{
@@ -414,7 +414,7 @@ df_set_blocks (struct df *df, bitmap blo
bitmap_set_bit (blocks_to_reset, bb->index);
}
}
- (*dflow->problem->reset_fun) (dflow, blocks_to_reset);
+ dflow->problem->reset_fun (dflow, blocks_to_reset);
}
}
if (blocks_to_reset)
@@ -444,7 +444,7 @@ df_finish1 (struct df *df)
int i;
for (i = 0; i < df->num_problems_defined; i++)
- (*df->problems_in_order[i]->problem->free_fun) (df->problems_in_order[i]);
+ df->problems_in_order[i]->problem->free_fun (df->problems_in_order[i]);
free (df);
}
@@ -479,12 +479,12 @@ df_hybrid_search_forward (basic_block bb
if (!TEST_BIT (dataflow->considered, e->src->index))
continue;
- (*dataflow->problem->con_fun_n) (dataflow, e);
+ dataflow->problem->con_fun_n (dataflow, e);
}
- else if (*dataflow->problem->con_fun_0)
- (*dataflow->problem->con_fun_0) (dataflow, bb);
+ else if (dataflow->problem->con_fun_0)
+ dataflow->problem->con_fun_0 (dataflow, bb);
- result_changed = (*dataflow->problem->trans_fun) (dataflow, i);
+ result_changed = dataflow->problem->trans_fun (dataflow, i);
if (!result_changed || single_pass)
return;
@@ -531,12 +531,12 @@ df_hybrid_search_backward (basic_block b
if (!TEST_BIT (dataflow->considered, e->dest->index))
continue;
- (*dataflow->problem->con_fun_n) (dataflow, e);
+ dataflow->problem->con_fun_n (dataflow, e);
}
- else if (*dataflow->problem->con_fun_0)
- (*dataflow->problem->con_fun_0) (dataflow, bb);
+ else if (dataflow->problem->con_fun_0)
+ dataflow->problem->con_fun_0 (dataflow, bb);
- result_changed = (*dataflow->problem->trans_fun) (dataflow, i);
+ result_changed = dataflow->problem->trans_fun (dataflow, i);
if (!result_changed || single_pass)
return;
@@ -605,7 +605,7 @@ df_iterative_dataflow (struct dataflow *
SET_BIT (pending, idx);
};
- (*dataflow->problem->init_fun) (dataflow, blocks_to_init);
+ dataflow->problem->init_fun (dataflow, blocks_to_init);
while (1)
{
@@ -704,24 +704,24 @@ df_analyze_problem (struct dataflow *dfl
int *postorder, int n_blocks, bool single_pass)
{
/* (Re)Allocate the datastructures necessary to solve the problem. */
- if (*dflow->problem->alloc_fun)
- (*dflow->problem->alloc_fun) (dflow, blocks_to_scan);
+ if (dflow->problem->alloc_fun)
+ dflow->problem->alloc_fun (dflow, blocks_to_scan);
/* Set up the problem and compute the local information. This
function is passed both the blocks_to_consider and the
blocks_to_scan because the RD and RU problems require the entire
function to be rescanned if they are going to be updated. */
- if (*dflow->problem->local_compute_fun)
- (*dflow->problem->local_compute_fun) (dflow, blocks_to_consider, blocks_to_scan);
+ if (dflow->problem->local_compute_fun)
+ dflow->problem->local_compute_fun (dflow, blocks_to_consider, blocks_to_scan);
/* Solve the equations. */
- if (*dflow->problem->dataflow_fun)
- (*dflow->problem->dataflow_fun) (dflow, blocks_to_consider, blocks_to_init,
- postorder, n_blocks, single_pass);
+ if (dflow->problem->dataflow_fun)
+ dflow->problem->dataflow_fun (dflow, blocks_to_consider, blocks_to_init,
+ postorder, n_blocks, single_pass);
/* Massage the solution. */
- if (*dflow->problem->finalize_fun)
- (*dflow->problem->finalize_fun) (dflow, blocks_to_consider);
+ if (dflow->problem->finalize_fun)
+ dflow->problem->finalize_fun (dflow, blocks_to_consider);
}
@@ -825,7 +825,7 @@ df_compact_blocks (struct df *df)
for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
- if (*dflow->problem->free_bb_fun)
+ if (dflow->problem->free_bb_fun)
{
df_grow_bb_info (dflow);
memcpy (problem_temps, dflow->block_info, size);
@@ -849,7 +849,7 @@ df_compact_blocks (struct df *df)
{
basic_block bb = BASIC_BLOCK (i);
if (problem_temps[i] && bb)
- (*dflow->problem->free_bb_fun)
+ dflow->problem->free_bb_fun
(dflow, bb, problem_temps[i]);
}
}
@@ -1063,7 +1063,7 @@ df_dump (struct df *df, FILE *file)
df->def_info.bitmap_size, df->use_info.bitmap_size);
for (i = 0; i < df->num_problems_defined; i++)
- (*df->problems_in_order[i]->problem->dump_fun) (df->problems_in_order[i], file);
+ df->problems_in_order[i]->problem->dump_fun (df->problems_in_order[i], file);
fprintf (file, "\n");
}
Index: df-scan.c
===================================================================
--- df-scan.c (revision 110691)
+++ df-scan.c (working copy)
@@ -453,7 +453,7 @@ df_rescan_blocks (struct df *df, bitmap
for (i = df->num_problems_defined; i; i--)
{
bitmap blocks_to_reset = NULL;
- if (*dflow->problem->reset_fun)
+ if (dflow->problem->reset_fun)
{
if (!blocks_to_reset)
{
@@ -462,7 +462,7 @@ df_rescan_blocks (struct df *df, bitmap
if (df->blocks_to_scan)
bitmap_ior_into (blocks_to_reset, df->blocks_to_scan);
}
- (*dflow->problem->reset_fun) (dflow, blocks_to_reset);
+ dflow->problem->reset_fun (dflow, blocks_to_reset);
}
if (blocks_to_reset)
BITMAP_FREE (blocks_to_reset);
@@ -1804,7 +1804,7 @@ df_record_entry_block_defs (struct dataf
#endif
}
- (*targetm.live_on_entry) (df->entry_block_defs);
+ targetm.live_on_entry (df->entry_block_defs);
EXECUTE_IF_SET_IN_BITMAP (df->entry_block_defs, 0, i, bi)
{