How to force gcc to report a warning/error
Andrew Haley
aph@redhat.com
Tue Oct 26 17:22:00 GMT 2010
On 10/26/2010 09:17 AM, ppmoore wrote:
>
> Hello,
>
> We had an interesting error that was undetected in gcc:
> {
> unsigned long a;
> unsigned long x=3;
> unsigned long y=4;
> a =
> min(x,y);
> }
>
> I've simplified the example. In the original code, the contents of the min()
> statement were longer, so that it was on a separate line from the assignment
> operation.
>
> Because of a bug, the assignment line was removed, and we had the following
> code:
> {
> unsigned long a;
> unsigned long x=3;
> unsigned long y=4;
> min(x,y);
> }
>
> Should this be picked up as a warning/error?
No, not unless you want a warning from every use of printf().
Ignoring the return value of a function call is usual in C.
Andrew.
More information about the Gcc-help
mailing list