From: Gary Funck <gary@intrepid.com>
To: Gcc Patches <gcc-patches@gcc.gnu.org>
Subject: options generation and language count
Date: Tue, 30 Aug 2011 06:57:00 -0000 [thread overview]
Message-ID: <20110829234640.GB26527@intrepid.com> (raw)
Recently, we ran "make check" on the GCC built from the GUPC branck
and compared it against "make check" run against the GCC trunk version
of the most recent merge with the trunk. The following failure
was detected on the GUPC branch.
cc1: internal compiler error: in print_specific_help, at opts.c:1128
The following command generates the error.
gcc/xgcc -Bgcc/ test-18810.c --help=optimizers -lm -o test-18810.x
The assertion check is here:
1126 /* Sanity check: Make sure that we do not have more
1127 languages than we have bits available to enumerate them. */
1128 gcc_assert ((1U << cl_lang_count) < CL_MIN_OPTION_CLASS);
The value of 'cl_lang_count' is calculated by an AWK script that
processes the .opt files and generates .c and .h files. The value of
CL_MIN_OPTION_CLASS is defined in opts.h.
130 #define CL_PARAMS (1U << 11) /* Fake entry. Used to display --param info with --help. */
131 #define CL_WARNING (1U << 12) /* Enables an (optional) warning message. */
132 #define CL_OPTIMIZATION (1U << 13) /* Enables an (optional) optimization. */
133 #define CL_DRIVER (1U << 14) /* Driver option. */
134 #define CL_TARGET (1U << 15) /* Target-specific option. */
135 #define CL_COMMON (1U << 16) /* Language-independent. */
136
137 #define CL_MIN_OPTION_CLASS CL_PARAMS
138 #define CL_MAX_OPTION_CLASS CL_COMMON
Above, we can see that CL_MIN_OPTION_CLASS is equal to CL_PARAMS,
which is a fixed value: (1U << 11).
The options.h file is generated by the AWK scripts and is present in
the 'gcc' build directory. Here's the relevant values.
#define CL_UPC (1U << 10)
#define CL_LANG_ALL ((1U << 11) - 1)
The cl_lang_count value is in the generated options.c file.
const unsigned int cl_lang_count = 11;
Although I haven't reviewed the source code in detail it looks to me
like there might be two issues here:
1) The sanity check should probably read:
gcc_assert ((1U << cl_lang_count) <= CL_MIN_OPTION_CLASS);
In other words, it is off-by-one.
2) The fixed shift counts starting at CL_PARAMS probably need to be
adjusted upwards to allow for more languages.
A third problem, is that this sort of error would be better detected
at build time rather than waiting to run a DejaGNU test to find it.
Also, the use of fixed masks is problematic. Perhaps the AWK script
could be changed to also generate values for CL_PARAMS, etc., ensuring
that will not conflict with the language mask values?
- Gary
next reply other threads:[~2011-08-29 23:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-30 6:57 Gary Funck [this message]
2011-08-30 16:50 ` Joseph S. Myers
2011-08-30 16:50 ` Gary Funck
2011-08-30 19:59 ` Joseph S. Myers
2011-09-01 21:49 ` [Patch, C] " Gary Funck
2011-09-02 13:42 ` Joseph S. Myers
2011-09-02 16:27 ` Gary Funck
2011-09-02 19:53 ` Joseph S. Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110829234640.GB26527@intrepid.com \
--to=gary@intrepid.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).