public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/8960: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702
@ 2002-12-20 20:36 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2002-12-20 20:36 UTC (permalink / raw)
  To: ehrhardt, gcc-bugs, gcc-prs, nobody

Synopsis: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Dec 20 20:36:05 2002
State-Changed-Why:
    I can confirm the crash. However, the code does also crash
    2.95 for me:
    tmp/g> gcc -c x.c
    x.c:2: Internal compiler error in `layout_decl', at stor-layout.c:262
    Please submit a full bug report.
    See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
    
    So this would not qualify as a regression. Christian, could
    you double check what your results are with 2.95 on your
    two platforms?
    
    Thanks
      W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8960


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

* Re: c/8960: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702
@ 2002-12-21  9:06 Wolfgang Bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Bangerth @ 2002-12-21  9:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/8960; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
Cc: bangerth@dealii.org, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
   <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>
Subject: Re: c/8960: [3.2/3.3 regression] Segfault with __attribute__ ((mode
 (...))) in start_function:5702
Date: Sat, 21 Dec 2002 10:59:15 -0600 (CST)

 > Ooops. One shouldn't change test cases in the very last minute :-(
 > 
 > __attribute__ ((mode (TI))) int f (void) { }
 > 
 > (note TI instead of SI) indead crashes on 3.2/3.3 as described and
 > issues an error with 2.95.3 on sparc:
 > 
 > 7227-2.c:2: no data type for mode `TI'
 > 
 > However, this testcase results in an error with all gcc Versions on i386.
 
 Right. No crash on x86, but regression on sparc. And crash on x86 with all 
 versions and old testcase. Not better, anyway.
 
 Danke
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 


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

* Re: c/8960: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702
@ 2002-12-21  8:46 Christian Ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2002-12-21  8:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/8960; it has been noted by GNATS.

From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
  nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/8960: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702
Date: Sat, 21 Dec 2002 17:43:15 +0100

 On Sat, Dec 21, 2002 at 04:36:06AM -0000, bangerth@dealii.org wrote:
 > Synopsis: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702
 > 
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: bangerth
 > State-Changed-When: Fri Dec 20 20:36:05 2002
 > State-Changed-Why:
 >     I can confirm the crash. However, the code does also crash
 >     2.95 for me:
 >     tmp/g> gcc -c x.c
 >     x.c:2: Internal compiler error in `layout_decl', at stor-layout.c:262
 >     Please submit a full bug report.
 >     See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 >     
 >     So this would not qualify as a regression. Christian, could
 >     you double check what your results are with 2.95 on your
 >     two platforms?
 
 Ooops. One shouldn't change test cases in the very last minute :-(
 
 __attribute__ ((mode (TI))) int f (void) { }
 
 (note TI instead of SI) indead crashes on 3.2/3.3 as described and
 issues an error with 2.95.3 on sparc:
 
 7227-2.c:2: no data type for mode `TI'
 
 However, this testcase results in an error with all gcc Versions on i386.
 
     regards  Christian
 
 -- 
 THAT'S ALL FOLKS!


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

* c/8960: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702
@ 2002-12-16  6:36 Christian Ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2002-12-16  6:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8960
>Category:       c
>Synopsis:       [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 16 06:36:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Christian Ehrhardt
>Release:        3.2.2, 3.3
>Organization:
>Environment:
Mostly arch and version independant, but tested with this:

Reading specs from gcc-install/bin/../lib/gcc-lib/sparc-sun-solaris2.9/3.3/specs
Configured with: /home/thales/ehrhardt/gcc-cvs/gcc/configure --with-ld=/usr/local/bin/ld --with-as=/usr/local/bin/as --with-gnu-as --with-gnu-ld --enable-languages=c,c++ : (reconfigured) /home/thales/ehrhardt/gcc-cvs/gcc/configure --with-ld=/usr/local/bin/ld --with-as=/usr/local/bin/as --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --prefix=/home/thales/ehrhardt/gcc-install/
Thread model: posix
gcc version 3.3 20021204 (experimental)
SunOS theseus 5.9 Generic_112233-02 sun4u sparc SUNW,Ultra-4
>Description:
This  piece of code ICEs on virtually any 3.2 or 3.3 compiler and
on both sun-sparc-solaris and i386.
--------------------- cut --------------------
__attribute__ ((mode (SI)))
int f () { }
--------------------- cut --------------------

x.c:2: internal compiler error: Segmentation Fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

The segfault is in this piece of code in start_function:

  if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl1))))
    { 
      error ("return type is an incomplete type");
      /* Make it return void instead.  */
      TREE_TYPE (decl1)
        = build_function_type (void_type_node,
                               TYPE_ARG_TYPES (TREE_TYPE (decl1)));
    }

The real problem seems to be when applying attributs. gdb shows that
the following happens in start_function:

grokdeclarator creates a proper function declaration with return type int
in decl1. Afterwards decl_attributes is called to apply the mode attribute
to the function declaration. decl_attributes properly detects that the
mode attribute doesn't apply to a declaration but a type. The mistake is
that the attribute is then applied to the function type. This will
replace the function type with an SImode integer type.
Thus f becomes a function declaration with a type "int" instead of
"function returning int". This results in an ICE a few instructions
later.

     regards   Christian

>How-To-Repeat:
See description. Just compile the sample code with any 3.x compiler.
2.95.3 is fine.
>Fix:
Using a typedef for the return type fixes the ice but be aware that there
is another probably unrelated bug (PR 7227) which is about bad code
generation with some modes.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-12-21 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-20 20:36 c/8960: [3.2/3.3 regression] Segfault with __attribute__ ((mode (...))) in start_function:5702 bangerth
  -- strict thread matches above, loose matches on Subject: below --
2002-12-21  9:06 Wolfgang Bangerth
2002-12-21  8:46 Christian Ehrhardt
2002-12-16  6:36 Christian Ehrhardt

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