This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ICE in change_address at emit_rtl.c


mike stump wrote:-

> You can tell if they do, even if you don't have source code, by
> compiling something like:
> 
> struct A {
>   char int j;
> } a;
> 
> const int * ip;
> 
> main() {
>   *ip = 1;
>   a = a;
>   a.i = 1;
>   a.j = a.j;
> }
> 
> and get messages like:
> 
> terr.c:2: two or more data types in declaration of `j'
> terr.c: In function `main':
> terr.c:8: warning: assignment of read-only location
> terr.c:10: structure has no member named `i'
>
> If you fail to get at least all of these, or if you get extra ones,
> then the compiler is inferior and doesn't have anything like
> error_mark_node (in this context).  If you get roughly exactly these
> messages, then the compiler must.

Why?  How do you know that the compiler doesn't just have (in
pseudo-code)

void grokdeclarator (decl)
{
  [...]
  if (multiple_type_declspecs_given)
    {
      output_error_msg;
      assume_the_latter_type;
    }
  [...]
}

and so enters it in its symbol table as if it saw

struct A {
  int j;
} a;

I think this would produce the same error messages you describe, and I
see no need for an error_mark thingy.  This is just what I'm saying we
should do - have some kind of intelligent recovery to something sane
that fits what the user might have wanted as closely as we can guess,
and proceed as normal.

Neil.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]