This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Undefined behavior due to 6.5.16.1p3
- From: Vincent Lefevre <vincent+gcc at vinc17 dot org>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 11 Mar 2015 18:02:08 +0100
- Subject: Re: Undefined behavior due to 6.5.16.1p3
- Authentication-results: sourceware.org; auth=none
- References: <54FF195B dot 5060604 at redhat dot com> <54FF1F7C dot 5050501 at robbertkrebbers dot nl> <54FF2182 dot 1090800 at robbertkrebbers dot nl> <alpine dot DEB dot 2 dot 10 dot 1503102153590 dot 10726 at digraph dot polyomino dot org dot uk> <550042BD dot 8000608 at robbertkrebbers dot nl> <20150311160815 dot GA2967 at ypig dot lip dot ens-lyon dot fr> <20150311161155 dot GM1746 at tucnak dot redhat dot com> <20150311163101 dot GA4384 at ypig dot lip dot ens-lyon dot fr> <20150311163931 dot GN1746 at tucnak dot redhat dot com> <20150311165601 dot GB4384 at ypig dot lip dot ens-lyon dot fr>
BTW, the following is forbidden (and makes no sense), but is accepted
by GCC without a warning:
int foo (void)
{
union { char a[8]; int b; } u = { .a = { 0 }, .b = 1 };
return u.b;
}
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)