Bug 27953 - ICE with invalid function definitions
Summary: ICE with invalid function definitions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Lee Millward
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-06-08 10:42 UTC by Volker Reichelt
Modified: 2006-12-02 16:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-19 19:10:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-06-08 10:42:29 UTC
The following invalid code snippet triggers an ICE in the C frontend since
at least GCC 2.95.3:

=============================
void foo(struct A a) {}
void foo() {}
=============================

bug.c:1: warning: 'struct A' declared inside parameter list
bug.c:1: warning: its scope is only this definition or declaration, which is probably not what you want
bug.c:1: error: parameter 1 ('a') has incomplete type
bug.c:2: error: redefinition of 'foo'
bug.c:1: error: previous definition of 'foo' was here
bug.c: In function 'foo':
bug.c:2: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in store_parm_decls_oldstyle, at c-decl.c:6375
Please submit a full bug report, [etc.]
Comment 1 patchapp@dberlin.org 2006-08-20 07:33:09 UTC
Subject: Bug number PR c/27953

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00708.html
Comment 2 Lee Millward 2006-12-02 16:34:36 UTC
Subject: Bug 27953

Author: lmillward
Date: Sat Dec  2 16:34:26 2006
New Revision: 119446

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119446
Log:
	PR c/27953
	* c-decl.c (store_parm_decls_oldstyle): Robustify
        * gcc.dg/pr27953.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/pr27953.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Lee Millward 2006-12-02 16:39:24 UTC
Fixed in 4.3.
Comment 4 Tobias Burnus 2006-12-19 17:15:12 UTC
Subject: Bug 27953

Author: burnus
Date: Tue Dec 19 17:14:22 2006
New Revision: 120053

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120053
Log:
Merged revisions 119412-119459 via svnmerge from 
svn+ssh://gcc.gnu.org/svn/gcc/trunk

........
  r119412 | tkoenig | 2006-12-01 22:04:38 +0100 (Fr, 01 Dez 2006) | 70 lines
  
  2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>
  
  	PR libfortran/29568
  	* gfortran.dg/convert_implied_open.f90:  Change to
  	new default record length.
  	* gfortran.dg/unf_short_record_1.f90:  Adapt to
  	new error message.
  	* gfortran.dg/unformatted_subrecords_1.f90:  New test.
  
  2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>
  
  	PR libfortran/29568
  	* gfortran.h (gfc_option_t):  Add max_subrecord_length.
  	(top level): Define MAX_SUBRECORD_LENGTH.
  	* lang.opt:  Add option -fmax-subrecord-length=.
  	* trans-decl.c:  Add new function set_max_subrecord_length.
  	(gfc_generate_function_code): If we are within the main
  	program and max_subrecord_length has been set, call
  	set_max_subrecord_length.
  	* options.c (gfc_init_options):  Add defaults for
  	max_subrecord_lenght, convert and record_marker.
  	(gfc_handle_option):  Add handling for
  	-fmax_subrecord_length.
  	* invoke.texi:  Document the new default for
  	-frecord-marker=<n>.
  
  2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>
  
  	PR libfortran/29568
  	* libgfortran/libgfortran.h (compile_options_t):  Add
  	record_marker. (top level):  Define GFC_MAX_SUBRECORD_LENGTH.
  	* runtime/compile_options.c (set_record_marker):  Change
  	default to four-byte record marker.
  	(set_max_subrecord_length):  New function.
  	* runtime/error.c (translate_error):  Change error message
  	for short record on unformatted read.
  	* io/io.h (gfc_unit):  Add recl_subrecord, bytes_left_subrecord
  	and continued.
  	* io/file_pos.c (unformatted_backspace):  Change default of record
  	marker size to four bytes.  Loop over subrecords.
  	* io/open.c:  Default recl is max_offset.  If
  	compile_options.max_subrecord_length has been set, set set
  	u->recl_subrecord to its value, to the maximum value otherwise.
  	* io/transfer.c (top level):  Add prototypes for us_read, us_write,
  	next_record_r_unf and next_record_w_unf.
  	(read_block_direct):  Separate codepaths for unformatted direct
  	and unformatted sequential.  If a recl has been set by the
  	user, use the number of bytes left for the record if it is smaller
  	than the read request.  Loop over subrecords.  Set an error if the
  	user has set a recl and the read was short.
  	(write_buf):  Separate codepaths for unformatted direct and
  	unformatted sequential. If a recl has been set by the
  	user, use the number of bytes left for the record if it is smaller
  	than the read request.  Loop over subrecords.  Set an error if the
  	user has set a recl and the read was short.
  	(us_read):  Add parameter continued (to indicate that bytes_left
  	should not be intialized).  Change default of record marker size
  	to four bytes. Use subrecord.  If the subrecord length is smaller than
  	zero, this indicates a continuation.
  	(us_write):  Add parameter continued (to indicate that the continued
  	flag should be set).  Use subrecord.
  	(pre_position):  Use 0 for continued on us_write and us_read calls.
  	(skip_record):  New function.
  	(next_record_r_unf):  New function.
  	(next_record_r):  Use next_record_r_unf.
  	(write_us_marker):  Default size for record markers is four bytes.
  	(next_record_w_unf):  New function.
  	(next_record_w):  Use next_record_w_unf.
