public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zack Weinberg <zack@codesourcery.com>
To: Gabriel Dos Reis <gdr@codesourcery.com>
Cc: Mark Mitchell <mark@codesourcery.com>,
	Neil Booth <neil@daikokuya.demon.co.uk>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: ICE in change_address at emit_rtl.c
Date: Thu, 15 Nov 2001 03:02:00 -0000	[thread overview]
Message-ID: <20011124164155.B1538@codesourcery.com> (raw)
In-Reply-To: <flr8qn94oi.fsf@riz.cmla.ens-cachan.fr>

On Sat, Nov 24, 2001 at 11:37:01PM +0100, Gabriel Dos Reis wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
> | A solution I have advocated in the past is to have ERROR_MARK_TYPE,
> | ERROR_MARK_DECL, etc.  This would help, since using DECL_ARTIFICIAL,
> | say, on the ERROR_MARK_DECL would work.
> | 
> | Neil's approach is possible as well.
> | 
> | Neil is right that the current strategy actually makes GCC harder
> | to work on, and does little to improve reliability.
> 
> I share Neil's sentiment. 
> 
> What worries is the alternative he's proposing.  My personnal view is
> to have ERROR_MARK_XXX for TYPE, DECL and such in order to enhance
> the tree type system and maintainability.  But Neil is proposing to
> get rid of those nodes.

I think it's fruitless to argue over precisely how we'll make this work
better without sitting down and going through the code, but we should
be able to lay down some design principles - and whatever winds up
fulfilling them, will be the right thing.  So here's what I think we
ought to be going for:

1. Language independent code never sees ill-formed trees.  The front end
is responsible for replacing erroneous input with harmless constructs.
"Harmless" means "won't cause anything downstream to crash, and needs
no special casing."  How exactly we implement that is open to discussion,
but answers to the remaining questions may affect this.

1a. Within language dependent code, ill-formed trees should have as short
lifetimes as possible.  For instance, the code which generates statement-
level trees should be able to rely on the expression parser to produce only
well-formed expressions.

2. As few spurious errors reported to the user as possible.  This is one
place where ERROR_MARK_NODE really falls down.  Consider these ill-formed
declarations:

