[PATCH] builtins: Report error for negative length argument for memset

Andreas Krebbel Andreas.Krebbel@de.ibm.com
Mon Apr 23 15:14:00 GMT 2007


> This cannot be an error as the code is just invokes undefined behavior
> at runtime.
> You can warn but it cannot be an error.
> 
> Also it seems like you need a couple of testcases.

Actually even a warning would be wrong. The patch was a bit overhasty anyway. The memset
length operand can't be negative since it is a size_t. The proper solution should be to
remove the broken assertion in the S/390 back end and make sure that the back end function handles
large constant length arguments properly. I'll submit a new patch. 

Bye,

-Andreas-



More information about the Gcc-patches mailing list