public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18191] New: Struct member is not getting default-initialized
@ 2004-10-28  8:10 grigory dot zagorodnev at intel dot com
  2004-10-28 14:19 ` [Bug middle-end/18191] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: grigory dot zagorodnev at intel dot com @ 2004-10-28  8:10 UTC (permalink / raw)
  To: gcc-bugs

In the example listed below, member "i" of object "obj" allocated at frame 
of "bar" routine is not getting default-initialized to 0 but contains any 
garbage left on the stack. That violates clause 8.5.1/7 of the C++ Standard.

$ cat bar.cpp
#include <cstdio>

struct S {
    const char* s;
    int         i;
};
 
void foo() { 
    // Put some garbage on the stack
    S dummy[2];
    for (int i = 0; i < sizeof(dummy); i++) 
        ((char *)&dummy)[i] = -1; 
}
 
int bar() {
    // Allocate object on the stack
    S obj[2] = {
        {"m0"},
        { }
    };
    // Assume fields those not explicitly initialized
    // are default initialized to 0 [8.5.1/7 and 8.5/5]
    if (obj[0].i == 0){
        return 0;
    } else {
        printf("Failed: obj[0].i == '%d', expecting '0'\n", obj[0].i);
        return 1;
    }
};
 
int main(){
    foo();
    return bar();
}

$ g++ bar.cpp ; ./a.out
Failed: obj[0].i == '-1', expecting '0'

-- 
           Summary: Struct member is not getting default-initialized
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: grigory dot zagorodnev at intel dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-redhat-linux
  GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
@ 2004-10-28 14:19 ` pinskia at gcc dot gnu dot org
  2004-11-08 15:06 ` pinskia at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28 14:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-28 14:19 -------
Confirmed, a regression but I don't know if this is a middle-end problem or a front-end problem.
The front-end produces the following code:
    struct S obj[2] = {{.s=(const char *) "m0"}, {}};

This is a middle-end (the gimplifier) issue as the C front-end has the same problem (the C standard 
defines it in 6.7.8/21).

The C example:
#include <stdio.h>

typedef struct S {
    const char* s;
    int         i;
} S;

void foo() {
    // Put some garbage on the stack
    S dummy[2];
    for (unsigned i = 0; i < sizeof(dummy); i++)
        ((char *)&dummy)[i] = -1;
}

int bar() {
    // Allocate object on the stack
    S obj[2] = {
        {"m0"},
        { }
    };
    // Assume fields those not explicitly initialized
    // are default initialized to 0 [8.5.1/7 and 8.5/5]
    if (obj[0].i == 0){
        return 0;
    } else {
        printf("Failed: obj[0].i == '%d', expecting '0'\n", obj[0].i);
        return 1;
    }
};

int main(){
    foo();
    return bar();
}

Note we get a warning which is bogus:
pr18191.c:23: warning: 'obj$0$i' is used uninitialized in this function

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-28 14:19:42
               date|                            |
            Summary|Struct member is not getting|[4.0 Regression] Struct
                   |default-initialized         |member is not getting
                   |                            |default-initialized
   Target Milestone|---                         |4.0.0


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
  2004-10-28 14:19 ` [Bug middle-end/18191] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-11-08 15:06 ` pinskia at gcc dot gnu dot org
  2004-11-28 13:16 ` steven at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-08 15:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-08 15:06 -------
Note expand used to do this for us:
        /* If the constructor has fewer fields than the structure or
           if we are initializing the structure to mostly zeros, clear
           the whole structure first.  Don't do this if TARGET is a
           register whose mode size isn't equal to SIZE since
           clear_storage can't handle this case.  */



-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
  2004-10-28 14:19 ` [Bug middle-end/18191] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2004-11-08 15:06 ` pinskia at gcc dot gnu dot org
@ 2004-11-28 13:16 ` steven at gcc dot gnu dot org
  2004-11-28 13:18 ` steven at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-11-28 13:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-11-28 13:16 -------