........
  r119415 | reichelt | 2006-12-01 22:28:35 +0100 (Fr, 01 Dez 2006) | 5 lines
  
  	PR c++/30021
  	* c-common.c (check_main_parameter_types): Check for error_mark_node.
  
  	* g++.dg/other/main1.C: New test.
........
  r119416 | reichelt | 2006-12-01 22:35:25 +0100 (Fr, 01 Dez 2006) | 7 lines
  
  	PR c++/30022
  	* typeck.c (type_after_usual_arithmetic_conversions):
  	Fix assertion for vector types.
  	(build_binary_op): Use temporary for inner type of vector types.
  
  	* g++.dg/ext/vector5.C: New test.
........
  r119421 | tsmigiel | 2006-12-01 23:43:18 +0100 (Fr, 01 Dez 2006) | 8 lines
  
          * config/spu/predicates.md (spu_mov_operand): Add.
          * config/spu/spu.c (spu_expand_extv): Remove unused code.
          (print_operand_address, print_operand): Handle addresses containing AND.
          (spu_split_load, spu_split_store): Use updated movti pattern.
          * config/spu/spu.md: (_mov<mode>, _movdi, _movti): Handle loads and
          stores in mov patterns for correct operation of reload.
          (lq, lq_<mode>, stq, stq_<mode>): Remove.
........
  r119422 | ebotcazou | 2006-12-01 23:46:45 +0100 (Fr, 01 Dez 2006) | 6 lines
  
  	* fold-const.c (fold_binary) <LT_EXPR>: Use the precision of the
  	type instead of the size of its mode to compute the highest and
  	lowest possible values.  Still check the size of the mode before
  	flipping the signedness of the comparison.
........
  r119424 | tsmigiel | 2006-12-01 23:51:06 +0100 (Fr, 01 Dez 2006) | 19 lines
  
  	* config/spu/spu.c (spu_immediate): Remove trailing comma.
  	(reloc_diagnostic): Call warning when -mwarn-reloc is specified.
  	* config/spu/spu.md: (zero_extendhisi2): Expand instead of split for
  	better optimization.
  	(floatv4siv4sf2): New.
  	(fix_truncv4sfv4si2): New.
  	(floatunsv4siv4sf2): New.
  	(fixuns_truncv4sfv4si2): New.
  	(addv16qi3): New.
  	(subv16qi3): New.
  	(negv16qi2): New.
  	(mulv8hi3): New.
  	(mulsi3): Remove.
  	(mul<mode>3): New.
  	(_mulv4si3): New.
  	(cmp<mode>): Don't accept constant arguments for DI, TI and SF.
  	* config/spu/spu_internals.h: Handle overloaded intrinsics in C++ with
  	spu_resolve_overloaded_builtin instead of static inline functions.
........
  r119427 | geoffk | 2006-12-02 00:01:05 +0100 (Sa, 02 Dez 2006) | 10 lines
  
  	* decl.c (poplevel): Check DECL_INITIAL invariant.
  	(duplicate_decls): Preserve DECL_INITIAL when eliminating
  	a new definition in favour of an old declaration.
  	(start_preparsed_function): Define and document value of
  	DECL_INITIAL before and after routine.
  	(finish_function): Check DECL_INITIAL invariant.
  	* parser.c 
  	(cp_parser_function_definition_from_specifiers_and_declarator): 
  	Skip duplicate function definitions.
