[PATCH] Fix PR46241

Richard Guenther rguenther@suse.de
Wed Nov 3 13:29:00 GMT 2010


This fixes a missed conversion to translation-unit-decl handling
in dwarf2out.c.

Bootstrapped and tested on x86_64-unknown-linux-gnu, committed.

Richard.

2010-11-03  Richard Guenther  <rguenther@suse.de>

	PR middle-end/46241
	* dwarf2out.c (scope_die_for): Properly detect global scope.

	* g++.dg/debug/pr46241.C: New testcase.

Index: gcc/dwarf2out.c
===================================================================
*** gcc/dwarf2out.c	(revision 166238)
--- gcc/dwarf2out.c	(working copy)
*************** scope_die_for (tree t, dw_die_ref contex
*** 17739,17745 ****
    if (containing_scope && TREE_CODE (containing_scope) == FUNCTION_TYPE)
      containing_scope = NULL_TREE;
  
!   if (containing_scope == NULL_TREE)
      scope_die = comp_unit_die ();
    else if (TYPE_P (containing_scope))
      {
--- 17739,17745 ----
    if (containing_scope && TREE_CODE (containing_scope) == FUNCTION_TYPE)
      containing_scope = NULL_TREE;
  
!   if (SCOPE_FILE_SCOPE_P (containing_scope))
      scope_die = comp_unit_die ();
    else if (TYPE_P (containing_scope))
      {
Index: gcc/testsuite/g++.dg/debug/pr46241.C
===================================================================
*** gcc/testsuite/g++.dg/debug/pr46241.C	(revision 0)
--- gcc/testsuite/g++.dg/debug/pr46241.C	(revision 0)
***************
*** 0 ****
--- 1,19 ----
+ class btIDebugDraw;
+ class btCollisionWorld {
+     virtual btIDebugDraw* getDebugDrawer()  { };
+     static void rayTestSingle();
+ };
+ class btTriangleCallback {
+ public:
+     virtual ~btTriangleCallback();
+ };
+ class btTriangleRaycastCallback: public btTriangleCallback {
+ public:
+     btTriangleRaycastCallback();
+ };
+ void btCollisionWorld::rayTestSingle()
+ {
+   struct BridgeTriangleRaycastCallback : public btTriangleRaycastCallback {
+       BridgeTriangleRaycastCallback() : btTriangleRaycastCallback() { }
+   };
+ }



More information about the Gcc-patches mailing list