double int number;
typedef struct foo foo_t[;

These will both provoke error cascades in the current compiler, mainly
because 'number' and 'foo_t' don't get entered into the symbol table,
so we issue errors every time they are used, even if the use would have
been valid given a valid declaration.  What we need here is a way of saying,
well, we know "number" is a scalar non-pointer variable so we'll let the user
do things with it that would be acceptable of such variables.  It's harder to
say what foo_t is supposed to be - but we can say that a forward declaration
of struct foo has happened, and it will probably be okay to treat foo_t
as a typedef for struct foo.

We also need to do better recovering from parser errors - here I think the
additional power of recursive descent should eliminate the problem, and we
don't need any funky data structures.  But take that typedef as an example
of what needs to be handled - there is no construct which contains a
semicolon inside square brackets (without further nesting) so we should
_not_ parse the rest of the file as if we are inside square brackets, which
is (very close to) what happens right now.

3. Make efforts to get back in sync and continue processing the rest of the
file.  At the very least, errors in one top level construct should not
propagate outside that construct.  We may, of course, have to prevent
later operations from digging too deeply inside that construct.  For instance,

inline int foo(void) { syntax error; }

should become "extern int foo(void);" for purpose of further processing.

zw

  parent reply	other threads:[~2001-11-25  0:41 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-13  6:18 Craig Rodrigues
2001-11-13  8:25 ` Gerald Pfeifer
2001-11-13  8:39   ` Craig Rodrigues
2001-11-13  8:40     ` Gerald Pfeifer
2001-11-13 14:52       ` Gerald Pfeifer
2001-11-13 16:41       ` Zack Weinberg
2001-11-13 16:55         ` Neil Booth
2001-11-13 18:07           ` Gabriel Dos Reis
2001-11-13 18:09             ` Neil Booth
2001-11-14  9:46               ` Zack Weinberg
2001-11-14 10:02                 ` Neil Booth
2001-11-14 10:06                   ` Joseph S. Myers
2001-11-14 10:10                     ` Neil Booth
2001-11-14 10:19                       ` Joseph S. Myers
2001-11-14 14:16                       ` Gabriel Dos Reis
2001-11-14 17:34                       ` Michal Moskal
2001-11-14 13:55                   ` Gabriel Dos Reis
2001-11-14 15:00                     ` Neil Booth
2001-11-14 16:50                       ` Gabriel Dos Reis
2001-11-14 12:43                 ` Phil Edwards
2001-11-15  0:55               ` Mark Mitchell
2001-11-15  1:22                 ` Gabriel Dos Reis
2001-11-15  1:44                   ` Neil Booth
2001-11-15  4:55                     ` Zack Weinberg
2001-11-15  5:19                       ` Joseph S. Myers
2001-11-15  6:58                         ` Zack Weinberg
2001-11-15  9:07                       ` Mark Mitchell
2001-11-17  9:40                         ` Zack Weinberg
2001-11-17  9:56                           ` Mark Mitchell
2001-11-18  4:44                             ` Zack Weinberg
2001-11-26 16:45                               ` Zack Weinberg
2001-11-26 11:55                             ` Mark Mitchell
2001-11-26 11:46                           ` Zack Weinberg
2001-11-25  0:42                         ` Mark Mitchell
2001-11-15  9:23                       ` Neil Booth
2001-11-17 10:37                         ` Zack Weinberg
2001-11-17 10:54                           ` Neil Booth
2001-11-26 12:25                             ` Neil Booth
2001-11-26 12:07                           ` Zack Weinberg
2001-11-25  3:50                         ` Neil Booth
2001-11-15  5:14                     ` Mark Mitchell
2001-11-16  6:27                     ` Fergus Henderson
2001-11-16  8:32                       ` Daniel Berlin
2001-11-25 22:49                         ` Daniel Berlin
2001-11-25 22:06                       ` Fergus Henderson
2001-11-15  3:02                   ` Zack Weinberg [this message]
2001-11-16  4:04               ` Fergus Henderson
2001-11-25 21:58                 ` Fergus Henderson
2001-11-13 16:47 dewar
2001-11-14 12:01 mike stump
2001-11-14 14:57 ` Neil Booth
2001-11-14 16:35   ` Gabriel Dos Reis
2001-11-15  9:00   ` Mark Mitchell
2001-11-25  0:41     ` Mark Mitchell
2001-11-15  8:02 mike stump
2001-11-15  9:51 ` Neil Booth
2001-11-25  4:02   ` Neil Booth
2001-11-15  8:15 mike stump
2001-11-15  8:43 ` Zack Weinberg
2001-11-24 23:06   ` Zack Weinberg
2001-11-15 10:14 Richard Kenner
2001-11-15 10:36 ` Neil Booth
2001-11-25  5:06   ` Neil Booth
2001-11-25  4:23 ` Richard Kenner
2001-11-15 11:05 Richard Kenner
2001-11-15 12:07 ` Neil Booth
2001-11-25  5:23   ` Neil Booth
2001-11-15 14:55 ` Per Bothner
2001-11-25 10:27   ` Per Bothner
2001-11-25  5:13 ` Richard Kenner
2001-11-15 12:28 Richard Kenner
2001-11-15 12:44 ` Neil Booth
2001-11-25  5:33   ` Neil Booth
2001-11-25  5:25 ` Richard Kenner
2001-11-15 13:20 Richard Kenner
2001-11-15 13:20 ` Neil Booth
2001-11-25  6:34   ` Neil Booth
2001-11-16  8:52 ` Richard Henderson
2001-11-25 23:22   ` Richard Henderson
2001-11-25  6:29 ` Richard Kenner
2001-11-15 14:19 Richard Kenner
2001-11-25  6:42 ` Richard Kenner
2001-11-15 16:24 Richard Kenner
2001-11-15 17:08 ` Per Bothner
2001-11-25 14:33   ` Per Bothner
2001-11-25 13:44 ` Richard Kenner
2001-11-15 17:25 Richard Kenner
2001-11-15 17:39 ` Per Bothner
2001-11-25 14:50   ` Per Bothner
2001-11-25 14:37 ` Richard Kenner
2001-11-15 17:44 Richard Kenner
2001-11-15 19:52 ` Per Bothner
2001-11-25 16:13   ` Per Bothner
2001-11-25 15:01 ` Richard Kenner
2001-11-15 20:12 Richard Kenner
2001-11-15 20:19 ` Per Bothner
2001-11-25 16:48   ` Per Bothner
2001-11-25 16:24 ` Richard Kenner
2001-11-15 23:55 Richard Kenner
2001-11-25 17:22 ` Richard Kenner
2001-11-16  9:26 Richard Kenner
2001-11-26  3:15 ` Richard Kenner
2001-11-17 11:19 mike stump
2001-11-26 12:54 ` mike stump
2001-11-17 11:23 mike stump
2001-11-26 13:29 ` mike stump
2001-11-17 11:46 Richard Kenner
2001-11-26 13:36 ` Richard Kenner
2001-11-17 17:09 mike stump
2001-11-17 20:34 ` Per Bothner
2001-11-26 14:58   ` Per Bothner
2001-11-26 14:51 ` mike stump

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=20011124164155.B1538@codesourcery.com \
    --to=zack@codesourcery.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gdr@codesourcery.com \
    --cc=mark@codesourcery.com \
    --cc=neil@daikokuya.demon.co.uk \
    /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).