This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3.4 PATCH] PR c/16666: Backport from mainline


The following patch is a backport of Joseph Myers' fix for PR c/16666
which is a rejects-valid regression on the 3.4 branch.  This was fixed
on mainline back in October, but never applied to the gcc-3_4-branch.

The following version has been tested against the gcc-3_4-branch on
i686-pc-linux-gnu with a full "make bootstrap", all default languages,
and regression tested with a top-level "make -k check" with no new
failures.

Ok for the 3.4 branch?



2005-03-15  Roger Sayle  <roger@eyesopen.com>

	PR c/16666
	Backport from mainline.
	2004-10-30  Joseph S. Myers  <joseph@codesourcery.com>
	* c-decl.c (start_function): Don't check for DECL_BUILT_IN when
	determining whether to copy parameter types from a previous
	prototype declaration.

	PR c/16666
	Backport from mainline
	2004-10-30  Joseph S. Myers  <joseph@codesourcery.com>
	* gcc.dg/dremf-type-compat-1.c, gcc.dg/dremf-type-compat-2.c,
	gcc.dg/dremf-type-compat-3.c, gcc.dg/dremf-type-compat-4.c,
	gcc.dg/old-style-prom-1.c, gcc.dg/old-style-prom-2.c,
	gcc.dg/old-style-prom-3.c: New tests.


Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.470.4.18
diff -c -3 -p -r1.470.4.18 c-decl.c
*** c-decl.c	23 Dec 2004 23:50:46 -0000	1.470.4.18
--- c-decl.c	15 Mar 2005 18:39:13 -0000
*************** start_function (tree declspecs, tree dec
*** 5496,5506 ****
    DECL_INITIAL (decl1) = error_mark_node;

    /* If this definition isn't a prototype and we had a prototype declaration
!      before, copy the arg type info from that prototype.
!      But not if what we had before was a builtin function.  */
    old_decl = lookup_name_current_level (DECL_NAME (decl1));
    if (old_decl != 0 && TREE_CODE (TREE_TYPE (old_decl)) == FUNCTION_TYPE
-       && !DECL_BUILT_IN (old_decl)
        && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
  	  == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (old_decl))))
        && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0)
--- 5496,5504 ----
    DECL_INITIAL (decl1) = error_mark_node;

    /* If this definition isn't a prototype and we had a prototype declaration
!      before, copy the arg type info from that prototype.  */
    old_decl = lookup_name_current_level (DECL_NAME (decl1));
    if (old_decl != 0 && TREE_CODE (TREE_TYPE (old_decl)) == FUNCTION_TYPE
        && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
  	  == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (old_decl))))
        && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0)


Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]