Since this is language specific behavior, I think this is a C/C++ front 
end bug.  The front end should produce the default initializers.  What 
do our C/C++ FE maintainers think about this? 
 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot
                   |                            |org, mark at codesourcery
                   |                            |dot com


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (2 preceding siblings ...)
  2004-11-28 13:16 ` steven at gcc dot gnu dot org
@ 2004-11-28 13:18 ` steven at gcc dot gnu dot org
  2004-12-15 14:48 ` steven at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-11-28 13:18 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (3 preceding siblings ...)
  2004-11-28 13:18 ` steven at gcc dot gnu dot org
@ 2004-12-15 14:48 ` steven at gcc dot gnu dot org
  2004-12-15 14:50 ` steven at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 14:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 14:46 -------
I thought this could be an SRA bug, but it also happens with optimization 
disabled. 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (4 preceding siblings ...)
  2004-12-15 14:48 ` steven at gcc dot gnu dot org
@ 2004-12-15 14:50 ` steven at gcc dot gnu dot org
  2004-12-15 14:56 ` steven at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 14:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 14:50 -------
We never call store_constructor at all for this test case. 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (5 preceding siblings ...)
  2004-12-15 14:50 ` steven at gcc dot gnu dot org
@ 2004-12-15 14:56 ` steven at gcc dot gnu dot org
  2004-12-15 15:16 ` steven at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 14:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 14:56 -------
>From gimplify.c: 
 
/* A subroutine of gimplify_modify_expr.  Break out elements of a 
   CONSTRUCTOR used as an initializer into separate MODIFY_EXPRs. 
 
   Note that we still need to clear any elements that don't have explicit 
   initializers, so if not all elements are initialized we keep the 
   original MODIFY_EXPR, we just remove all of the constructor elements.  */ 
 
static enum gimplify_status 
gimplify_init_constructor (tree *expr_p, tree *pre_p, 
                           tree *post_p, bool want_value) 
 
So apparently we fail here. 
 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (6 preceding siblings ...)
  2004-12-15 14:56 ` steven at gcc dot gnu dot org
@ 2004-12-15 15:16 ` steven at gcc dot gnu dot org
  2004-12-15 15:29 ` steven at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 15:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 15:16 -------
methinks the bug is in this code:   
   
        /* ??? This bit ought not be needed.  For any element not present   
           in the initializer, we should simply set them to zero.  Except   
           we'd need to *find* the elements that are not present, and that   
           requires trickery to avoid quadratic compile-time behavior in   
           large cases or excessive memory use in small cases.  */   
        else   
          {   
            HOST_WIDE_INT len = list_length (elt_list);   
            if (TREE_CODE (type) == ARRAY_TYPE)   
              {   
                tree nelts = array_type_nelts (type);   
                if (!host_integerp (nelts, 1)   
                    || tree_low_cst (nelts, 1) + 1 != len)   
                  cleared = true;   
              }   
            else if (len != fields_length (type))   
              cleared = true;   
          }   
   
   
We have this expr:   
   
objD.1485 = {{.sD.1468=(const charD.1 *) (charD.1 *) "m0"}, {}}   
   
The type of the constructor is an ARRAY_TYPE, nelts == 1, and len (the length    
of the constructor) is 2.  So nelts+1 == 2, and we set cleared = true.  But   
we ignore the fact that the second element of the constructor is empty, and   
that the first one is incomplete.   
 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (7 preceding siblings ...)
  2004-12-15 15:16 ` steven at gcc dot gnu dot org
@ 2004-12-15 15:29 ` steven at gcc dot gnu dot org
  2004-12-15 20:45 ` steven at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 15:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 15:29 -------
