public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: khan@nanotech.wisc.edu To: gcc-gnats@gcc.gnu.org Subject: c++/3394: Attribute in derived class crashes compiler. Regression. Date: Sun, 24 Jun 2001 21:06:00 -0000 [thread overview] Message-ID: <20010625035641.18643.qmail@sourceware.cygnus.com> (raw) >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)
next reply other threads:[~2001-06-24 21:06 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-06-24 21:06 khan [this message] 2001-07-11 18:22 rodrigc 2001-07-12 5:07 rodrigc 2001-08-12 7:44 lerdsuwa
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=20010625035641.18643.qmail@sourceware.cygnus.com \ --to=khan@nanotech.wisc.edu \ --cc=gcc-gnats@gcc.gnu.org \ /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: linkBe 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).