public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25301]  New: [3.4 regression] ICE for sizofe of incomplete type
@ 2005-12-07 20:30 reichelt at gcc dot gnu dot org
  2005-12-07 20:38 ` [Bug c/25301] " reichelt at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-12-07 20:30 UTC (permalink / raw)
  To: gcc-bugs

The testcase gcc.dg/noncompile/920923-1.c causes an ICE on the 3.4 branch.
A reduced testcase is:

=======================
typedef struct A B;
int i = sizeof(B);
=======================

bug.c:2: error: invalid application of `sizeof' to incomplete type `
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report, [etc.]

The culprit is the code in c-objc-common.c (c_tree_printer) <case 'T'>:

    case 'T':
      if (TREE_CODE (t) == TYPE_DECL)
        {
          if (DECL_NAME (t))
            n = (*lang_hooks.decl_printable_name) (t, 2);
        }
      else
        {
          t = TYPE_NAME (t);
          if (t)
            n = IDENTIFIER_POINTER (t);
        }
      break;

In the above case t is a RECORD_TYPE, but TYPE_NAME (t) is a TYPE_DECL.
So there's some logic missing to handle this case.


The other problem is that the testcase in the testsuite PASSed
despite the ICE. The comment on top of the testcase says:

  /* This test case contains a large number of syntactic errors.  We
     believe the intent of the test is that the compiler simply not
     crash.  The set of error messages reported is different when the C
     parser is generated with bison 1.50 than 1.35.  It is not worth
     attempting to prevent this.  Instead, we use a single dg-error with
     a regexp that will match _all_ the errors indiscriminately.  The
     old error/warning/etc markers are kept around for reference, but
     disabled.

     Revisit after new (recursive descent) parser is implemented for C.
     -- zw 2002-10-17  */

  /* { dg-error ".*" "many syntax errors" { target *-*-* } 0 } */

Well, the regexp also matches the ICE-message, so the testcase is
now broken. While this is probably hard to fix in 3.4 and 4.0,
the testcase be revisited on mainline and the 4.1 branch where the
new C parser is in place.

I'll file a new PR for this.


-- 
           Summary: [3.4 regression] ICE for sizofe of incomplete type
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, monitored
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25301


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/25301] [3.4 regression] ICE for sizofe of incomplete type
  2005-12-07 20:30 [Bug c/25301] New: [3.4 regression] ICE for sizofe of incomplete type reichelt at gcc dot gnu dot org
@ 2005-12-07 20:38 ` reichelt at gcc dot gnu dot org
  2005-12-07 20:40 ` [Bug c/25301] New: " Gabriel Dos Reis
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-12-07 20:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from reichelt at gcc dot gnu dot org  2005-12-07 20:38 -------
The PR for the testcase in the testsuite is PR 25302.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25301


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Bug c/25301]  New: [3.4 regression] ICE for sizofe of incomplete type
  2005-12-07 20:30 [Bug c/25301] New: [3.4 regression] ICE for sizofe of incomplete type reichelt at gcc dot gnu dot org
  2005-12-07 20:38 ` [Bug c/25301] " reichelt at gcc dot gnu dot org
@ 2005-12-07 20:40 ` Gabriel Dos Reis
  2005-12-07 20:40 ` [Bug c/25301] " gdr at integrable-solutions dot net
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Gabriel Dos Reis @ 2005-12-07 20:40 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

"reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| The testcase gcc.dg/noncompile/920923-1.c causes an ICE on the 3.4 branch.
| A reduced testcase is:
| 
| =======================
| typedef struct A B;
| int i = sizeof(B);
| =======================
| 
| bug.c:2: error: invalid application of `sizeof' to incomplete type `
| Internal compiler error: Error reporting routines re-entered.
| Please submit a full bug report, [etc.]
| 
| The culprit is the code in c-objc-common.c (c_tree_printer) <case 'T'>:
| 
|     case 'T':
|       if (TREE_CODE (t) == TYPE_DECL)
|         {
|           if (DECL_NAME (t))
|             n = (*lang_hooks.decl_printable_name) (t, 2);
|         }
|       else
|         {
|           t = TYPE_NAME (t);
|           if (t)
|             n = IDENTIFIER_POINTER (t);
|         }
|       break;
| 
| In the above case t is a RECORD_TYPE, but TYPE_NAME (t) is a TYPE_DECL.
| So there's some logic missing to handle this case.

In general, there is a "type" problem in both C and C++ front ends.
The documentation for TYPE_NAME says that it returns a TYPE_DECL -- as
opposed to an IDENTIFIER_NODE.  However, at various occasions I found
that a TYPE_NAME would return an IDENTIFIER_NODE.  That is a clear bug
in both front ends ans should be hunt.  Obviously, you have identified a
place where instead of correcting the problem the pretty-printer had
assumed that TYPE_NAME will always return an IDENTIFIER_NODE --
despite the documentation.  I believe a proper PR should be filled so
that both front ends are cured from that confusion. 

-- Gaby


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/25301] [3.4 regression] ICE for sizofe of incomplete type
  2005-12-07 20:30 [Bug c/25301] New: [3.4 regression] ICE for sizofe of incomplete type reichelt at gcc dot gnu dot org
  2005-12-07 20:38 ` [Bug c/25301] " reichelt at gcc dot gnu dot org
  2005-12-07 20:40 ` [Bug c/25301] New: " Gabriel Dos Reis
