This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15508] Size evaluation of variable-length array seem to be skipped in some cases.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]