........
  r119433 | gccadmin | 2006-12-02 01:17:43 +0100 (Sa, 02 Dez 2006) | 1 line
  
  Daily bump.
........
  r119435 | paolo | 2006-12-02 01:31:34 +0100 (Sa, 02 Dez 2006) | 5 lines
  
  2006-12-01  Paolo Carlini  <pcarlini@suse.de>
  
  	* include/ext/mt_allocator.h (__pool_base::_M_get_align): Remove
  	redundant const qualifier on the return type.
........
  r119437 | kazu | 2006-12-02 02:03:11 +0100 (Sa, 02 Dez 2006) | 4 lines
  
  	* Makefile.in, mingw32.h, trans.c: Fix comment typos.
  	* gnat_rm.texi, gnat_ugn.texi: Follow spelling conventions.
  	Fix typos.
........
  r119440 | kazu | 2006-12-02 02:44:17 +0100 (Sa, 02 Dez 2006) | 2 lines
  
  	* name-lookup.c: Follow spelling conventions.
........
  r119441 | kazu | 2006-12-02 03:06:52 +0100 (Sa, 02 Dez 2006) | 2 lines
  
  	* doc/extend.texi, doc/invoke.texi, doc/md.texi: Fix typos.
........
  r119442 | kazu | 2006-12-02 03:26:04 +0100 (Sa, 02 Dez 2006) | 13 lines
  
  	* builtins.c, cfgloop.h, cgraph.h, config/arm/arm.c,
  	config/i386/i386.c, config/i386/i386.h, config/mips/mips.h,
  	config/rs6000/cell.md, config/rs6000/rs6000.c, config/sh/sh.c,
  	config/sh/sh4-300.md, config/spu/spu-builtins.def,
  	config/spu/spu-c.c, config/spu/spu-modes.def,
  	config/spu/spu.c, config/spu/spu.md,
  	config/spu/spu_internals.h, config/spu/vmx2spu.h,
  	fold-const.c, fwprop.c, predict.c, tree-data-ref.h,
  	tree-flow.h, tree-ssa-loop-manip.c, tree-ssa-loop-niter.c,
  	tree-ssa-pre.c, tree-vect-analyze.c, tree-vect-transform.c,
  	tree-vectorizer.c, tree-vrp.c: Fix comment typos.  Follow
  	spelling conventions.
........
  r119443 | kazu | 2006-12-02 03:47:07 +0100 (Sa, 02 Dez 2006) | 2 lines
  
  	* config/i386/i386.c: Fix a comment typo.
........
  r119445 | hubicka | 2006-12-02 14:16:27 +0100 (Sa, 02 Dez 2006) | 6 lines
  
  	* config/i386/i386.c (pentium4_cost, nocona_cost): Update
  	32bit memcpy/memset decriptors.
  	(decide_alg): With -minline-all-stringops and sizes that are best
  	to be copied via libcall still work hard enough to pick non-libcall
  	strategy.
........
  r119446 | lmillward | 2006-12-02 17:34:26 +0100 (Sa, 02 Dez 2006) | 5 lines
  
  	PR c/27953
  	* c-decl.c (store_parm_decls_oldstyle): Robustify
          * gcc.dg/pr27953.c: New test.
........
  r119447 | ghazi | 2006-12-02 17:52:15 +0100 (Sa, 02 Dez 2006) | 12 lines
  
  	* configure.in: Update MPFR version in error message.
  
  	* configure: Regenerate.
  
  gcc:
  	* doc/install.texi: Update recommended MPFR version.  Remove
  	obsolete reference to cumulative patch.
  
  gcc/testsuite:
  	* gcc.dg/torture/builtin-sin-mpfr-1.c: Update MPFR comment.
........
  r119448 | lmillward | 2006-12-02 17:54:35 +0100 (Sa, 02 Dez 2006) | 3 lines
  
  fix testcase from previous commit
