public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36944]  New: [4.4 Regression]: Revision 138123  C++ is broken
@ 2008-07-26 14:59 hjl dot tools at gmail dot com
  2008-07-26 15:00 ` [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++ hjl dot tools at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-26 14:59 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]

Revision 138123:

http://gcc.gnu.org/ml/gcc-cvs/2008-07/msg00834.html

may break C++:

[hjl@gnu-32 rrs]$ ./138127/usr/bin/gcc -m32 -S bar.ii
bar.ii: In constructor âxalanc_1_8::SelectionEvent::SelectionEvent(xalanc_1_8
tylesheetExecutionContext&, const xalanc_1_8::XalanNode*, const xalanc_1_8::E
TemplateElement&, const xalanc_1_8::XalanDOMString&, const xalanc_1_8::XPath&
ool)â:
bar.ii:25100: error: uninitialized member âxalanc_1_8::SelectionEvent::m_sele
onâ with âconstâ type âconst xalanc_1_8::XObjectPtrâ
bar.ii: In constructor âxalanc_1_8::SelectionEvent::SelectionEvent(xalanc_1_8
tylesheetExecutionContext&, const xalanc_1_8::XalanNode*, const xalanc_1_8::E
TemplateElement&, const xalanc_1_8::XalanDOMString&, const xalanc_1_8::XPath&
onst xalanc_1_8::NodeRefListBase&)â:
bar.ii:25121: error: uninitialized member âxalanc_1_8::SelectionEvent::m_sele
onâ with âconstâ type âconst xalanc_1_8::XObjectPtrâ
[hjl@gnu-32 rrs]$


-- 
           Summary: [4.4 Regression]: Revision 138123  C++ is broken
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
@ 2008-07-26 15:00 ` hjl dot tools at gmail dot com
  2008-07-26 17:09 ` hjl dot tools at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-26 15:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hjl dot tools at gmail dot com  2008-07-26 14:59 -------
Created an attachment (id=15965)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15965&action=view)
A testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
  2008-07-26 15:00 ` [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++ hjl dot tools at gmail dot com
@ 2008-07-26 17:09 ` hjl dot tools at gmail dot com
  2008-07-26 17:22 ` hjl dot tools at gmail dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-26 17:09 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]



------- Comment #2 from hjl dot tools at gmail dot com  2008-07-26 17:08 -------
A simple testcase:

bash-3.2$ cat /tmp/bar.cc
class XObject
{
public:
  int foo;
};

class XObjectPtr
{
public:
 explicit
 XObjectPtr(XObject* theXObject = 0) : m_xobjectPtr(theXObject)
 {
 }

private:
 XObject * m_xobjectPtr;
};

class SelectionEvent
{
public:
 SelectionEvent(bool selection) : m_selection() {}
 const XObjectPtr m_selection;
};
bash-3.2$ ./xgcc -B./ -S /tmp/bar.cc
/tmp/bar.cc: In constructor ‘SelectionEvent::SelectionEvent(bool)’:
/tmp/bar.cc:22: error: uninitialized member ‘SelectionEvent::m_selection’ with
‘const’ type ‘const XObjectPtr’
bash-3.2$ 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
  2008-07-26 15:00 ` [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++ hjl dot tools at gmail dot com
  2008-07-26 17:09 ` hjl dot tools at gmail dot com
@ 2008-07-26 17:22 ` hjl dot tools at gmail dot com
  2008-07-26 18:06 ` hjl dot tools at gmail dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-26 17:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl dot tools at gmail dot com  2008-07-26 17:21 -------
I am not sure if

/* Returns true iff class T has a user-provided default constructor.  */

bool
type_has_user_provided_default_constructor (tree t)
{
  tree fns; 

  if (!TYPE_HAS_USER_CONSTRUCTOR (t)) 
    return false;

  for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
    {    
      tree fn = OVL_CURRENT (fns);
      if (TREE_CODE (fn) == FUNCTION_DECL
          && user_provided_p (fn) 
          && (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
              == NULL_TREE))
        return true;
    }    

  return false;
}

is correct for

XObjectPtr(XObject* theXObject = 0) : m_xobjectPtr(theXObject)

There is an argument. But it has a default value. Shouldn't it match
XObjectPtr ()?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (2 preceding siblings ...)
  2008-07-26 17:22 ` hjl dot tools at gmail dot com
@ 2008-07-26 18:06 ` hjl dot tools at gmail dot com
  2008-07-26 19:05 ` hjl dot tools at gmail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-26 18:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl dot tools at gmail dot com  2008-07-26 18:05 -------
This works for me:

Index: class.c
===================================================================
--- class.c     (revision 138172)
+++ class.c     (working copy)
@@ -4107,7 +4107,7 @@ type_has_user_provided_constructor (tree
 bool
 type_has_user_provided_default_constructor (tree t)
 {
-  tree fns;
+  tree fns, args;

   if (!TYPE_HAS_USER_CONSTRUCTOR (t))
     return false;
@@ -4116,10 +4116,17 @@ type_has_user_provided_default_construct
     {
       tree fn = OVL_CURRENT (fns);
       if (TREE_CODE (fn) == FUNCTION_DECL
-         && user_provided_p (fn)
-         && (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
-             == NULL_TREE))
-       return true;
+         && user_provided_p (fn))
+       {
+         if (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
+             == NULL_TREE)
+           return true;
+         args = FUNCTION_FIRST_USER_PARMTYPE (fn);
+         while (args && TREE_PURPOSE (args))
+           args = TREE_CHAIN (args);
+         if (!args || args == void_list_node)
+           return true;
+       }
     }

   return false;

Is this correct?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (3 preceding siblings ...)
  2008-07-26 18:06 ` hjl dot tools at gmail dot com
