-Wwritestrings affects exceptions

Jim McKelvey mckelvey@solstice.jpl.nasa.gov
Fri Aug 14 09:07:00 GMT 1998


I'm sending this again, because the nature of the bug was misunderstood by
some.


#include <stdio.h>

> int main(void)
{
    try
    {
         throw "b";
    }
    catch (char * e)
    {
        fprintf(stderr, "%s\n", e);
    }
    return 0;
}


If -Wwritestrings is specified, this works correctly, and the exception is
NOT caught.

If -Wwritestrings is NOT specified, the exception is caught.

If a const is added to the catch, it catches properly in both cases.


Sparc Ultra-2, egcs-1.0.3a.


James W. McKelvey
mckelvey@solstice.jpl.nasa.gov





More information about the Gcc-bugs mailing list