This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15508] Size evaluation of variable-length array seem to be skipped in some cases.
- From: "takashi dot yano at nifty dot ne dot jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2004 15:09:40 -0000
- Subject: [Bug c++/15508] Size evaluation of variable-length array seem to be skipped in some cases.
- References: <20040518102702.15508.takashi.yano@nifty.ne.jp>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From takashi dot yano at nifty dot ne dot jp 2004-05-18 15:09 -------
The point of the problem, I mentioned first, is in 'if (r<5) a[1][0] = 0;'.
Size evaluation of 'int [r]' is first needed in 'a[1][0] = 0;' in func().
g++ 2.96 and 3.3.1 generate the code which evaluate the size of 'int [r]'
in the 'if' block and store it. The evaluation result is re-used thereafter.
But, obviously, the 'if' block is executed only when r<5.
If r>=5, the evaluation result is used though it is not evaluated yet.
This is the cause.
Are there still any problems in my code, you think?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15508