Bug 31372 - [4.3 Regression] Segfault in cp/parser.c: cp_parser_parameter_declaration
Summary: [4.3 Regression] Segfault in cp/parser.c: cp_parser_parameter_declaration
Status: RESOLVED DUPLICATE of bug 31138
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-27 10:54 UTC by Martin Michlmayr
Modified: 2007-03-27 15:44 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2007-03-27 10:54:18 UTC
The following segfault happens with 4.3 SVN 20070318 and 
20070326, works with 20070303.

(sid)4967:tbm@coconut: ~] /usr/lib/gcc-snapshot/bin/g++ democracyplayer-fasttypes.cc
democracyplayer-fasttypes.cc:2: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
zsh: exit 1     /usr/lib/gcc-snapshot/bin/g++ democracyplayer-fasttypes.cc
(sid)4968:tbm@coconut: ~] cat democracyplayer-fasttypes.cc

template < class U >
  void foo (U (*), long ...)
  {
  }




Program received signal SIGSEGV, Segmentation fault.
cp_parser_parameter_declaration (parser=0x2b3a15801730, template_parm_p=0 '\0',
    parenthesized_p=0x7fff959c8227 "") at /home/tbm/scratch/gcc/gcc/cp/parser.c:12934
12934         if (DECL_P (type))
(gdb) where
#0  cp_parser_parameter_declaration (parser=0x2b3a15801730, template_parm_p=0 '\0',
    parenthesized_p=0x7fff959c8227 "") at /home/tbm/scratch/gcc/gcc/cp/parser.c:12934
#1  0x00000000004c1c88 in cp_parser_parameter_declaration_clause (parser=0x2b3a15801730)
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:12740
#2  0x00000000004c232b in cp_parser_declarator (parser=0x2b3a15801730,
    dcl_kind=CP_PARSER_DECLARATOR_NAMED, ctor_dtor_or_conv_p=0x7fff959c8360,
    parenthesized_p=<value optimized out>, member_p=0 '\0')
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:11967
#3  0x00000000004c77ab in cp_parser_init_declarator (parser=0x2b3a15801730,
    decl_specifiers=0x7fff959c83c0, checks=0x0, function_definition_allowed_p=1 '\001',
    member_p=1 '\001', declares_class_or_enum=0, function_definition_p=0x7fff959c841f "")
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:11476
#4  0x00000000004c939c in cp_parser_single_declaration (parser=0x2b3a15801730, checks=0x0,
    member_p=1 '\001', friend_p=<value optimized out>) at /home/tbm/scratch/gcc/gcc/cp/parser.c:16375
#5  0x00000000004c962e in cp_parser_template_declaration_after_export (parser=0x2b3a15801730,
    member_p=208 '▒') at /home/tbm/scratch/gcc/gcc/cp/parser.c:16234
#6  0x00000000004b30e9 in cp_parser_member_declaration (parser=0x2b3a15801730)
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:14206
#7  0x00000000004b44d2 in cp_parser_type_specifier (parser=0x2b3a15801730,
    flags=<value optimized out>, decl_specs=0x7fff959c86a0, is_declaration=1 '\001',
    declares_class_or_enum=0x7fff959c8640, is_cv_qualifier=<value optimized out>)
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:14137
#8  0x00000000004bdc3a in cp_parser_decl_specifier_seq (parser=0x2b3a15801730,
    flags=CP_PARSER_FLAGS_OPTIONAL, decl_specs=0x7fff959c86a0, declares_class_or_enum=0x7fff959c86f8)
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:7827
#9  0x00000000004c91f3 in cp_parser_single_declaration (parser=0x2b3a15801730, checks=0x0,
    member_p=0 '\0', friend_p=0x7fff959c8757 "") at /home/tbm/scratch/gcc/gcc/cp/parser.c:16319
#10 0x00000000004c962e in cp_parser_template_declaration_after_export (parser=0x2b3a15801730,
    member_p=208 '▒') at /home/tbm/scratch/gcc/gcc/cp/parser.c:16234
#11 0x00000000004caf0a in cp_parser_declaration (parser=0x2b3a15801730)
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:7370
#12 0x00000000004ca646 in cp_parser_declaration_seq_opt (parser=0x2b3a15801730)
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:7293
#13 0x00000000004cae8d in cp_parser_declaration (parser=0x2b3a15801730)
    at /home/tbm/scratch/gcc/gcc/cp/parser.c:11028
Comment 1 Martin Michlmayr 2007-03-27 10:54:56 UTC
Most likely caused by

2007-03-09  Douglas Gregor  <doug.gregor@gmail.com>

        PR c++/20599
...
Comment 2 Doug Gregor 2007-03-27 15:10:39 UTC
Does the following patch solve the problem?

  http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00799.html

Comment 3 Martin Michlmayr 2007-03-27 15:18:16 UTC

*** This bug has been marked as a duplicate of 31138 ***
Comment 4 Martin Michlmayr 2007-03-27 15:44:05 UTC
(In reply to comment #2)
> Does the following patch solve the problem?
> 
>   http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00799.html

Yes, with the typo (TREDE) corrected this work.

Sorry, I thought I had seen this patch before but couldn't find it before I
opened this PR.