This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11633] [DR 430] g++ does not initialize structures when auto-increment variables are used
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Apr 2004 17:25:16 -0000
- Subject: [Bug c++/11633] [DR 430] g++ does not initialize structures when auto-increment variables are used
- References: <20030722205341.11633.msimons@simons-clan.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-30 17:25 -------
Adding what I got in my email:
From: msimons@moria.simons-clan.com
Subject: Re: [Bug c++/11633] [DR 430] g++ does not initialize structures when auto-increment
variables are used
Date: April 30, 2004 13:19:11 EDT
To: jsa@edg.com
Cc: msimons@simons-clan.com, pinskia@gcc.gnu.org
Steve Adamczyk wrote:
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#430
I believe the standard is clear that each initializer expression in the
above is a full-expression (1.9 intro.execution/12-13; see also issue
392) and therefore there is a sequence point after each expression
(1.9 intro.execution/16). I agree that the standard does not seem to
dictate the order in which the expressions are evaluated, and perhaps
it should.
Does anyone know of a compiler that would not evaluate the expressions
left to right?
Steve,
Actually there is one, that does not do left to right: gcc/C++.
None of the post increment operations take effect until after the
statement finishes. So in the sample code gcc stores 23 into all
positions in the array.
The commercial vendor C++ compilers for AIX, Solaris, Tru64, HPUX
(parisc and ia64), and Windows, all do sequence points at each ','
in the initializer list.
So I opened a bug report against gcc (#11633, link to bug below).
Unfortunately if the C++ standard does not say one way or the other
then gcc/C++ is unlikely to change.
On Fri, Apr 30, 2004 at 01:13:38AM -0000, pinskia at gcc dot gnu dot org wrote:
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-30 01:13 -------
The DR report is 430: <http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#430>.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|g++ does not initialize |[DR 430] g++ does not
|structures when auto- |initialize structures when
|increment variables are used|auto-increment variables are
| |used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11633
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11633