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]

C++ PATCH: PR 12795


This crash was easily fixed -- by removing some weird vestige of GNU
C's "nested functions" extensions.

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

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

2003-12-19  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12795
	* name-lookup.c (pushdecl): Do not treated any functions as being
	"nested" in C++.

2003-12-19  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12795
	* g++.dg/ext/attrib10.C: New test.

Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.26
diff -c -5 -p -r1.26 name-lookup.c
*** cp/name-lookup.c	16 Dec 2003 04:00:00 -0000	1.26
--- cp/name-lookup.c	19 Dec 2003 21:05:55 -0000
*************** pushdecl (tree x)
*** 560,570 ****
    else
      {
        if (current_function_decl && x != current_function_decl
  	  /* A local declaration for a function doesn't constitute
               nesting.  */
! 	  && !(TREE_CODE (x) == FUNCTION_DECL && !DECL_INITIAL (x))
  	  /* A local declaration for an `extern' variable is in the
  	     scope of the current namespace, not the current
  	     function.  */
  	  && !(TREE_CODE (x) == VAR_DECL && DECL_EXTERNAL (x))
  	  && !DECL_CONTEXT (x))
--- 560,570 ----
    else
      {
        if (current_function_decl && x != current_function_decl
  	  /* A local declaration for a function doesn't constitute
               nesting.  */
! 	  && TREE_CODE (x) != FUNCTION_DECL
  	  /* A local declaration for an `extern' variable is in the
  	     scope of the current namespace, not the current
  	     function.  */
  	  && !(TREE_CODE (x) == VAR_DECL && DECL_EXTERNAL (x))
  	  && !DECL_CONTEXT (x))
Index: testsuite/g++.dg/ext/attrib10.C
===================================================================
RCS file: testsuite/g++.dg/ext/attrib10.C
diff -N testsuite/g++.dg/ext/attrib10.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/ext/attrib10.C	19 Dec 2003 21:05:56 -0000
***************
*** 0 ****
--- 1,7 ----
+ // PR c++/12795
+ 
+ void foo()
+ {
+   extern void bar () __attribute__ ((__alias__ ("BAR")));
+   bar ();
+ }


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