public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Initialising an union.
@ 1998-08-17  7:51 Aurel Balmosan
  1998-08-18 11:46 ` Jeroen Dobbelaere
  0 siblings, 1 reply; 10+ messages in thread
From: Aurel Balmosan @ 1998-08-17  7:51 UTC (permalink / raw)
  To: egcs-bugs

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

Hello,

I noticed a problem while initialising an union.
Here a test source:

struct a {
        int a;
};

struct b {
        int a;
        double b;
};

struct c {
        int a;
        double b;
        char c[16];
};

union x {
        int a;
        struct a as;
        struct b bs;
        struct c cs;
};

void test()
{       union x X = { 0 };
        for(;;);
        X.a++;
}

void main()
{       char    c[]="1123124213";
        test();

}

You will notice that the union X is not fully initialised. At least
I noticed that
on DecUNIX-4.0b (4.0d) Solaris-2.5.1 with the egcs version

  egcs-2.90.29 980515 (egcs-1.0.3 release)

 
-- 
Aurel Balmosan           | Department SE-SW
ORGA Kartensysteme GmbH  | phone: +49 5254 991 824
An der Kapelle 2         | fax  : +49 5254 991 749
33104 Paderborn, Germany | mailto:ab@orga.com
 


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Initialising an union
@ 1998-08-18  0:39 Aurel Balmosan
  1998-08-18 18:14 ` Alexandre Oliva
  0 siblings, 1 reply; 10+ messages in thread
From: Aurel Balmosan @ 1998-08-18  0:39 UTC (permalink / raw)
  To: egcs-bugs

Hello,

I noticed a problem while initialising an union.
Here a test source:

struct a {
        int a;
};

struct b {
        int a;
        double b;
};

struct c {
        int a;
        double b;
        char c[16];
};

union x {
        int a;
        struct a as;
        struct b bs;
        struct c cs;
};

void test()
{       union x X = { 0 };
        for(;;);
        X.a++;
}

void main()
{       char    c[]="1123124213";
        test();

}

You will notice that the union X is not fully initialised. At least I noticed
that
on DecUNIX-4.0b (4.0d) Solaris-2.5.1 with the egcs version

  egcs-2.90.29 980515 (egcs-1.0.3 release)

--
Aurel Balmosan           | Department SE-SW
ORGA Kartensysteme GmbH  | phone: +49 5254 991 824
An der Kapelle 2         | fax  : +49 5254 991 749
33104 Paderborn, Germany | mailto:ab@orga.com





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

end of thread, other threads:[~1998-08-20  8:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-17  7:51 Initialising an union Aurel Balmosan
1998-08-18 11:46 ` Jeroen Dobbelaere
1998-08-19  4:40   ` Aurel Balmosan
1998-08-19 10:03     ` Jeroen Dobbelaere
1998-08-18  0:39 Aurel Balmosan
1998-08-18 18:14 ` Alexandre Oliva
1998-08-19  2:44   ` Aurel Balmosan
1998-08-19 14:51     ` Alexandre Oliva
1998-08-20  2:41       ` Aurel Balmosan
1998-08-20  8:15         ` Alexandre Oliva

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).