@ 2005-12-07 20:40 ` gdr at integrable-solutions dot net
  2005-12-07 20:47 ` [Bug c/25301] [3.4 regression] ICE for sizeof " reichelt at igpm dot rwth-aachen dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-12-07 20:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from gdr at integrable-solutions dot net  2005-12-07 20:40 -------
Subject: Re:   New: [3.4 regression] ICE for sizofe of incomplete type

"reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| The testcase gcc.dg/noncompile/920923-1.c causes an ICE on the 3.4 branch.
| A reduced testcase is:
| 
| =======================
| typedef struct A B;
| int i = sizeof(B);
| =======================
| 
| bug.c:2: error: invalid application of `sizeof' to incomplete type `
| Internal compiler error: Error reporting routines re-entered.
| Please submit a full bug report, [etc.]
| 
| The culprit is the code in c-objc-common.c (c_tree_printer) <case 'T'>:
| 
|     case 'T':
|       if (TREE_CODE (t) == TYPE_DECL)
|         {
|           if (DECL_NAME (t))
|             n = (*lang_hooks.decl_printable_name) (t, 2);
|         }
|       else
|         {
|           t = TYPE_NAME (t);
|           if (t)
|             n = IDENTIFIER_POINTER (t);
|         }
|       break;
| 
| In the above case t is a RECORD_TYPE, but TYPE_NAME (t) is a TYPE_DECL.
| So there's some logic missing to handle this case.

In general, there is a "type" problem in both C and C++ front ends.
The documentation for TYPE_NAME says that it returns a TYPE_DECL -- as
opposed to an IDENTIFIER_NODE.  However, at various occasions I found
that a TYPE_NAME would return an IDENTIFIER_NODE.  That is a clear bug
in both front ends ans should be hunt.  Obviously, you have identified a
place where instead of correcting the problem the pretty-printer had
assumed that TYPE_NAME will always return an IDENTIFIER_NODE --
despite the documentation.  I believe a proper PR should be filled so
that both front ends are cured from that confusion. 

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25301


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/25301] [3.4 regression] ICE for sizeof of incomplete type
  2005-12-07 20:30 [Bug c/25301] New: [3.4 regression] ICE for sizofe of incomplete type reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-12-07 20:40 ` [Bug c/25301] " gdr at integrable-solutions dot net
@ 2005-12-07 20:47 ` reichelt at igpm dot rwth-aachen dot de
  2006-03-05  3:44 ` pinskia at gcc dot gnu dot org
  2006-03-08 23:40 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: reichelt at igpm dot rwth-aachen dot de @ 2005-12-07 20:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from reichelt at igpm dot rwth-aachen dot de  2005-12-07 20:47 -------
Subject: Re:  [3.4 regression] ICE for sizofe of incomplete type

On  7 Dec, gdr at integrable-solutions dot net wrote:

> In general, there is a "type" problem in both C and C++ front ends.
> The documentation for TYPE_NAME says that it returns a TYPE_DECL -- as
> opposed to an IDENTIFIER_NODE.  However, at various occasions I found
> that a TYPE_NAME would return an IDENTIFIER_NODE.  That is a clear bug
> in both front ends ans should be hunt.  Obviously, you have identified a
> place where instead of correcting the problem the pretty-printer had
> assumed that TYPE_NAME will always return an IDENTIFIER_NODE --
> despite the documentation.  I believe a proper PR should be filled so
> that both front ends are cured from that confusion. 
> 
> -- Gaby

Would you mind filing this PR then?

Thanks,
Volker


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25301


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/25301] [3.4 regression] ICE for sizeof of incomplete type
  2005-12-07 20:30 [Bug c/25301] New: [3.4 regression] ICE for sizofe of incomplete type reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-12-07 20:47 ` [Bug c/25301] [3.4 regression] ICE for sizeof " reichelt at igpm dot rwth-aachen dot de
@ 2006-03-05  3:44 ` pinskia at gcc dot gnu dot org
  2006-03-08 23:40 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-05  3:44 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4.6


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25301


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/25301] [3.4 regression] ICE for sizeof of incomplete type
  2005-12-07 20:30 [Bug c/25301] New: [3.4 regression] ICE for sizofe of incomplete type reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-03-05  3:44 ` pinskia at gcc dot gnu dot org
@ 2006-03-08 23:40 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-08 23:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-03-08 23:40 -------
Fixed in 4.0.0.  3.4.6 has been tagged already and has been released (no
announcement has been made but it is up on the ftp server already).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|3.4.6                       |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25301


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-03-08 23:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07 20:30 [Bug c/25301] New: [3.4 regression] ICE for sizofe of incomplete type reichelt at gcc dot gnu dot org
2005-12-07 20:38 ` [Bug c/25301] " reichelt at gcc dot gnu dot org
2005-12-07 20:40 ` [Bug c/25301] New: " Gabriel Dos Reis
2005-12-07 20:40 ` [Bug c/25301] " gdr at integrable-solutions dot net
2005-12-07 20:47 ` [Bug c/25301] [3.4 regression] ICE for sizeof " reichelt at igpm dot rwth-aachen dot de
2006-03-05  3:44 ` pinskia at gcc dot gnu dot org
2006-03-08 23:40 ` pinskia at gcc dot gnu dot org

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).