This is the mail archive of the gcc-bugs@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]

Re: c++/7807: g++ 3.2 Fails to compile legal code that compiled OK with g++ 3.1


On Fri, Sep 13, 2002 at 08:35:36PM -0000, nathan@gcc.gnu.org wrote:
> Synopsis: g++ 3.2 Fails to compile legal code that compiled OK with g++ 3.1
> 
> State-Changed-From-To: open->analyzed
> State-Changed-By: nathan
> State-Changed-When: Fri Sep 13 13:35:35 2002
> State-Changed-Why:
>     confirmed as a regression
> 
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7807

The bug was introduced with the following patch:

2002-05-14  Alexandre Oliva  <aoliva@redhat.com>

Patch for C++ uninitialized pointer-to-member value
http://gcc.gnu.org/ml/gcc-patches/2002-05/msg01167.html


Here is a simplified version of the original bug-example on which I worked:

class RM
{
  class U;
  U* (U::* s2);
};

class OP
{
  int& f;
  RM pb;
  
public:
  OP (int f_): f (f_) {}
};

int i=9;
OP a(i);



The following patch is a workaround that solves bug-reports 7648 and 7807.
Alexandre, could you analyze further this problem?

Thanks,
Sebastian



Index: decl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.936
diff -d -u -p -r1.936 decl.c
--- decl.c	21 Sep 2002 12:51:53 -0000	1.936
+++ decl.c	29 Sep 2002 05:45:34 -0000
@@ -7830,7 +7830,7 @@ check_initializer (decl, init)
     }
   else if (!DECL_EXTERNAL (decl) && !zero_init_p (type))
     {
-      force_store_init_value (decl, build_forced_zero_init (type));
+//      force_store_init_value (decl, build_forced_zero_init (type));
 
       if (init)
 	goto process_init;
Index: typeck.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.429
diff -d -u -p -r1.429 typeck.c
--- typeck.c	21 Sep 2002 12:51:56 -0000	1.429
+++ typeck.c	29 Sep 2002 05:45:35 -0000
@@ -5838,8 +5838,12 @@ convert_for_assignment (type, rhs, errty
   rhstype = TREE_TYPE (rhs);
   coder = TREE_CODE (rhstype);
 
-  if (rhs == error_mark_node || rhstype == error_mark_node)
+  if (rhs == error_mark_node)
+    return error_mark_node;
+  
+  if (rhstype == error_mark_node)
     return error_mark_node;
+      
   if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node)
     return error_mark_node;
 


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