........
  r119449 | pinskia | 2006-12-02 18:01:04 +0100 (Sa, 02 Dez 2006) | 12 lines
  
  2006-12-02  Andrew Pinski  <andrew_pinski@playstation.sony.com>
  
          PR C++/30033
          * decl.c (cp_tree_node_structure): Handle STATIC_ASSERT.
  
  2006-12-02  Andrew Pinski  <andrew_pinski@playstation.sony.com>
  
          PR C++/30033
          *  g++.dg/cpp0x/static_assert4.C: New testcase.
........
  r119450 | paolo | 2006-12-02 18:06:57 +0100 (Sa, 02 Dez 2006) | 7 lines
  
  2006-12-02  Howard Hinnant  <hhinnant@apple.com>
  
  	* acinclude.m4: Allow OPTIMIZE_CXXFLAGS to be set by configure.host.
  	* configure.host: Set OPTIMIZE_CXXFLAGS to -fvisibility-inlines-hidden
  	for x86/darwin.
  	* configure: Regenerate.
........
  r119452 | ebotcazou | 2006-12-02 21:01:34 +0100 (Sa, 02 Dez 2006) | 3 lines
  
  	* configure.tgt: Force initial-exec TLS model on Linux only.
........
  r119454 | hjl | 2006-12-02 23:18:25 +0100 (Sa, 02 Dez 2006) | 14 lines
  
  2006-12-02  H.J. Lu  <hongjiu.lu@intel.com>
  
  	PR target/30040
  	* config/i386/driver-i386.c: Include "coretypes.h" and "tm.h".
  	(bit_SSSE3): New.
  	(host_detect_local_cpu): Check -mtune= vs. -march=. Rewrite
  	processor detection.
  
  	* config/i386/i386.h (CC1_CPU_SPEC): Add -mtune=native for
  	-march=native if there is no -mtune=*.
  
  	* config/i386/x-i386 (driver-i386.o): Also depend on $(TM_H)
  	coretypes.h.
........
  r119459 | gccadmin | 2006-12-03 01:17:51 +0100 (So, 03 Dez 2006) | 1 line
  
  Daily bump.
........

Added:
    branches/fortran-experiments/gcc/testsuite/g++.dg/cpp0x/static_assert4.C
      - copied unchanged from r119459, trunk/gcc/testsuite/g++.dg/cpp0x/static_assert4.C
    branches/fortran-experiments/gcc/testsuite/g++.dg/ext/vector5.C
      - copied unchanged from r119459, trunk/gcc/testsuite/g++.dg/ext/vector5.C
    branches/fortran-experiments/gcc/testsuite/g++.dg/other/main1.C
      - copied unchanged from r119459, trunk/gcc/testsuite/g++.dg/other/main1.C
    branches/fortran-experiments/gcc/testsuite/gcc.dg/pr27953.c
      - copied unchanged from r119459, trunk/gcc/testsuite/gcc.dg/pr27953.c
    branches/fortran-experiments/gcc/testsuite/gfortran.dg/unformatted_subrecord_1.f90
      - copied unchanged from r119459, trunk/gcc/testsuite/gfortran.dg/unformatted_subrecord_1.f90