This is RTH's code. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at redhat dot com


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (8 preceding siblings ...)
  2004-12-15 15:29 ` steven at gcc dot gnu dot org
@ 2004-12-15 20:45 ` steven at gcc dot gnu dot org
  2004-12-15 22:20 ` steven at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 20:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 20:45 -------
Might as well make it mine. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (9 preceding siblings ...)
  2004-12-15 20:45 ` steven at gcc dot gnu dot org
@ 2004-12-15 22:20 ` steven at gcc dot gnu dot org
  2004-12-15 22:21 ` steven at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 22:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 22:20 -------
The patch causes three new failures: 
g++.dg/init/new4.C (test for excess errors) 
gcc.dg/i386-3dnow-1.c (test for excess errors) 
gcc.dg/i386-3dnow-2.c (test for excess errors) 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (10 preceding siblings ...)
  2004-12-15 22:20 ` steven at gcc dot gnu dot org
@ 2004-12-15 22:21 ` steven at gcc dot gnu dot org
  2004-12-16  7:56 ` steven at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-15 22:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-15 22:21 -------
...but that's probably because of a bug already pointed out by rth.  I'll 
retest the fixed patch.  *sigh* 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (11 preceding siblings ...)
  2004-12-15 22:21 ` steven at gcc dot gnu dot org
@ 2004-12-16  7:56 ` steven at gcc dot gnu dot org
  2004-12-16 18:08 ` steven at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-16  7:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-16 07:56 -------
The new4.C failure happens because we trip over an assert: 
 
#1  0x0000000000629120 in gimplify_init_ctor_eval (object=0x2a95999bc0, 
list=0x2a9599bf00, 
    pre_p=0x7fbfffca08, cleared=0 '\0') at gimplify.c:2404 
2404              gcc_assert (TREE_CODE (purpose) != RANGE_EXPR); 
 
the test case is this: 
int *x = new int [2] (); 
 
For some reason the constructor has three (!) elements instead of two, 
which probably causes this bug to be hidden in the existing code. 
 
