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]

[tree-ssa] PATCH: Two C regressions in GCC 3.4. (fwd)


I'm merging this change from the mainline into the tree-ssa branch.  There's
a few FC2 packages that are affected by the bug fixed in this change.

------- Forwarded Message

Return-Path: gcc-patches-return-113412-law=redhat.com@gcc.gnu.org
Delivery-Date: Thu Mar 18 12:04:29 2004
Return-Path: <gcc-patches-return-113412-law=redhat.com@gcc.gnu.org>
Received: from localhost (localhost [127.0.0.1])
	by redhat.com (8.12.10/8.12.8) with ESMTP id i2IJ3XYb019970
	for <law@localhost>; Thu, 18 Mar 2004 12:04:29 -0700
Received: from pobox.corp.redhat.com [172.16.52.156]
	by localhost with IMAP (fetchmail-6.2.0)
	for law@localhost (single-drop); Thu, 18 Mar 2004 12:04:29 -0700 (MST)
Received: from pobox.corp.redhat.com ([unix socket])
	by pobox.corp.redhat.com (Cyrus v2.1.12) with LMTP; Thu, 18 Mar 2004 13:57:27 
-0500
X-Sieve: CMU Sieve 2.2
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com 
[172.16.52.254])
	by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id i2IIvRK0028865
	for <law@pobox.corp.redhat.com>; Thu, 18 Mar 2004 13:57:27 -0500
Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31])
	by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id i2IIvQj07985
	for <law@redhat.com>; Thu, 18 Mar 2004 13:57:27 -0500
Received: from sources.redhat.com (sources.redhat.com [67.72.78.213])
	by mx1.redhat.com (8.12.10/8.12.10) with SMTP id i2IIvQ4b028520
	for <law@redhat.com>; Thu, 18 Mar 2004 13:57:26 -0500
Received: (qmail 30090 invoked by alias); 18 Mar 2004 18:57:14 -0000
Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:gcc-patches-unsubscribe-law=redhat.com@gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>
List-Post: <mailto:gcc-patches@gcc.gnu.org>
List-Help: <mailto:gcc-patches-help@gcc.gnu.org>
Sender: gcc-patches-owner@gcc.gnu.org
Delivered-To: mailing list gcc-patches@gcc.gnu.org
Received: (qmail 30082 invoked from network); 18 Mar 2004 18:57:13 -0000
Received: from unknown (HELO sirius.codesourcery.com) (65.74.133.4)
  by sources.redhat.com with SMTP; 18 Mar 2004 18:57:13 -0000
Received: from sirius.codesourcery.com (localhost.localdomain [127.0.0.1])
	by sirius.codesourcery.com (8.12.8/8.12.5) with ESMTP id i2IIvCIu015330
	for <gcc-patches@gcc.gnu.org>; Thu, 18 Mar 2004 10:57:12 -0800
Received: (from mitchell@localhost)
	by sirius.codesourcery.com (8.12.8/8.12.8/Submit) id i2IIvCBr015326;
	Thu, 18 Mar 2004 10:57:12 -0800
Date: Thu, 18 Mar 2004 10:57:12 -0800
Message-Id: <200403181857.i2IIvCBr015326@sirius.codesourcery.com>
From: Mark Mitchell <mark@codesourcery.com>
To: gcc-patches@gcc.gnu.org
Subject: PATCH: Two C regressions in GCC 3.4.
Reply-to: mark@codesourcery.com
X-RedHat-Spam-Score: 0 
X-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	version=2.62
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.62 (2004-01-11) on 
	speedy.slc.redhat.com


This patch fixes two regressions in C conformance for GCC 3.4 found by
running testsuites.

The first has to do with block-scope "extern" declarations for the
same identifier already declared as "static" in the global scope.  I
added code to issue an error about that a while back, but it's too
aggressive; that's only invalid if there's an intervening declaration
that makes the outer declaration invisible.

The second problem has to do with VLAs; something like:

+   typedef int T[n++];

caused DWARF2 to fall over.  I've not tried to express this in DWARF,
but I've kept the compiler from falling over.

Tested on i686-pc-linux-gnu, applied on the mainline and the 3.4
branch.