@ 2008-07-26 19:05 ` hjl dot tools at gmail dot com
  2008-07-26 19:21 ` [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-26 19:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl dot tools at gmail dot com  2008-07-26 19:04 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2008-07/msg02096.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |07/msg02096.html


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (4 preceding siblings ...)
  2008-07-26 19:05 ` hjl dot tools at gmail dot com
@ 2008-07-26 19:21 ` pinskia at gcc dot gnu dot org
  2008-07-26 21:42 ` jason at redhat dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-07-26 19:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-07-26 19:20 -------
HJL,
  Can you please be a little more described in the summary of your bugs as
saying C++ is broken is not true and really counter productive as everyone
thinks C++ is really broken now.  But in reality it is only constructors with
default arguments and nothing more.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
            Summary|[4.4 Regression]: Revision  |[4.4 Regression]: Revision
                   |138123 breaks C++           |138123 breaks constructors
                   |                            |with default arguments
   Target Milestone|---                         |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (5 preceding siblings ...)
  2008-07-26 19:21 ` [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments pinskia at gcc dot gnu dot org
@ 2008-07-26 21:42 ` jason at redhat dot com
  2008-07-26 22:14 ` hjl dot tools at gmail dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at redhat dot com @ 2008-07-26 21:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at redhat dot com  2008-07-26 21:41 -------
Subject: Re:  [4.4 Regression]: Revision 138123 breaks C++

hjl dot tools at gmail dot com wrote:
> +         if (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
> +             == NULL_TREE)
> +           return true;
> +         args = FUNCTION_FIRST_USER_PARMTYPE (fn);
> +         while (args && TREE_PURPOSE (args))
> +           args = TREE_CHAIN (args);
> +         if (!args || args == void_list_node)
> +           return true;

> Is this correct?

You don't need the first three lines quoted above; the new code you 
added is enough.

Jason


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (6 preceding siblings ...)
  2008-07-26 21:42 ` jason at redhat dot com
@ 2008-07-26 22:14 ` hjl dot tools at gmail dot com
  2008-07-27 17:41 ` hjl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-26 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl dot tools at gmail dot com  2008-07-26 22:13 -------
(In reply to comment #7)
> Subject: Re:  [4.4 Regression]: Revision 138123 breaks C++
> 
> hjl dot tools at gmail dot com wrote:
> > +         if (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
> > +             == NULL_TREE)
> > +           return true;
> > +         args = FUNCTION_FIRST_USER_PARMTYPE (fn);
> > +         while (args && TREE_PURPOSE (args))
> > +           args = TREE_CHAIN (args);
> > +         if (!args || args == void_list_node)
> > +           return true;
> 
> > Is this correct?
> 
> You don't need the first three lines quoted above; the new code you 
> added is enough.
> 
> Jason
> 

Like this one:

http://gcc.gnu.org/ml/gcc-patches/2008-07/msg02108.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.0                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (7 preceding siblings ...)
  2008-07-26 22:14 ` hjl dot tools at gmail dot com
@ 2008-07-27 17:41 ` hjl at gcc dot gnu dot org
  2008-07-27 18:57 ` hjl dot tools at gmail dot com
  2008-08-17  0:09 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: hjl at gcc dot gnu dot org @ 2008-07-27 17:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hjl at gcc dot gnu dot org  2008-07-27 17:40 -------
Subject: Bug 36944

Author: hjl
Date: Sun Jul 27 17:40:04 2008
New Revision: 138194

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138194
Log:
gcc/cp/

2008-07-27  H.J. Lu  <hongjiu.lu@intel.com>

        PR c++/36944
        * class.c (type_has_user_provided_default_constructor): Handle
        default parameters.

gcc/testsuite/

2008-07-27  H.J. Lu  <hongjiu.lu@intel.com>

        PR c++/36944
        * g++.dg/other/pr36944.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/other/pr36944.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (8 preceding siblings ...)
  2008-07-27 17:41 ` hjl at gcc dot gnu dot org
@ 2008-07-27 18:57 ` hjl dot tools at gmail dot com
  2008-08-17  0:09 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-27 18:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from hjl dot tools at gmail dot com  2008-07-27 18:56 -------
Fixed.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments
  2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
                   ` (9 preceding siblings ...)
  2008-07-27 18:57 ` hjl dot tools at gmail dot com
@ 2008-08-17  0:09 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-17  0:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36944


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-08-17  0:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-26 14:59 [Bug c++/36944] New: [4.4 Regression]: Revision 138123 C++ is broken hjl dot tools at gmail dot com
2008-07-26 15:00 ` [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks C++ hjl dot tools at gmail dot com
2008-07-26 17:09 ` hjl dot tools at gmail dot com
2008-07-26 17:22 ` hjl dot tools at gmail dot com
2008-07-26 18:06 ` hjl dot tools at gmail dot com
2008-07-26 19:05 ` hjl dot tools at gmail dot com
2008-07-26 19:21 ` [Bug c++/36944] [4.4 Regression]: Revision 138123 breaks constructors with default arguments pinskia at gcc dot gnu dot org
2008-07-26 21:42 ` jason at redhat dot com
2008-07-26 22:14 ` hjl dot tools at gmail dot com
2008-07-27 17:41 ` hjl at gcc dot gnu dot org
2008-07-27 18:57 ` hjl dot tools at gmail dot com
2008-08-17  0:09 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).