public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3394: Attribute in derived class crashes compiler. Regression.
@ 2001-06-24 21:06 khan
0 siblings, 0 replies; 4+ messages in thread
From: khan @ 2001-06-24 21:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 3394
>Category: c++
>Synopsis: Attribute in derived class crashes compiler. Regression.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Sun Jun 24 21:06:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Mumit Khan
>Release: 3.0
>Organization:
>Environment:
Cygwin, Mingw and other x86-win32 targets. Host independent.
>Description:
>How-To-Repeat:
Just compiling the provided testcase will trigger the problem.
>Fix:
Patch in the attached description.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="gcc-bug1.txt"
Content-Disposition: inline; filename="gcc-bug1.txt"
The following code will crash the C++ front-end, a regression from
gcc-2.95.x.
struct
__attribute__((dllexport))
DllClassBase { };
struct
__attribute__((dllexport))
DllClass : public DllClassBase { };
The problem is quite simple -- when parsing the derived class DllClass,
the parameter passed to tree_low_cst in xref_basetypes has the type
TREE_LIST thanks to the attribute between class and name.
Patch at end of this report. Hmmm ... should I send this separately to
gcc-patches as well?
(gdb) r -quiet -version dll-bug1.ii
Starting program: /homes/khan/src/win32/cygwin/BUILD/orig-gcc3/gcc/cc1plus
-quiet -version dll-bug1.ii
Breakpoint 1 at 0x400411d2: file exit.c, line 40.
Breakpoint 3 at 0x40040008: file ../sysdeps/generic/abort.c, line 55.
GNU CPP version 3.0 (cpplib) (80386, BSD syntax)
GNU C++ version 3.0 (i686-pc-cygwin)
compiled by GNU C version 3.0.
Breakpoint 2, fancy_abort (
file=0x8370ec0 "/home/khan/src/gnu/gcc-3.0/gcc/tree.c", line=3462,
function=0x8371972 "tree_low_cst")
at /home/khan/src/gnu/gcc-3.0/gcc/diagnostic.c:1760
1760 internal_error ("Internal compiler error in %s, at %s:%d",
(gdb) bt
#0 fancy_abort (file=0x8370ec0 "/home/khan/src/gnu/gcc-3.0/gcc/tree.c",
line=3462, function=0x8371972 "tree_low_cst")
at /home/khan/src/gnu/gcc-3.0/gcc/diagnostic.c:1760
#1 0x810e0fa in tree_low_cst (t=0x40174230, pos=1)
at /home/khan/src/gnu/gcc-3.0/gcc/tree.c:3462
#2 0x806e814 in xref_basetypes (code_type_node=0x40174230,
name=0x40176100,
ref=0x40175478, binfo=0x40174280)
at /home/khan/src/gnu/gcc-3.0/gcc/cp/decl.c:12768
#3 0x80af0d5 in yyparse_1 () at /usr/lib/bison.simple:2409
#4 0x80fd26d in yyparse () at /home/khan/src/gnu/gcc-3.0/gcc/c-lex.c:158
#5 0x81026e3 in compile_file (name=0x844f2d7 "dll-bug1.ii")
at /home/khan/src/gnu/gcc-3.0/gcc/toplev.c:2369
#6 0x81069c6 in main (argc=4, argv=0xbffff6e4)
at /home/khan/src/gnu/gcc-3.0/gcc/toplev.c:4990
(gdb) up
#1 0x810e0fa in tree_low_cst (t=0x40174230, pos=1)
at /home/khan/src/gnu/gcc-3.0/gcc/tree.c:3462
3462 abort ();
(gdb) up
#2 0x806e814 in xref_basetypes (code_type_node=0x40174230, name=0x40176100, ref=0x40175478, binfo=0x40174280)
at /home/khan/src/gnu/gcc-3.0/gcc/cp/decl.c:12768
12768 enum tag_types tag_code = (enum tag_types) tree_low_cst (code_type_node, 1);
(gdb) p code_type_node
$1 = 0x40174230
(gdb) pt
<tree_list 0x40174230
purpose <tree_list 0x401741f4
purpose <identifier_node 0x40170380 dllexport
bindings <binding 0x40163f14 scope 0x40162000>>>
value <integer_cst 0x4015e020 type <integer_cst 0x4015e020 0> constant 0>>
2001-06-22 Mumit Khan <khan@nanotech.wisc.edu>
* decl.c (xref_basetypes): Handle attributes between 'class' and
name.
Index: gcc/cp/decl.c
===================================================================
RCS file: /homes/khan/src/win32/cygwin/CVSROOT/gcc-3.0/gcc/cp/decl.c,v
retrieving revision 1.2
diff -u -3 -p -r1.2 decl.c
--- gcc/cp/decl.c 2001/06/21 04:44:06 1.2
+++ gcc/cp/decl.c 2001/06/22 15:15:12
@@ -12765,6 +12765,14 @@ xref_basetypes (code_type_node, name, re
tree base;
int i, len;
+
+ /* If we are called from the parser, code_type_node will sometimes be a
+ TREE_LIST. This indicates that the user wrote
+ "class __attribute__ ((foo)) bar". Extract the attributes so that
+ tree_low_cst doesn't crash. */
+ if (TREE_CODE (code_type_node) == TREE_LIST)
+ code_type_node = TREE_VALUE (code_type_node);
+
enum tag_types tag_code = (enum tag_types) tree_low_cst (code_type_node, 1);
if (tag_code == union_type)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3394: Attribute in derived class crashes compiler. Regression.
@ 2001-08-12 7:44 lerdsuwa
0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2001-08-12 7:44 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, khan, nobody, rodrigc
Synopsis: Attribute in derived class crashes compiler. Regression.
State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sun Aug 12 07:44:01 2001
State-Changed-Why:
Confirm.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3394&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3394: Attribute in derived class crashes compiler. Regression.
@ 2001-07-12 5:07 rodrigc
0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2001-07-12 5:07 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, khan, nobody, rodrigc
Synopsis: Attribute in derived class crashes compiler. Regression.
State-Changed-From-To: feedback->open
State-Changed-By: rodrigc
State-Changed-When: Thu Jul 12 05:07:13 2001
State-Changed-Why:
Code provided.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3394&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3394: Attribute in derived class crashes compiler. Regression.
@ 2001-07-11 18:22 rodrigc
0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2001-07-11 18:22 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, khan, nobody, rodrigc
Synopsis: Attribute in derived class crashes compiler. Regression.
State-Changed-From-To: open->feedback
State-Changed-By: rodrigc
State-Changed-When: Wed Jul 11 18:22:37 2001
State-Changed-Why:
Your attachment contains no code.
Can you resend the attachment which contains
the code which illustrates the crash?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3394&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-08-12 7:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-24 21:06 c++/3394: Attribute in derived class crashes compiler. Regression khan
2001-07-11 18:22 rodrigc
2001-07-12 5:07 rodrigc
2001-08-12 7:44 lerdsuwa
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).