- --
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-03-18  Mark Mitchell  <mark@codesourcery.com>

	* c-decl.c (grokdeclarator): Do not complain about redeclaring
	visible "static" identifiers "extern" in a local scope.

	* dwarf2out.c (loc_descriptor_from_tree): Handle pre- and
	post-increments/decrements.

2004-03-18  Mark Mitchell  <mark@codesourcery.com>

	* gcc.dg/local1.c: New test.

	* gcc.dg/debug/dwarf2/c99-typedef1.c: New test.

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.470.4.10
diff -c -5 -p -r1.470.4.10 c-decl.c
*** c-decl.c	13 Mar 2004 19:05:46 -0000	1.470.4.10
- --- c-decl.c	18 Mar 2004 17:51:50 -0000
*************** grokdeclarator (tree declarator, tree de
*** 4414,4431 ****
  	else if (type_quals)
  	  type = c_build_qualified_type (type, type_quals);
  
  	/* It is invalid to create an `extern' declaration for a
  	   variable if there is a global declaration that is
! 	   `static'.  */
  	if (extern_ref && current_scope != global_scope)
  	  {
  	    tree global_decl;
  
  	    global_decl = identifier_global_value (declarator);
  	    if (global_decl
  		&& TREE_CODE (global_decl) == VAR_DECL
  		&& !TREE_PUBLIC (global_decl))
  	      error ("variable previously declared `static' redeclared "
  		     "`extern'");
  	  }
  
- --- 4414,4432 ----
  	else if (type_quals)
  	  type = c_build_qualified_type (type, type_quals);
  
  	/* It is invalid to create an `extern' declaration for a
  	   variable if there is a global declaration that is
! 	   `static' and the global declaration is not visible.  */
  	if (extern_ref && current_scope != global_scope)
  	  {
  	    tree global_decl;
  
  	    global_decl = identifier_global_value (declarator);
  	    if (global_decl
  		&& TREE_CODE (global_decl) == VAR_DECL
+ 		&& lookup_name (declarator) != global_decl
  		&& !TREE_PUBLIC (global_decl))
  	      error ("variable previously declared `static' redeclared "
  		     "`extern'");
  	  }
  
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.478.2.7
diff -c -5 -p -r1.478.2.7 dwarf2out.c
*** dwarf2out.c	9 Mar 2004 02:01:07 -0000	1.478.2.7
- --- dwarf2out.c	18 Mar 2004 17:51:51 -0000
*************** loc_descriptor_from_tree (tree loc, int 
*** 8504,8513 ****
- --- 8504,8520 ----
        return 0;
  
      case CALL_EXPR:
        return 0;
  
+     case PREINCREMENT_EXPR:
+     case PREDECREMENT_EXPR:
+     case POSTINCREMENT_EXPR:
+     case POSTDECREMENT_EXPR:
+       /* There are no opcodes for these operations.  */
+       return 0;
+ 
      case ADDR_EXPR:
        /* We can support this only if we can look through conversions and
  	 find an INDIRECT_EXPR.  */
        for (loc = TREE_OPERAND (loc, 0);
  	   TREE_CODE (loc) == CONVERT_EXPR || TREE_CODE (loc) == NOP_EXPR
Index: testsuite/gcc.dg/local1.c
===================================================================
RCS file: testsuite/gcc.dg/local1.c
diff -N testsuite/gcc.dg/local1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
- --- testsuite/gcc.dg/local1.c	18 Mar 2004 17:51:57 -0000
***************
*** 0 ****
- --- 1,7 ----
+ static int i;
+ 
+ extern int i;
+ 
+ static void f() {
+   extern int i;
+ }
Index: testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c
===================================================================
RCS file: testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c
diff -N testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
- --- testsuite/gcc.dg/debug/dwarf2/c99-typedef1.c	18 Mar 2004 17:51:58 -0000
***************
*** 0 ****
- --- 1,9 ----
+ // { dg-options "-std=iso9899:1999 -gdwarf-2" }
+ 
+ void f() {
+   int n = 3;
+   typedef int T[n++];
+   
+   T t;
+   t[0] = 7;
+ }

------- End of Forwarded Message




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