[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 --- (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 it only fail if

[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 --- (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 it only fail i

[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 --- 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, this code worked fine

[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 --- 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, will be hopefully there

[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 --- 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 thousands of developers out

[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 changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #8 f

[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 --- (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 warnerme at ptd dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 --- Comment #6 from Mark Warner --- If it is invalid, why does -Wall not trigger anything ?

[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 --- 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 size.

[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 changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC|

[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 --- 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 optimiser spots that k wil

[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 changed: What|Removed |Added CC||ian at g0tcd dot com --- Comment #2 from I

[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 --- Created attachment 31945 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31945&action=edit C source of subroutines which contain problem for loop This is a file from OPUS. As sent it can't be run, but the