Modified:
    branches/fortran-experiments/   (props changed)
    branches/fortran-experiments/ChangeLog
    branches/fortran-experiments/configure
    branches/fortran-experiments/configure.in
    branches/fortran-experiments/gcc/ChangeLog
    branches/fortran-experiments/gcc/DATESTAMP
    branches/fortran-experiments/gcc/ada/ChangeLog
    branches/fortran-experiments/gcc/ada/Makefile.in
    branches/fortran-experiments/gcc/ada/gnat_rm.texi
    branches/fortran-experiments/gcc/ada/gnat_ugn.texi
    branches/fortran-experiments/gcc/ada/mingw32.h
    branches/fortran-experiments/gcc/ada/trans.c
    branches/fortran-experiments/gcc/builtins.c
    branches/fortran-experiments/gcc/c-common.c
    branches/fortran-experiments/gcc/c-decl.c
    branches/fortran-experiments/gcc/cfgloop.h
    branches/fortran-experiments/gcc/cgraph.h
    branches/fortran-experiments/gcc/config/arm/arm.c
    branches/fortran-experiments/gcc/config/i386/driver-i386.c
    branches/fortran-experiments/gcc/config/i386/i386.c
    branches/fortran-experiments/gcc/config/i386/i386.h
    branches/fortran-experiments/gcc/config/i386/x-i386
    branches/fortran-experiments/gcc/config/mips/mips.h
    branches/fortran-experiments/gcc/config/rs6000/cell.md
    branches/fortran-experiments/gcc/config/rs6000/rs6000.c
    branches/fortran-experiments/gcc/config/sh/sh.c
    branches/fortran-experiments/gcc/config/sh/sh4-300.md
    branches/fortran-experiments/gcc/config/spu/predicates.md
    branches/fortran-experiments/gcc/config/spu/spu-builtins.def
    branches/fortran-experiments/gcc/config/spu/spu-c.c
    branches/fortran-experiments/gcc/config/spu/spu-modes.def
    branches/fortran-experiments/gcc/config/spu/spu.c
    branches/fortran-experiments/gcc/config/spu/spu.md
    branches/fortran-experiments/gcc/config/spu/spu_internals.h
    branches/fortran-experiments/gcc/config/spu/vmx2spu.h
    branches/fortran-experiments/gcc/cp/ChangeLog
    branches/fortran-experiments/gcc/cp/decl.c
    branches/fortran-experiments/gcc/cp/method.c
    branches/fortran-experiments/gcc/cp/name-lookup.c
    branches/fortran-experiments/gcc/cp/parser.c
    branches/fortran-experiments/gcc/cp/typeck.c
    branches/fortran-experiments/gcc/doc/extend.texi
    branches/fortran-experiments/gcc/doc/install.texi
    branches/fortran-experiments/gcc/doc/invoke.texi
    branches/fortran-experiments/gcc/doc/md.texi
    branches/fortran-experiments/gcc/fold-const.c
    branches/fortran-experiments/gcc/fortran/ChangeLog
    branches/fortran-experiments/gcc/fortran/gfortran.h
    branches/fortran-experiments/gcc/fortran/invoke.texi
    branches/fortran-experiments/gcc/fortran/lang.opt
    branches/fortran-experiments/gcc/fortran/options.c
    branches/fortran-experiments/gcc/fortran/trans-decl.c
    branches/fortran-experiments/gcc/fwprop.c
    branches/fortran-experiments/gcc/predict.c
    branches/fortran-experiments/gcc/testsuite/ChangeLog
    branches/fortran-experiments/gcc/testsuite/gcc.dg/torture/builtin-sin-mpfr-1.c
    branches/fortran-experiments/gcc/testsuite/gfortran.dg/convert_implied_open.f90
    branches/fortran-experiments/gcc/testsuite/gfortran.dg/unf_short_record_1.f90
    branches/fortran-experiments/gcc/tree-data-ref.h
    branches/fortran-experiments/gcc/tree-flow.h
    branches/fortran-experiments/gcc/tree-ssa-loop-manip.c
    branches/fortran-experiments/gcc/tree-ssa-loop-niter.c
    branches/fortran-experiments/gcc/tree-ssa-pre.c
    branches/fortran-experiments/gcc/tree-vect-analyze.c
    branches/fortran-experiments/gcc/tree-vect-transform.c
    branches/fortran-experiments/gcc/tree-vectorizer.c
    branches/fortran-experiments/gcc/tree-vrp.c
    branches/fortran-experiments/libgfortran/ChangeLog
    branches/fortran-experiments/libgfortran/io/file_pos.c
    branches/fortran-experiments/libgfortran/io/io.h
    branches/fortran-experiments/libgfortran/io/open.c
    branches/fortran-experiments/libgfortran/io/transfer.c
    branches/fortran-experiments/libgfortran/libgfortran.h
    branches/fortran-experiments/libgfortran/runtime/compile_options.c
    branches/fortran-experiments/libgfortran/runtime/error.c
    branches/fortran-experiments/libgomp/ChangeLog
    branches/fortran-experiments/libgomp/configure.tgt
    branches/fortran-experiments/libstdc++-v3/ChangeLog
    branches/fortran-experiments/libstdc++-v3/acinclude.m4
    branches/fortran-experiments/libstdc++-v3/configure
    branches/fortran-experiments/libstdc++-v3/configure.host
    branches/fortran-experiments/libstdc++-v3/include/ext/mt_allocator.h

Propchange: branches/fortran-experiments/
            ('svnmerge-integrated' modified)