The other two are also cases where the "cleared" flag used to be set when 
it really shouldn't have been, so that's another latent but that my patch 
uncovers :-( 
 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (12 preceding siblings ...)
  2004-12-16  7:56 ` steven at gcc dot gnu dot org
@ 2004-12-16 18:08 ` steven at gcc dot gnu dot org
  2004-12-16 23:53 ` steven at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-16 18:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-16 18:07 -------
Someone had a bad day: 
 
    case ARRAY_TYPE: 
    case VECTOR_TYPE: 
      /* We're already checked the component type (TREE_TYPE), so just check 
         the index type.  */ 
      return type_contains_placeholder_p (TYPE_DOMAIN (type)); 
 
But a VECTOR_TYPE doesn't have a TYPE_DOMAIN, so we ICE.  This is the  
cause of the gcc.dg/i386-3dnow-[12].c failures. 
 
 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (13 preceding siblings ...)
  2004-12-16 18:08 ` steven at gcc dot gnu dot org
@ 2004-12-16 23:53 ` steven at gcc dot gnu dot org
  2004-12-17  1:36 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-16 23:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-16 23:52 -------
The new4.C failure is, in fact, PR18999. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |18999


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (14 preceding siblings ...)
  2004-12-16 23:53 ` steven at gcc dot gnu dot org
@ 2004-12-17  1:36 ` pinskia at gcc dot gnu dot org
  2004-12-18  0:22 ` steven at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-17  1:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-17 01:35 -------
(In reply to comment #15)
> The new4.C failure is, in fact, PR18999. 

I added a patch to PR18999 which implements the loop version for handling RANGE_EXPR.

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (15 preceding siblings ...)
  2004-12-17  1:36 ` pinskia at gcc dot gnu dot org
@ 2004-12-18  0:22 ` steven at gcc dot gnu dot org
  2004-12-19 13:03 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-18  0:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-18 00:22 -------
Posted a patch: 
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01322.html 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (16 preceding siblings ...)
  2004-12-18  0:22 ` steven at gcc dot gnu dot org
@ 2004-12-19 13:03 ` steven at gcc dot gnu dot org
  2004-12-20 11:27 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-19 13:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-19 13:03 -------
Updated patch posted. 
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01384.html 

-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (17 preceding siblings ...)
  2004-12-19 13:03 ` steven at gcc dot gnu dot org
@ 2004-12-20 11:27 ` cvs-commit at gcc dot gnu dot org
  2004-12-20 11:28 ` steven at gcc dot gnu dot org
  2004-12-20 11:29 ` steven at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-20 11:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-20 11:27 -------
Subject: Bug 18191

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	steven@gcc.gnu.org	2004-12-20 11:26:47

Modified files:
	gcc            : ChangeLog expr.c gimplify.c tree.h 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: 20041219-1.c 

Log message:
	gcc/
	PR middle-end/18191
	PR middle-end/18965
	PR middle-end/18999
	* expr.c (categorize_ctor_elements_1): Count the total number
	of elements in the constructor.
	(categorize_ctor_elements): Return it in a new argument.
	* tree.h (categorize_ctor_elements): Adjust prototype.
	* gimplify.c (gimplify_init_ctor_eval_range): New.
	(gimplify_init_ctor_eval): Gimplify RANGE_EXPR.
	(gimplify_init_constructor): Block clear the object if the
	constructor has fewer elements than the object type.  Only try
	to add assignments to individual elements when we have to.
	
	testsuite/
	* gcc.dg/20041219-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6897&r2=2.6898
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.761&r2=1.762
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.93&r2=2.94
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.667&r2=1.668
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4783&r2=1.4784
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20041219-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (18 preceding siblings ...)
  2004-12-20 11:27 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-20 11:28 ` steven at gcc dot gnu dot org
  2004-12-20 11:29 ` steven at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-20 11:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-20 11:28 -------
Fixed.

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


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


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

* [Bug middle-end/18191] [4.0 Regression] Struct member is not getting default-initialized
  2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
                   ` (19 preceding siblings ...)
  2004-12-20 11:28 ` steven at gcc dot gnu dot org
@ 2004-12-20 11:29 ` steven at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-20 11:29 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 18191 depends on bug 18999, which changed state.

Bug 18999 Summary: gimplify_init_ctor_eval does not support RANGE_EXPRs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18999

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


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

end of thread, other threads:[~2004-12-20 11:29 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28  8:10 [Bug c++/18191] New: Struct member is not getting default-initialized grigory dot zagorodnev at intel dot com
2004-10-28 14:19 ` [Bug middle-end/18191] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-08 15:06 ` pinskia at gcc dot gnu dot org
2004-11-28 13:16 ` steven at gcc dot gnu dot org
2004-11-28 13:18 ` steven at gcc dot gnu dot org
2004-12-15 14:48 ` steven at gcc dot gnu dot org
2004-12-15 14:50 ` steven at gcc dot gnu dot org
2004-12-15 14:56 ` steven at gcc dot gnu dot org
2004-12-15 15:16 ` steven at gcc dot gnu dot org
2004-12-15 15:29 ` steven at gcc dot gnu dot org
2004-12-15 20:45 ` steven at gcc dot gnu dot org
2004-12-15 22:20 ` steven at gcc dot gnu dot org
2004-12-15 22:21 ` steven at gcc dot gnu dot org
2004-12-16  7:56 ` steven at gcc dot gnu dot org
2004-12-16 18:08 ` steven at gcc dot gnu dot org
2004-12-16 23:53 ` steven at gcc dot gnu dot org
2004-12-17  1:36 ` pinskia at gcc dot gnu dot org
2004-12-18  0:22 ` steven at gcc dot gnu dot org
2004-12-19 13:03 ` steven at gcc dot gnu dot org
2004-12-20 11:27 ` cvs-commit at gcc dot gnu dot org
2004-12-20 11:28 ` steven at gcc dot gnu dot org
2004-12-20 11:29 ` steven 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).