Hi Gerald: Thanks for reporting this issue, I just realized multidimensional arrays are gawk extensions, could you try the attached patch to see if it can resolve the issue?
On Mon, Oct 2, 2023 at 4:56 AM Gerald Pfeifer <ger...@pfeifer.com> wrote: > > On Sun, 1 Oct 2023, Kito Cheng wrote: > > Committed to trunk, thanks Feng :) > > Hmm, my nightly FreeBSD 12 tester now fails as follows: > > nawk -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-functions.awk \ > -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk \ > -f /scratch/tmp/gerald/GCC-HEAD/gcc/opth-gen.awk \ > < optionlist > tmp-options.h > nawk: syntax error at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > context is > >>> other_masks[var_index][ > <<< n_other_mask[var_index]++] = name > nawk: illegal statement at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > nawk -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-functions.awk \ > -f /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk \ > -f /scratch/tmp/gerald/GCC-HEAD/gcc/optc-save-gen.awk \ > -v header_name="config.h system.h coretypes.h tm.h" < optionlist \ > > options-save.cc > nawk: syntax error at source line 386 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opth-gen.awk > nawk: syntax error at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > context is > >>> other_masks[var_index][ > <<< n_other_mask[var_index]++] = name > nawk: illegal statement at source line 67 source file > /scratch/tmp/gerald/GCC-HEAD/gcc/opt-read.awk > gmake[3]: *** [Makefile:2477: s-options-h] Error 2 > > Gerald
From a2a621ed6a3eaf136e917d10f4970a6bf7240d5a Mon Sep 17 00:00:00 2001 From: Kito Cheng <kito.ch...@sifive.com> Date: Mon, 2 Oct 2023 10:50:42 +0800 Subject: [PATCH] options: Prevent multidimensional arrays Multidimensional arrary is gawk extension, and we accidentally introduced that in recent commit[1]. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e4a4b8e983bac865eb435b11798e38d633b98942 gcc/ChangeLog: * opt-read.awk: Drop multidimensional arrays. * opth-gen.awk: Ditto. --- gcc/opt-read.awk | 2 +- gcc/opth-gen.awk | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk index fcf92853957..b6b4c01888d 100644 --- a/gcc/opt-read.awk +++ b/gcc/opt-read.awk @@ -131,7 +131,7 @@ BEGIN { { target_vars[n_target_vars++] = target_var } - other_masks[var_index][n_other_mask[var_index]++] = name + other_masks[var_index "," n_other_mask[var_index]++] = name } else { diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 70ca3d37719..c4398be2f3a 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -412,9 +412,9 @@ for (i = 0; i < n_target_vars; i++) continue for (j = 0; j < n_other_mask[i]; j++) { - print "#define MASK_" other_masks[i][j] " (1U << " other_masknum[i][""]++ ")" + print "#define MASK_" other_masks[i "," j] " (1U << " other_masknum[i]++ ")" } - if (other_masknum[i][""] > 32) + if (other_masknum[i] > 32) print "#error too many target masks for" extra_target_vars[i] } @@ -437,8 +437,8 @@ for (i = 0; i < n_target_vars; i++) continue for (j = 0; j < n_other_mask[i]; j++) { - print "#define TARGET_" other_masks[i][j] \ - " ((" target_vars[i] " & MASK_" other_masks[i][j] ") != 0)" + print "#define TARGET_" other_masks[i "," j] \ + " ((" target_vars[i] " & MASK_" other_masks[i "," j] ") != 0)" } } print "" -- 2.40.1