Dmitry K. wrote:
[...]
void foo (int i)
{
    static int n;
    if (i < CHAR_MIN || i > CHAR_MAX)
        abort ();
    if (++n > 1000)
        exit (0);
}

int main ()
{
    char c;
    for (c = 0; ; c++) foo (c);
}

Is this strictly wrong, from the C definition point of view?

I know that signed overflow is "undefined". How does this test case interacts with -fwrapv and -fno-strict-overflow?

For those unaware of signed overflow issues, there is a nice sum up here:

http://www.airs.com/blog/archives/120

I know that turning "undefined" into an "out of range" result is ugly, but so is signed overflow....

--
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"...so she told me it was either her or the ham radio, over."


_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to