[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 Marek Polacek mpolacek at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread warnerme at ptd dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #5 from Mark Warner warnerme at ptd dot net --- sizeof(NSQ_del_dec_struct) / sizeof(opus_int32) is guaranteed to produced a even number with a remainder of 0. Note the __attribute__ ((__aligned__ (8))) to make it a multiple of 8 in

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread warnerme at ptd dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #6 from Mark Warner warnerme at ptd dot net --- If it is invalid, why does -Wall not trigger anything ?

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #7 from Marek Polacek mpolacek at gcc dot gnu.org --- (int)(sizeof(NSQ_del_dec_struct) / sizeof(opus_int32) seems to be 1168/4 = 292, but sLPC_Q14 has only 112 elements.

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added CC||jakub at gcc dot

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread ian at g0tcd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #9 from Ian Hamilton ian at g0tcd dot com --- Yes, that's all proper and correct. The invalid C code induces undefined behaviour. I don't think anyone is disputing that. However, to be pragmatic for a moment, the experience of

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #10 from Jakub Jelinek jakub at gcc dot gnu.org --- We have -fsanitize=undefined which can catch some issues, though the array bounds instrumentation (nor __builtin_object_size based instrumentation) has not been added yet for GCC 4.9,

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread warnerme at ptd dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #11 from Mark Warner warnerme at ptd dot net --- I'm confused .. what about.. for (k = i; k (int)(sizeof(NSQ_del_dec_struct) / sizeof(opus_int32)); ++k) ... is illegal or invalid ? Why does it only fail if -DDEBUG is defined ? I mean,

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #12 from Jakub Jelinek jakub at gcc dot gnu.org --- (In reply to Mark Warner from comment #11) I'm confused .. what about.. for (k = i; k (int)(sizeof(NSQ_del_dec_struct) / sizeof(opus_int32)); ++k) ... is illegal or invalid ? Why

[Bug c/59933] for loop goes wild with assert() enabled

2014-02-19 Thread ian at g0tcd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #13 from Ian Hamilton ian at g0tcd dot com --- (In reply to Mark Warner from comment #11) I'm confused .. what about.. for (k = i; k (int)(sizeof(NSQ_del_dec_struct) / sizeof(opus_int32)); ++k) ... is illegal or invalid ? Why does

[Bug c/59933] for loop goes wild with assert() enabled

2014-01-29 Thread ian at g0tcd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 Ian Hamilton ian at g0tcd dot com changed: What|Removed |Added CC||ian at g0tcd dot com

[Bug c/59933] for loop goes wild with assert() enabled

2014-01-29 Thread ian at g0tcd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #3 from Ian Hamilton ian at g0tcd dot com --- Just a thought. Does ((int)(sizeof(NSQ_del_dec_struct) / sizeof(opus_int32)) correctly give you the size of the sLPC_Q14 array? From playing with my test case, it seems that if the

[Bug c/59933] for loop goes wild with assert() enabled

2014-01-24 Thread warnerme at ptd dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #1 from Mark Warner warnerme at ptd dot net --- Created attachment 31945 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31945action=edit C source of subroutines which contain problem for loop This is a file from OPUS. As sent it